diff --git a/.github/workflows/client_build.yml b/.github/workflows/client_build.yml index 8eb4150..471950c 100644 --- a/.github/workflows/client_build.yml +++ b/.github/workflows/client_build.yml @@ -14,11 +14,11 @@ jobs: - uses: actions/checkout@v3 with: submodules: true - - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - with: - platforms: arm64 + #- + # name: Set up QEMU + # uses: docker/setup-qemu-action@v2 + # with: + # platforms: arm64 - name: Set up Docker Buildx @@ -35,7 +35,7 @@ jobs: uses: docker/build-push-action@v2 with: context: . - platforms: linux/amd64,linux/arm64 + #platforms: linux/amd64,linux/arm64 push: true file: command/docker/client/client.Dockerfile cache-from: type=gha diff --git a/.github/workflows/client_build_arm64.yml b/.github/workflows/client_build_arm64.yml index 5f352a7..453e55f 100644 --- a/.github/workflows/client_build_arm64.yml +++ b/.github/workflows/client_build_arm64.yml @@ -1,5 +1,6 @@ name: fornet arm64 client build # run at self-hosted mac min M2 +# But it does not success for SSL timeout. we may try other methods to do this on: workflow_dispatch: inputs: @@ -35,7 +36,7 @@ jobs: file: command/docker/client/client.Dockerfile cache-from: type=gha cache-to: type=gha,mode=max - tags: ${{ env.REGISTRY }}/fornetcode/fornet:${{github.event.inputs.version}}, ${{ env.REGISTRY }}/fornetcode/fornet:latest + tags: ${{ env.REGISTRY }}/fornetcode/fornet:${{github.event.inputs.version}} - name: copy binary from docker to release directory run: | mkdir -p release diff --git a/.github/workflows/client_mac_arm64.yml b/.github/workflows/client_mac_arm64.yml new file mode 100644 index 0000000..ea5a35a --- /dev/null +++ b/.github/workflows/client_mac_arm64.yml @@ -0,0 +1,54 @@ +name: fornet arm64 client build +# run at self-hosted mac min M2 +on: + workflow_dispatch: + inputs: + version: + required: true + description: "version to release" +env: + REGISTRY: ghcr.io +jobs: + mac_arm64: + strategy: + max-parallel: 1 + fail-fast: true + matrix: + settings: + - host: self-hosted + target: aarch64-apple-darwin + build: make release-mac-aarch64 + + runs-on: ${{ matrix.settings.host }} + steps: + - uses: actions/checkout@v3 + with: + submodules: true + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + target: ${{ matrix.settings.target }} + profile: minimal + - name: Set up cargo cache + uses: actions/cache@v3 + continue-on-error: false + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + client/target/ + key: ${{ matrix.settings.host }}-${{ matrix.settings.target }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ matrix.settings.host }}-cargo-${{ matrix.settings.target }} + # - name: Setup tmate session + # uses: mxschmitt/action-tmate@v3 + - name: Build + run: ${{ matrix.settings.build }} + + - name: Upload artifact + uses: actions/upload-artifact@v2 + with: + path: release/* + if-no-files-found: error \ No newline at end of file diff --git a/.github/workflows/server_build.yml b/.github/workflows/server_build.yml index db8d49a..21e0ff7 100644 --- a/.github/workflows/server_build.yml +++ b/.github/workflows/server_build.yml @@ -13,6 +13,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + with: + submodules: true + - uses: coursier/cache-action@v6 - uses: coursier/setup-action@v1 with: @@ -44,3 +47,8 @@ jobs: cache-from: type=gha cache-to: type=gha,mode=max tags: ${{ env.REGISTRY }}/fornetcode/fornet-backend:${{github.event.inputs.version}} + - name: Upload jar to artifact + uses: actions/upload-artifact@v2 + with: + path: release/* + if-no-files-found: error \ No newline at end of file diff --git a/Makefile b/Makefile index 3e865c5..03ff52b 100644 --- a/Makefile +++ b/Makefile @@ -16,6 +16,7 @@ release-mac-x86_64: otool -L client/target/x86_64-apple-darwin/release/fornet-cli tar -C client/target/x86_64-apple-darwin/release/ -czvf release/fornet-mac-x86_64.tar.gz ./fornet ./fornet-cli +# brew install cmake wget release-mac-aarch64: mkdir protoc && cd protoc && wget https://github.com/protocolbuffers/protobuf/releases/download/v21.9/protoc-21.9-osx-aarch_64.zip && unzip protoc-21.9-osx-aarch_64.zip && sudo cp bin/protoc /usr/local/bin cp -r protoc/include/* protobuf/ @@ -51,4 +52,6 @@ release-backend: cd admin-web && npm ci && npm run build:prod && cd ../ cp -r admin-web/build/ command/docker/backend/web cd backend && sbt universal:packageBin && cd ../ + mkdir release + cp backend/target/universal/app-*.zip release/ cp backend/target/universal/app-*.zip command/docker/backend/app.zip && cd command/docker/backend && unzip app.zip && rm app.zip && mv app-* app \ No newline at end of file diff --git a/admin-web/package.json b/admin-web/package.json index a5b54dc..5144082 100644 --- a/admin-web/package.json +++ b/admin-web/package.json @@ -1,6 +1,6 @@ { "name": "admin-web", - "version": "0.0.3", + "version": "0.0.4", "private": true, "dependencies": { "@reduxjs/toolkit": "^1.8.6", diff --git a/backend/build.sbt b/backend/build.sbt index 25749f6..cdd883b 100644 --- a/backend/build.sbt +++ b/backend/build.sbt @@ -21,7 +21,7 @@ lazy val webSugar = RootProject(file("../third/web-sugar")) lazy val app = project .in(file(".")) .settings( - version := "0.0.3", + version := "0.0.4", scalaVersion := scala3Version, libraryDependencies ++= Seq( diff --git a/client/Cargo.lock b/client/Cargo.lock index f29e898..b7b2038 100644 --- a/client/Cargo.lock +++ b/client/Cargo.lock @@ -767,7 +767,7 @@ dependencies = [ [[package]] name = "fornet" -version = "0.0.3" +version = "0.0.4" dependencies = [ "anyhow", "clap", @@ -781,7 +781,7 @@ dependencies = [ [[package]] name = "fornet-lib" -version = "0.0.3" +version = "0.0.4" dependencies = [ "anyhow", "arrayref", diff --git a/client/bin/Cargo.toml b/client/bin/Cargo.toml index 589abe6..c6cacd8 100644 --- a/client/bin/Cargo.toml +++ b/client/bin/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "fornet" -version = "0.0.3" +version = "0.0.4" edition = "2021" [[bin]] diff --git a/client/lib/Cargo.toml b/client/lib/Cargo.toml index 5a7a652..28899ee 100644 --- a/client/lib/Cargo.toml +++ b/client/lib/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "fornet-lib" -version = "0.0.3" +version = "0.0.4" edition = "2021" # For test diff --git a/command/docker-compose/simple/docker-compose.yml b/command/docker-compose/simple/docker-compose.yml index 03a7710..ed2336c 100644 --- a/command/docker-compose/simple/docker-compose.yml +++ b/command/docker-compose/simple/docker-compose.yml @@ -3,7 +3,7 @@ version: "3" services: mqtt: - image: rmqtt/rmqtt:0.2.11 + image: rmqtt/rmqtt:latest container_name: mqtt ports: - 1883:1883 diff --git a/command/docker/client/client.Dockerfile b/command/docker/client/client.Dockerfile index c4c0157..44cb1ce 100644 --- a/command/docker/client/client.Dockerfile +++ b/command/docker/client/client.Dockerfile @@ -9,7 +9,7 @@ ARG BASE_IMAGE=rust:1.65 #ARG RUNTIME_IMAGE=alpine ARG RUNTIME_IMAGE=rust:1.65 -FROM --platform=$BUILDPLATFORM ${BASE_IMAGE} AS builder +FROM ${BASE_IMAGE} AS builder RUN apt update && apt install -y cmake bash @@ -20,7 +20,6 @@ RUN apt update && apt install -y cmake bash ADD protobuf /source/protobuf ADD third /source/third ADD client /source/client -ADD win-tun-driver /source/win-tun-driver ADD command/docker/client/script.sh /script.sh RUN chmod +x /script.sh && /script.sh #RUN ls -al && cd protobuf && ls -al && cd ../ @@ -28,11 +27,11 @@ RUN chmod +x /script.sh && /script.sh RUN --mount=type=cache,target=/usr/local/cargo/registry \ cd /source/client && cargo build --release -FROM --platform=$BUILDPLATFORM ${RUNTIME_IMAGE} +FROM ${RUNTIME_IMAGE} ENV FORNET_CONFIG=/config -RUN mkdir /config && apt-get update && apt install -y iproute2 +RUN mkdir /config && apt update && apt install -y iproute2 COPY --from=builder /source/client/target/release/fornet /usr/bin COPY --from=builder /source/client/target/release/fornet-cli /usr/bin diff --git a/command/docker/client/docker_build.sh b/command/docker/client/docker_build.sh old mode 100644 new mode 100755 diff --git a/command/docker/client/script.sh b/command/docker/client/script.sh old mode 100644 new mode 100755 diff --git a/command/docker/mqtt/run.sh b/command/docker/mqtt/run.sh index 495a4a8..906e046 100755 --- a/command/docker/mqtt/run.sh +++ b/command/docker/mqtt/run.sh @@ -2,5 +2,5 @@ # 1883(mqtt) 6060(http) 5363(grpc) # docker rm -f mqtt -docker run -d --name mqtt --network=host -v $(pwd)/log:/var/log/rmqtt -v $(pwd)/config/rmqtt.toml:/app/rmqtt/rmqtt.toml -v $(pwd)/config/plugin:/app/rmqtt/plugin rmqtt/rmqtt:0.2.11 +docker run -d --name mqtt --network=host -v $(pwd)/log:/var/log/rmqtt -v $(pwd)/config/rmqtt.toml:/app/rmqtt/rmqtt.toml -v $(pwd)/config/plugin:/app/rmqtt/plugin rmqtt/rmqtt:latest # docker logs -f --tail 50 mqtt \ No newline at end of file