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
This commit is contained in:
Léo Vincent 2024-01-18 15:46:11 +01:00 committed by GitHub
parent 39a2d62d6d
commit 265d46a96e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -10,39 +10,33 @@ on:
branches: branches:
- "**" - "**"
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs: jobs:
test: test:
name: Test Suite name: Test Suite
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 30
if: "! contains(toJSON(github.event.commits.*.message), '[skip-ci]')" if: "! contains(toJSON(github.event.commits.*.message), '[skip-ci]')"
steps: steps:
- name: Checkout sources - name: Checkout sources
uses: actions/checkout@v2 uses: actions/checkout@v4
- name: Install nightly toolchain - name: Install nightly toolchain
id: rustc-toolchain uses: dtolnay/rust-toolchain@nightly
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
- name: rust-cache - name: Set up rust cache
uses: actions/cache@v3 uses: Swatinem/rust-cache@v2
with: with:
path: | cache-on-failure: true
~/.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') }}
- name: Check in plonky2 subdirectory - name: Check in plonky2 subdirectory
uses: actions-rs/cargo@v1 run: cargo check --manifest-path plonky2/Cargo.toml
with:
command: check
args: --manifest-path plonky2/Cargo.toml
env: env:
RUSTFLAGS: -Copt-level=3 -Cdebug-assertions -Coverflow-checks=y -Cdebuginfo=0 RUSTFLAGS: -Copt-level=3 -Cdebug-assertions -Coverflow-checks=y -Cdebuginfo=0
RUST_LOG: 1 RUST_LOG: 1
@ -50,10 +44,7 @@ jobs:
RUST_BACKTRACE: 1 RUST_BACKTRACE: 1
- name: Check in starky subdirectory - name: Check in starky subdirectory
uses: actions-rs/cargo@v1 run: cargo check --manifest-path starky/Cargo.toml
with:
command: check
args: --manifest-path starky/Cargo.toml
env: env:
RUSTFLAGS: -Copt-level=3 -Cdebug-assertions -Coverflow-checks=y -Cdebuginfo=0 RUSTFLAGS: -Copt-level=3 -Cdebug-assertions -Coverflow-checks=y -Cdebuginfo=0
RUST_LOG: 1 RUST_LOG: 1
@ -61,10 +52,7 @@ jobs:
RUST_BACKTRACE: 1 RUST_BACKTRACE: 1
- name: Check in evm subdirectory - name: Check in evm subdirectory
uses: actions-rs/cargo@v1 run: cargo check --manifest-path evm/Cargo.toml
with:
command: check
args: --manifest-path evm/Cargo.toml
env: env:
RUSTFLAGS: -Copt-level=3 -Cdebug-assertions -Coverflow-checks=y -Cdebuginfo=0 RUSTFLAGS: -Copt-level=3 -Cdebug-assertions -Coverflow-checks=y -Cdebuginfo=0
RUST_LOG: 1 RUST_LOG: 1
@ -72,10 +60,7 @@ jobs:
RUST_BACKTRACE: 1 RUST_BACKTRACE: 1
- name: Run cargo test - name: Run cargo test
uses: actions-rs/cargo@v1 run: cargo test --workspace
with:
command: test
args: --workspace
env: env:
RUSTFLAGS: -Copt-level=3 -Cdebug-assertions -Coverflow-checks=y -Cdebuginfo=0 RUSTFLAGS: -Copt-level=3 -Cdebug-assertions -Coverflow-checks=y -Cdebuginfo=0
RUST_LOG: 1 RUST_LOG: 1
@ -85,37 +70,24 @@ jobs:
wasm32: wasm32:
name: wasm32 compatibility name: wasm32 compatibility
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 30
if: "! contains(toJSON(github.event.commits.*.message), '[skip-ci]')" if: "! contains(toJSON(github.event.commits.*.message), '[skip-ci]')"
steps: steps:
- name: Checkout sources - name: Checkout sources
uses: actions/checkout@v2 uses: actions/checkout@v4
- name: Install nightly wasm32 toolchain - name: Install nightly toolchain
id: rustc-toolchain uses: dtolnay/rust-toolchain@nightly
uses: actions-rs/toolchain@v1
with: with:
profile: minimal targets: wasm32-unknown-unknown
toolchain: nightly
target: wasm32-unknown-unknown
default: true
override: true
- name: rust-cache - name: Set up rust cache
uses: actions/cache@v3 uses: Swatinem/rust-cache@v2
with: with:
path: | cache-on-failure: true
~/.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') }}
- name: Check in plonky2 subdirectory - name: Check in plonky2 subdirectory
uses: actions-rs/cargo@v1 run: cargo check --manifest-path plonky2/Cargo.toml --target wasm32-unknown-unknown --no-default-features
with:
command: check
args: --manifest-path plonky2/Cargo.toml --target wasm32-unknown-unknown --no-default-features
env: env:
RUSTFLAGS: -Copt-level=3 -Cdebug-assertions -Coverflow-checks=y -Cdebuginfo=0 RUSTFLAGS: -Copt-level=3 -Cdebug-assertions -Coverflow-checks=y -Cdebuginfo=0
RUST_LOG: 1 RUST_LOG: 1
@ -123,10 +95,7 @@ jobs:
RUST_BACKTRACE: 1 RUST_BACKTRACE: 1
- name: Check in starky subdirectory - name: Check in starky subdirectory
uses: actions-rs/cargo@v1 run: cargo check --manifest-path starky/Cargo.toml --target wasm32-unknown-unknown --no-default-features
with:
command: check
args: --manifest-path starky/Cargo.toml --target wasm32-unknown-unknown --no-default-features
env: env:
RUSTFLAGS: -Copt-level=3 -Cdebug-assertions -Coverflow-checks=y -Cdebuginfo=0 RUSTFLAGS: -Copt-level=3 -Cdebug-assertions -Coverflow-checks=y -Cdebuginfo=0
RUST_LOG: 1 RUST_LOG: 1
@ -136,44 +105,24 @@ jobs:
lints: lints:
name: Formatting and Clippy name: Formatting and Clippy
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 10
if: "! contains(toJSON(github.event.commits.*.message), '[skip-ci]')" if: "! contains(toJSON(github.event.commits.*.message), '[skip-ci]')"
steps: steps:
- name: Checkout sources - name: Checkout sources
uses: actions/checkout@v2 uses: actions/checkout@v4
- name: Install nightly toolchain - name: Install nightly toolchain
id: rustc-toolchain uses: dtolnay/rust-toolchain@nightly
uses: actions-rs/toolchain@v1
with: with:
profile: minimal
toolchain: nightly
override: true
components: rustfmt, clippy components: rustfmt, clippy
- name: rust-cache - name: Set up rust cache
uses: actions/cache@v3 uses: Swatinem/rust-cache@v2
with: with:
path: | cache-on-failure: true
~/.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') }}
- name: Run cargo fmt - name: Run cargo fmt
uses: actions-rs/cargo@v1 run: cargo fmt --all --check
with:
command: fmt
args: --all -- --check
env:
CARGO_INCREMENTAL: 1
- name: Run cargo clippy - name: Run cargo clippy
uses: actions-rs/cargo@v1 run: cargo clippy --all-features --all-targets -- -D warnings -A incomplete-features
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