From 265d46a96ecfec49a32973f66f8aa811586c5d4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Vincent?= <28714795+leovct@users.noreply.github.com> Date: Thu, 18 Jan 2024 15:46:11 +0100 Subject: [PATCH] chore: update ci workflow (#1475) * chore: bump `actions/checkout` and `actions/cache` * chore: use `dtolnay/rust-toolchain` and `Swatinem/rust-cache` instead of outdated github actions * chore: use `cargo test` * chore: remove `actions-rs/cargo` * fix: typo * chore: enable to cancel in-progress jobs * chore: add job timeouts --- .../continuous-integration-workflow.yml | 123 +++++------------- 1 file changed, 36 insertions(+), 87 deletions(-) diff --git a/.github/workflows/continuous-integration-workflow.yml b/.github/workflows/continuous-integration-workflow.yml index 7c0e479458..7c18a405a9 100644 --- a/.github/workflows/continuous-integration-workflow.yml +++ b/.github/workflows/continuous-integration-workflow.yml @@ -10,39 +10,33 @@ on: branches: - "**" +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +env: + CARGO_TERM_COLOR: always + jobs: test: name: Test Suite runs-on: ubuntu-latest + timeout-minutes: 30 if: "! contains(toJSON(github.event.commits.*.message), '[skip-ci]')" steps: - name: Checkout sources - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Install nightly toolchain - id: rustc-toolchain - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: nightly - override: true + uses: dtolnay/rust-toolchain@nightly - - name: rust-cache - uses: actions/cache@v3 + - name: Set up rust cache + uses: Swatinem/rust-cache@v2 with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: rustc-test-${{ steps.rustc-toolchain.outputs.rustc_hash }}-cargo-${{ hashFiles('**/Cargo.toml') }} + cache-on-failure: true - name: Check in plonky2 subdirectory - uses: actions-rs/cargo@v1 - with: - command: check - args: --manifest-path plonky2/Cargo.toml + run: cargo check --manifest-path plonky2/Cargo.toml env: RUSTFLAGS: -Copt-level=3 -Cdebug-assertions -Coverflow-checks=y -Cdebuginfo=0 RUST_LOG: 1 @@ -50,10 +44,7 @@ jobs: RUST_BACKTRACE: 1 - name: Check in starky subdirectory - uses: actions-rs/cargo@v1 - with: - command: check - args: --manifest-path starky/Cargo.toml + run: cargo check --manifest-path starky/Cargo.toml env: RUSTFLAGS: -Copt-level=3 -Cdebug-assertions -Coverflow-checks=y -Cdebuginfo=0 RUST_LOG: 1 @@ -61,10 +52,7 @@ jobs: RUST_BACKTRACE: 1 - name: Check in evm subdirectory - uses: actions-rs/cargo@v1 - with: - command: check - args: --manifest-path evm/Cargo.toml + run: cargo check --manifest-path evm/Cargo.toml env: RUSTFLAGS: -Copt-level=3 -Cdebug-assertions -Coverflow-checks=y -Cdebuginfo=0 RUST_LOG: 1 @@ -72,10 +60,7 @@ jobs: RUST_BACKTRACE: 1 - name: Run cargo test - uses: actions-rs/cargo@v1 - with: - command: test - args: --workspace + run: cargo test --workspace env: RUSTFLAGS: -Copt-level=3 -Cdebug-assertions -Coverflow-checks=y -Cdebuginfo=0 RUST_LOG: 1 @@ -85,37 +70,24 @@ jobs: wasm32: name: wasm32 compatibility runs-on: ubuntu-latest + timeout-minutes: 30 if: "! contains(toJSON(github.event.commits.*.message), '[skip-ci]')" steps: - name: Checkout sources - uses: actions/checkout@v2 + uses: actions/checkout@v4 - - name: Install nightly wasm32 toolchain - id: rustc-toolchain - uses: actions-rs/toolchain@v1 + - name: Install nightly toolchain + uses: dtolnay/rust-toolchain@nightly with: - profile: minimal - toolchain: nightly - target: wasm32-unknown-unknown - default: true - override: true - - - name: rust-cache - uses: actions/cache@v3 + targets: wasm32-unknown-unknown + + - name: Set up rust cache + uses: Swatinem/rust-cache@v2 with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: rustc-wasm32-${{ steps.rustc-toolchain.outputs.rustc_hash }}-cargo-${{ hashFiles('**/Cargo.toml') }} + cache-on-failure: true - name: Check in plonky2 subdirectory - uses: actions-rs/cargo@v1 - with: - command: check - args: --manifest-path plonky2/Cargo.toml --target wasm32-unknown-unknown --no-default-features + run: cargo check --manifest-path plonky2/Cargo.toml --target wasm32-unknown-unknown --no-default-features env: RUSTFLAGS: -Copt-level=3 -Cdebug-assertions -Coverflow-checks=y -Cdebuginfo=0 RUST_LOG: 1 @@ -123,10 +95,7 @@ jobs: RUST_BACKTRACE: 1 - name: Check in starky subdirectory - uses: actions-rs/cargo@v1 - with: - command: check - args: --manifest-path starky/Cargo.toml --target wasm32-unknown-unknown --no-default-features + run: cargo check --manifest-path starky/Cargo.toml --target wasm32-unknown-unknown --no-default-features env: RUSTFLAGS: -Copt-level=3 -Cdebug-assertions -Coverflow-checks=y -Cdebuginfo=0 RUST_LOG: 1 @@ -136,44 +105,24 @@ jobs: lints: name: Formatting and Clippy runs-on: ubuntu-latest + timeout-minutes: 10 if: "! contains(toJSON(github.event.commits.*.message), '[skip-ci]')" steps: - name: Checkout sources - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Install nightly toolchain - id: rustc-toolchain - uses: actions-rs/toolchain@v1 + uses: dtolnay/rust-toolchain@nightly with: - profile: minimal - toolchain: nightly - override: true components: rustfmt, clippy - - name: rust-cache - uses: actions/cache@v3 + - name: Set up rust cache + uses: Swatinem/rust-cache@v2 with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: rustc-lints-${{ steps.rustc-toolchain.outputs.rustc_hash }}-cargo-${{ hashFiles('**/Cargo.toml') }} + cache-on-failure: true - name: Run cargo fmt - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --all -- --check - env: - CARGO_INCREMENTAL: 1 + run: cargo fmt --all --check - name: Run cargo clippy - uses: actions-rs/cargo@v1 - with: - command: clippy - args: --all-features --all-targets -- -D warnings -A incomplete-features - env: - # Seems necessary until https://github.com/rust-lang/rust/pull/115819 is merged. - CARGO_INCREMENTAL: 0 + run: cargo clippy --all-features --all-targets -- -D warnings -A incomplete-features