Feat/more sims #130
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
name: Rust test / linting | |
on: | |
push: | |
branches: [ "master", "development" ] | |
paths: | |
- 'crates/**' | |
- 'examples/**' | |
- 'Cargo.toml' | |
- '.github/workflows/rust-test.yml' | |
- '.pre-commit-config.yaml' | |
pull_request: | |
branches: [ "master", "development" ] | |
paths: | |
- 'crates/**' | |
- 'examples/**' | |
- 'Cargo.toml' | |
- '.github/workflows/rust-test.yml' | |
- '.pre-commit-config.yaml' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
RUSTFLAGS: -C debuginfo=0 | |
RUST_BACKTRACE: 1 | |
jobs: | |
rust-lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Rust | |
run: rustup override set stable && rustup update | |
- name: Cache Rust | |
uses: Swatinem/rust-cache@v2 | |
with: | |
save-if: ${{ github.ref_name == 'master' || github.ref_name == 'development' }} | |
- name: Install rustfmt | |
run: rustup component add rustfmt | |
- name: Check formatting | |
run: cargo fmt --all -- --check | |
- name: Install clippy | |
run: rustup component add clippy | |
- name: Run clippy | |
run: cargo clippy --workspace --all-targets -- -D warnings | |
pre-commit: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install pre-commit | |
run: pip install pre-commit | |
- name: Run pre-commit | |
run: pre-commit run --all-files --show-diff-on-failure | |
rust-test: | |
needs: [pre-commit, rust-lint] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Rust | |
run: rustup show | |
- name: Cache Rust | |
uses: Swatinem/rust-cache@v2 | |
with: | |
save-if: ${{ github.ref_name == 'master' || github.ref_name == 'development' }} | |
- name: Compile tests | |
run: cargo test --no-run | |
- name: Run tests | |
run: cargo test |