From 6d584eacd369ca87f26d77104f7da34de9322ade Mon Sep 17 00:00:00 2001 From: siq1 Date: Thu, 22 Aug 2024 04:45:10 +0800 Subject: [PATCH] add test dependency in ci to prevent 403 --- .github/workflows/{build_libs.yml => ci.yml} | 51 +++++++++++++++++-- .github/workflows/tests.yml | 52 -------------------- 2 files changed, 46 insertions(+), 57 deletions(-) rename .github/workflows/{build_libs.yml => ci.yml} (54%) delete mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/build_libs.yml b/.github/workflows/ci.yml similarity index 54% rename from .github/workflows/build_libs.yml rename to .github/workflows/ci.yml index 62e58bb..adb56a3 100644 --- a/.github/workflows/build_libs.yml +++ b/.github/workflows/ci.yml @@ -1,17 +1,20 @@ -name: Build libs +name: ci on: push: branches: - rust_rewrite +env: + RUSTFLAGS: "-Dwarnings" + RUST_BACKTRACE: 1 + jobs: - build: + build-rust: runs-on: ${{ matrix.os }} strategy: matrix: os: [ubuntu-latest, macos-latest] - steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable @@ -26,8 +29,8 @@ jobs: name: build-${{ matrix.os }} path: expander_compiler/target/release/libec_go_lib.* - upload: - needs: build + upload-rust: + needs: build-rust runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -50,3 +53,41 @@ jobs: git add ./libec_go_lib.* -f git commit -m "Add built libs" git push -f --set-upstream origin rust-built-libs + + test-rust: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest] + steps: + - uses: styfle/cancel-workflow-action@0.11.0 + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - uses: Swatinem/rust-cache@v2 + with: + workspaces: "expander_compiler -> expander_compiler/target" + - run: cargo test --manifest-path=expander_compiler/Cargo.toml + + test-go: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest] + needs: build-rust + steps: + - uses: styfle/cancel-workflow-action@0.11.0 + - uses: actions/checkout@v4 + - name: Setup Go 1.21.x + uses: actions/setup-go@v5 + with: + go-version: '1.21.x' + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + path: ./artifacts + pattern: build-${{ matrix.os }} + merge-multiple: true + - run: | + cp artifacts/libec_go_lib.* ecgo/compile/wrapper/ + cd ecgo + go test ./test/ diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml deleted file mode 100644 index 987365b..0000000 --- a/.github/workflows/tests.yml +++ /dev/null @@ -1,52 +0,0 @@ -name: Tests - -on: - push: - branches: - - rust_rewrite - -env: - RUSTFLAGS: "-Dwarnings" - RUST_BACKTRACE: 1 - -jobs: - Test-rust-mac: - runs-on: macos-latest - steps: - - uses: styfle/cancel-workflow-action@0.11.0 - - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@stable - - uses: Swatinem/rust-cache@v2 - with: - workspaces: "expander_compiler -> expander_compiler/target" - - run: cargo test --manifest-path=expander_compiler/Cargo.toml - Test-rust-linux: - runs-on: ubuntu-latest - steps: - - uses: styfle/cancel-workflow-action@0.11.0 - - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@stable - - uses: Swatinem/rust-cache@v2 - with: - workspaces: "expander_compiler -> expander_compiler/target" - - run: cargo test --manifest-path=expander_compiler/Cargo.toml - Test-go-mac: - runs-on: macos-latest - steps: - - uses: styfle/cancel-workflow-action@0.11.0 - - uses: actions/checkout@v4 - - name: Setup Go 1.21.x - uses: actions/setup-go@v5 - with: - go-version: '1.21.x' - - run: cd ecgo && go test ./test/ - Test-go-linux: - runs-on: ubuntu-latest - steps: - - uses: styfle/cancel-workflow-action@0.11.0 - - uses: actions/checkout@v4 - - name: Setup Go 1.21.x - uses: actions/setup-go@v5 - with: - go-version: '1.21.x' - - run: cd ecgo && go test ./test/ \ No newline at end of file