-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
64 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,79 @@ | ||
# Adapted from https://github.com/bevyengine/bevy_github_ci_template | ||
name: CI | ||
|
||
on: | ||
pull_request: | ||
branches: [master] | ||
push: | ||
branches: [master] | ||
pull_request: | ||
branches: [master] | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
|
||
build: | ||
strategy: | ||
matrix: | ||
toolchain: [stable, nightly] | ||
os: [windows-latest, ubuntu-latest] | ||
runs-on: ${{ matrix.os }} | ||
# Run cargo test | ||
test: | ||
name: Test Suite | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 30 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: dtolnay/rust-toolchain@master | ||
- name: Checkout sources | ||
uses: actions/checkout@v4 | ||
- name: Cache | ||
uses: actions/cache@v4 | ||
with: | ||
toolchain: ${{ matrix.toolchain }} | ||
components: rustfmt, clippy | ||
- name: fmt | ||
if: ${{ matrix.toolchain == 'nightly' && runner.os == 'linux' }} | ||
run: cargo fmt --all -- --check | ||
|
||
- name: Install alsa and udev | ||
path: | | ||
~/.cargo/bin/ | ||
~/.cargo/registry/index/ | ||
~/.cargo/registry/cache/ | ||
~/.cargo/git/db/ | ||
target/ | ||
key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.toml') }} | ||
- name: Install stable toolchain | ||
uses: dtolnay/rust-toolchain@stable | ||
- name: Install Dependencies | ||
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev | ||
if: runner.os == 'linux' | ||
|
||
- name: lint | ||
uses: actions-rs/clippy-check@v1 | ||
- name: Run cargo test | ||
run: cargo test | ||
|
||
# Run cargo clippy -- -D warnings | ||
clippy_check: | ||
name: Clippy | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 30 | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v4 | ||
- name: Cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
~/.cargo/bin/ | ||
~/.cargo/registry/index/ | ||
~/.cargo/registry/cache/ | ||
~/.cargo/git/db/ | ||
target/ | ||
key: ${{ runner.os }}-cargo-clippy-${{ hashFiles('**/Cargo.toml') }} | ||
- name: Install stable toolchain | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
args: --all-targets --all-features -- -D warnings -A unknown-lints | ||
components: clippy | ||
- name: Install Dependencies | ||
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev | ||
- name: Run clippy | ||
run: cargo clippy -- -D warnings | ||
|
||
- name: Build & run tests | ||
run: cargo test --workspace | ||
env: | ||
CARGO_INCREMENTAL: 0 | ||
RUSTFLAGS: "-C debuginfo=0 -D warnings" | ||
# Run cargo fmt --all -- --check | ||
format: | ||
name: Format | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 30 | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v4 | ||
- name: Install stable toolchain | ||
uses: dtolnay/rust-toolchain@nightly # Unstable formatter options used. | ||
with: | ||
components: rustfmt | ||
- name: Run cargo fmt | ||
run: cargo fmt --all -- --check |