From 5365ebecbbe26f996f9f7cbb82e2d59427028c3a Mon Sep 17 00:00:00 2001 From: QueenOfSquiggles <8940604+QueenOfSquiggles@users.noreply.github.com> Date: Sat, 10 Aug 2024 10:56:25 -0500 Subject: [PATCH] More robust CI Since CI usage is free for public repos, why not go all out for test validation! --- .github/workflows/rust.yml | 54 +++++++++++++++++++++++++++++--------- 1 file changed, 41 insertions(+), 13 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 9fd45e0..d9e40c3 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -1,22 +1,50 @@ -name: Rust +name: CI -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] +on: [push, pull_request, workflow_dispatch] env: CARGO_TERM_COLOR: always jobs: build: + strategy: + matrix: + os: [windows-latest, ubuntu-latest, macos-latest] + toolchain: [stable, nightly, "1.71.1"] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v2 - runs-on: ubuntu-latest + - uses: actions-rs/toolchain@v1 + id: toolchain + with: + toolchain: ${{ matrix.toolchain }} + profile: minimal + components: rustfmt, clippy + override: true - steps: - - uses: actions/checkout@v4 - - name: Build - run: cargo build --verbose - - name: Run tests - run: cargo test --verbose + - name: Install alsa and udev + run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev + if: runner.os == 'linux' + + - name: Setup cache + uses: actions/cache@v2 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-test-rustc-${{ steps.toolchain.outputs.rustc_hash }}-${{ hashFiles('**/Cargo.lock') }} + + - uses: actions-rs/cargo@v1 + if: runner.os == 'linux' + with: + command: fmt + args: --all -- --check + + - uses: actions-rs/cargo@v1 + with: + command: build + env: + CARGO_INCREMENTAL: 0 + RUSTFLAGS: "-C debuginfo=0"