From 3ae7362f582606f21cb456cd9cd06ea87530b9ee Mon Sep 17 00:00:00 2001 From: Yingwen Date: Thu, 10 Nov 2022 19:21:53 +0800 Subject: [PATCH] ci: Upgrade ci dependencies and switch to nextest (#446) * ci: Upgrade rust-cache to v2.2.0 v2.0.0 uses API that is deprecated * ci: Use --workspace in cargo llvm-cov * ci: Replace actions-rs/toolchain by dtolnay/rust-toolchain actions-rs/toolchain is under inactive maintenance, it uses node12 that would soon becomes deprecated * ci: Replace actions-rs/cargo by run * ci: rust-cache and cleanup-disk-action try not to specific full version * ci: Use nextest Also sets timeout for nextest to avoid a test hanging too long * ci: Upgrade actions/checkout to v3 To upgrade node from 12 to 16 * ci: Specific cleanup-disk-action version --- .config/nextest.toml | 2 ++ .github/workflows/coverage.yml | 11 +++--- .github/workflows/develop.yml | 62 +++++++++++++--------------------- .github/workflows/release.yml | 15 +++----- 4 files changed, 37 insertions(+), 53 deletions(-) create mode 100644 .config/nextest.toml diff --git a/.config/nextest.toml b/.config/nextest.toml new file mode 100644 index 0000000000..d5ac6dc652 --- /dev/null +++ b/.config/nextest.toml @@ -0,0 +1,2 @@ +[profile.default] +slow-timeout = { period = "60s", terminate-after = 3, grace-period = "30s" } diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 110d1cd809..88dd007b4d 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -18,24 +18,25 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 60 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: arduino/setup-protoc@v1 - name: Install toolchain - uses: actions-rs/toolchain@v1 + uses: dtolnay/rust-toolchain@master with: toolchain: ${{ env.RUST_TOOLCHAIN }} - override: true components: llvm-tools-preview - name: Rust Cache - uses: Swatinem/rust-cache@v2.0.0 + uses: Swatinem/rust-cache@v2 - name: Cleanup disk uses: curoky/cleanup-disk-action@v2.0 with: retain: 'rust' + - name: Install latest nextest release + uses: taiki-e/install-action@nextest - name: Install cargo-llvm-cov uses: taiki-e/install-action@cargo-llvm-cov - name: Collect coverage data - run: cargo llvm-cov --lcov --output-path lcov.info + run: cargo llvm-cov nextest --workspace --lcov --output-path lcov.info env: RUST_BACKTRACE: 1 CARGO_INCREMENTAL: 0 diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml index 8b29b85e87..88ffbecfe9 100644 --- a/.github/workflows/develop.yml +++ b/.github/workflows/develop.yml @@ -27,19 +27,15 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 60 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: arduino/setup-protoc@v1 - - uses: actions-rs/toolchain@v1 + - uses: dtolnay/rust-toolchain@master with: - profile: minimal toolchain: ${{ env.RUST_TOOLCHAIN }} - override: true - name: Rust Cache - uses: Swatinem/rust-cache@v2.0.0 - - uses: actions-rs/cargo@v1 - with: - command: check - args: --workspace --all-targets + uses: Swatinem/rust-cache@v2 + - name: Run cargo check + run: cargo check --workspace --all-targets test: name: Test Suite @@ -47,7 +43,7 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 60 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Cache LLVM and Clang id: cache-llvm uses: actions/cache@v3 @@ -59,21 +55,19 @@ jobs: with: version: "14.0" cached: ${{ steps.cache-llvm.outputs.cache-hit }} - - uses: actions-rs/toolchain@v1 + - uses: dtolnay/rust-toolchain@master with: - profile: minimal toolchain: ${{ env.RUST_TOOLCHAIN }} - override: true - name: Rust Cache - uses: Swatinem/rust-cache@v2.0.0 + uses: Swatinem/rust-cache@v2 - name: Cleanup disk uses: curoky/cleanup-disk-action@v2.0 with: retain: 'rust,llvm' - - uses: actions-rs/cargo@v1 - with: - command: test - args: --workspace + - name: Install latest nextest release + uses: taiki-e/install-action@nextest + - name: Run tests + run: cargo nextest run env: CARGO_BUILD_RUSTFLAGS: "-C link-arg=-fuse-ld=lld" RUST_BACKTRACE: 1 @@ -88,20 +82,16 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 60 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: arduino/setup-protoc@v1 - - uses: actions-rs/toolchain@v1 + - uses: dtolnay/rust-toolchain@master with: - profile: minimal toolchain: ${{ env.RUST_TOOLCHAIN }} - override: true + components: rustfmt - name: Rust Cache - uses: Swatinem/rust-cache@v2.0.0 - - run: rustup component add rustfmt - - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --all -- --check + uses: Swatinem/rust-cache@v2 + - name: Run cargo fmt + run: cargo fmt --all -- --check clippy: name: Clippy @@ -109,17 +99,13 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 60 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: arduino/setup-protoc@v1 - - uses: actions-rs/toolchain@v1 + - uses: dtolnay/rust-toolchain@master with: - profile: minimal toolchain: ${{ env.RUST_TOOLCHAIN }} - override: true + components: clippy - name: Rust Cache - uses: Swatinem/rust-cache@v2.0.0 - - run: rustup component add clippy - - uses: actions-rs/cargo@v1 - with: - command: clippy - args: --workspace --all-targets -- -D warnings -D clippy::print_stdout -D clippy::print_stderr + uses: Swatinem/rust-cache@v2 + - name: Run cargo clippy + run: cargo clippy --workspace --all-targets -- -D warnings -D clippy::print_stdout -D clippy::print_stderr diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 05d9eb733c..d81538d325 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -64,22 +64,17 @@ jobs: sudo apt-get -y update sudo apt-get -y install libssl-dev pkg-config g++-aarch64-linux-gnu gcc-aarch64-linux-gnu - - name: Install stable toolchain - uses: actions-rs/toolchain@v1 + - name: Install rust toolchain + uses: dtolnay/rust-toolchain@master with: - profile: minimal toolchain: ${{ env.RUST_TOOLCHAIN }} - override: true - target: ${{ matrix.arch }} + targets: ${{ matrix.arch }} - name: Output package versions run: protoc --version ; cargo version ; rustc --version ; gcc --version ; g++ --version - name: Run cargo build - uses: actions-rs/cargo@v1 - with: - command: build - args: ${{ matrix.opts }} --release --locked --target ${{ matrix.arch }} + run: cargo build ${{ matrix.opts }} --release --locked --target ${{ matrix.arch }} - name: Calculate checksum and rename binary shell: bash @@ -124,7 +119,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout sources - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Download amd64 binary uses: actions/download-artifact@v3