From 46ef3f9aff8a308f5d170ee065d8e67d683e84af Mon Sep 17 00:00:00 2001 From: Miles Liu Date: Wed, 2 Nov 2022 10:30:50 +0800 Subject: [PATCH] CI: remove use of actions-rs/cargo actions-rs is currently inactive and has an issue like actions-rs/cargo#216 --- .github/workflows/CICD.yml | 46 +++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index b84613782..df6f43384 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -28,17 +28,11 @@ jobs: profile: minimal # minimal component installation (ie, no documentation) components: clippy, rustfmt - name: Ensure `cargo fmt` has been run - uses: actions-rs/cargo@v1 - with: - command: fmt - args: -- --check + run: cargo fmt --check - name: Ensure MSRV is set in `clippy.toml` run: grep "^msrv = \"${{ env.MIN_SUPPORTED_RUST_VERSION }}\"\$" clippy.toml - name: Run clippy - uses: actions-rs/cargo@v1 - with: - command: clippy - args: --locked --all-targets --all-features + run: cargo clippy --locked --all-targets --all-features min_version: name: Minimum supported rust version @@ -55,15 +49,9 @@ jobs: components: clippy profile: minimal - name: Run clippy (on minimum supported rust version to prevent warnings we can't fix) - uses: actions-rs/cargo@v1 - with: - command: clippy - args: --locked --all-targets --all-features + run: cargo clippy --locked --all-targets --all-features - name: Run tests - uses: actions-rs/cargo@v1 - with: - command: test - args: --locked + run: cargo test --locked build: name: ${{ matrix.job.os }} (${{ matrix.job.target }}) @@ -122,12 +110,15 @@ jobs: cargo -V rustc -V + - name: Cross build + if: ${{ matrix.job.use-cross == true }} + run: | + cargo install cross + cross build --locked --release --target=${{ matrix.job.target }} + - name: Build - uses: actions-rs/cargo@v1 - with: - use-cross: ${{ matrix.job.use-cross }} - command: build - args: --locked --release --target=${{ matrix.job.target }} + if: ${{ matrix.job.use-cross == false }} + run: cargo build --locked --release --target=${{ matrix.job.target }} - name: Strip debug information from executable id: strip @@ -174,12 +165,15 @@ jobs: unset CARGO_TEST_OPTIONS ; case ${{ matrix.job.target }} in arm-* | aarch64-*) CARGO_TEST_OPTIONS="--bin ${PROJECT_NAME}" ;; esac; echo ::set-output name=CARGO_TEST_OPTIONS::${CARGO_TEST_OPTIONS} + - name: Run cross tests + if: ${{ matrix.job.use-cross }} == true + run: | + cargo install cross + cross test --locked --target=${{ matrix.job.target }} ${{ steps.test-options.outputs.CARGO_TEST_OPTIONS}} + - name: Run tests - uses: actions-rs/cargo@v1 - with: - use-cross: ${{ matrix.job.use-cross }} - command: test - args: --locked --target=${{ matrix.job.target }} ${{ steps.test-options.outputs.CARGO_TEST_OPTIONS}} + if: ${{ matrix.job.use-cross }} == false + run: cargo test --locked --target=${{ matrix.job.target }} ${{ steps.test-options.outputs.CARGO_TEST_OPTIONS}} - name: Generate completions id: completions