From de8fe05ea05d7c228512b39e1555cb780764c27c Mon Sep 17 00:00:00 2001 From: Valentin271 <36198422+Valentin271@users.noreply.github.com> Date: Sun, 21 Jan 2024 18:25:44 +0100 Subject: [PATCH] chore: refactor CI runs (#216) --- .github/workflows/CI.yml | 48 ++++++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 14 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index ae9e0c81..4173ad70 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -4,10 +4,10 @@ on: [push, pull_request] env: CARGO_TERM_COLOR: always - RUSTFLAGS: "-C debuginfo=0" + RUSTFLAGS: '-C debuginfo=0' jobs: - build: + test: strategy: matrix: os: [windows-latest, macos-latest, ubuntu-latest] @@ -16,35 +16,55 @@ jobs: runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install toolchain run: | rustup update --no-self-update ${{ matrix.toolchain }} rustup default ${{ matrix.toolchain }} - rustup component add clippy rustfmt - name: Cache uses: Swatinem/rust-cache@v2 with: - prefix-key: "v0-rust-2" + prefix-key: 'v0-rust-2' + + - name: Run test suite + run: cargo test --workspace - # TODO: In the future clippy and rustfmt dont need to be run on all the - # `os`', but it should be fast enough to be fine still for now + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install toolchain + run: | + rustup update --no-self-update stable + rustup default stable + rustup component add clippy rustfmt + + - name: Check spelling + uses: crate-ci/typos@master - name: Formatting run: cargo fmt --check + + - name: Cache + uses: Swatinem/rust-cache@v2 + - name: Linting - run: cargo clippy -- --deny warnings - - name: Run test suite - run: cargo test --workspace + run: cargo clippy --workspace -- --deny warnings - check-macos-arm: - runs-on: macos-11 + build-macos-arm: + runs-on: macos-latest + strategy: + matrix: + toolchain: [stable, beta] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install target - run: rustup update && rustup target add aarch64-apple-darwin + run: | + rustup update --no-self-update ${{ matrix.toolchain }} + rustup default ${{ matrix.toolchain }} + rustup target add aarch64-apple-darwin - name: Cache uses: Swatinem/rust-cache@v2