From 9c6749c1dab5aa9645a3d038fd322de0c4ca82c0 Mon Sep 17 00:00:00 2001 From: QuartzLibrary <81446760+QuartzLibrary@users.noreply.github.com> Date: Tue, 31 Mar 2026 20:27:28 +0100 Subject: [PATCH] Update CI workflow --- .github/workflows/ci.yml | 124 ++++++++++++++++++++++++--------------- rust-toolchain.toml | 15 +++++ 2 files changed, 91 insertions(+), 48 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5e4f2a7..d7ca95f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,67 +1,95 @@ name: Automated Testing -on: push +on: + push: + branches: ["*"] env: CARGO_TERM_COLOR: always jobs: - check: - name: Check + clippy: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - - uses: actions-rs/cargo@v1 - with: - command: check + - name: Checkout + uses: actions/checkout@v4 - test: - name: Test Suite - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 + - name: Set up cache + uses: actions/cache@v3 with: - profile: minimal - toolchain: stable - override: true - - uses: actions-rs/cargo@v1 - with: - command: test + path: | + ~/.cargo/.crates.toml + ~/.cargo/.crates2.json + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + ~/.rustup/toolchains/ + target/ + key: ${{ runner.os }}-cargo-clippy-${{ hashFiles('**/Cargo.lock') }} + + - name: Install WASM toolchain + run: rustup target add wasm32-unknown-unknown + + - name: Check project + run: cargo clippy --workspace --all-targets --all-features -- -D warnings - format: - name: Format + - name: Check project (WASM) + # Note lack of --all-targets here because tests and examples are not wasm compatible + run: cargo clippy --workspace --all-features --target wasm32-unknown-unknown -- -D warnings + + clippy-stable: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - components: rustfmt - - uses: actions-rs/cargo@v1 + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up cache + uses: actions/cache@v3 with: - command: fmt - args: --all -- --check + path: | + ~/.cargo/.crates.toml + ~/.cargo/.crates2.json + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + ~/.rustup/toolchains/ + target/ + key: ${{ runner.os }}-cargo-check-stable-${{ hashFiles('**/Cargo.lock') }} - clippy: - name: Clippy + - name: Install stable toolchain + run: rustup toolchain install stable + + - name: Install WASM toolchain + run: rustup target add wasm32-unknown-unknown --toolchain stable + + - name: Check on stable + run: cargo +stable clippy --all-targets -- -D warnings + + - name: Check project (WASM) on stable + # Note lack of --all-targets here because tests and examples are not wasm compatible + run: cargo +stable clippy --target wasm32-unknown-unknown -- -D warnings + + test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - components: clippy - - uses: actions-rs/cargo@v1 + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up cache + uses: actions/cache@v3 with: - command: clippy - args: -- -D warnings + path: | + ~/.cargo/.crates.toml + ~/.cargo/.crates2.json + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + ~/.rustup/toolchains/ + target/ + key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }} + + - name: Test project + run: RUST_BACKTRACE=1 cargo test --workspace --all-targets --all-features diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 73328e0..43b8abb 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,17 @@ [toolchain] channel = "1.90" +targets = ["wasm32-unknown-unknown"] +components = [ + "rustc", + "cargo", + "rustfmt", + "rust-std", + "rust-docs", + "rust-analyzer", + "clippy", + # "miri", + "rust-src", + # "rust-mingw", + # "llvm-tools", + # "rustc-dev", +] \ No newline at end of file