Skip to content

Commit

Permalink
Update CI (#264)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nilirad authored Dec 9, 2024
1 parent a2d777a commit f16e09f
Showing 1 changed file with 64 additions and 30 deletions.
94 changes: 64 additions & 30 deletions .github/workflows/ci.yml
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

0 comments on commit f16e09f

Please sign in to comment.