Merge pull request #85 from tamirelazar/dev #74
This file contains hidden or 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: CI | |
| on: | |
| workflow_dispatch: | |
| # Push CI runs only on master (post-merge verification). Work on dev and | |
| # feature branches is covered by its pull request, so pushing to dev while a | |
| # PR is open no longer double-triggers the suite. | |
| push: | |
| branches: [master] | |
| paths-ignore: | |
| - '**.md' | |
| - 'LICENSE' | |
| - 'assets/**' | |
| # No paths-ignore here: required status checks must report on every PR to a | |
| # protected branch, including docs-only ones — otherwise a markdown PR can | |
| # never satisfy branch protection and gets stuck unmergeable. The test job's | |
| # own matrix gating keeps non-promotion PRs cheap (ubuntu-only). | |
| pull_request: | |
| branches: [master, dev] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| hygiene: | |
| name: Hygiene | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Check public tree contains no dev-meta paths | |
| shell: bash | |
| run: ./scripts/check_tree_clean.sh | |
| test: | |
| name: Test | |
| needs: hygiene | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| # Full cross-platform matrix only when promoting dev -> master; | |
| # everything else runs on Linux to keep billable minutes down | |
| # (macOS minutes bill at 10x, Windows at 2x). | |
| os: ${{ (github.event_name == 'pull_request' && github.base_ref == 'master') && fromJSON('["ubuntu-latest", "macos-latest", "windows-latest"]') || fromJSON('["ubuntu-latest"]') }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: rustfmt, clippy | |
| - name: Install Linux dependencies (GUI + audio) | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update -qq | |
| sudo apt-get install -y --no-install-recommends \ | |
| libxkbcommon-dev \ | |
| libwayland-dev \ | |
| libx11-dev libxcursor-dev libxrandr-dev libxi-dev \ | |
| libvulkan-dev mesa-vulkan-drivers \ | |
| libfontconfig1-dev libfreetype6-dev \ | |
| libegl1-mesa-dev \ | |
| libasound2-dev | |
| - name: Cache cargo registry | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cargo/registry | |
| key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Cache cargo index | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cargo/git | |
| key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Cache cargo build | |
| uses: actions/cache@v4 | |
| with: | |
| path: target | |
| key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Run cargo fmt check | |
| if: runner.os == 'Linux' | |
| run: cargo fmt --all -- --check | |
| # Compiling the full GUI stack (iced/wgpu) is expensive; lint it on | |
| # Linux only. Release builds still compile gui on every platform. | |
| - name: Run cargo clippy (all features) | |
| if: runner.os == 'Linux' | |
| run: cargo clippy --all-targets --all-features -- -D warnings | |
| - name: Run cargo clippy | |
| if: runner.os != 'Linux' | |
| run: cargo clippy --all-targets -- -D warnings | |
| - name: Run cargo test | |
| run: cargo test --verbose | |
| # Gated feature code (multi-species, audio, gui) is not compiled by the | |
| # default build; run lib tests with all features so refactors cannot | |
| # silently break it. Linux only: deps are installed above and the full | |
| # GUI stack is too expensive to build on the paid runners. | |
| - name: Run cargo test (all features, lib) | |
| if: runner.os == 'Linux' | |
| run: cargo test --all-features --lib | |
| licenses: | |
| name: License Check | |
| needs: hygiene | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Check dependency licenses | |
| uses: EmbarkStudios/cargo-deny-action@v2 | |
| with: | |
| command: check licenses |