|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + pull_request: |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +env: |
| 9 | + CARGO_TERM_COLOR: always |
| 10 | + |
| 11 | +# Cancel superseded runs for the same ref so rapid pushes don't pile up. |
| 12 | +concurrency: |
| 13 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 14 | + cancel-in-progress: true |
| 15 | + |
| 16 | +jobs: |
| 17 | + test: |
| 18 | + name: Test |
| 19 | + runs-on: ubuntu-latest |
| 20 | + steps: |
| 21 | + - name: Checkout |
| 22 | + uses: actions/checkout@v4 |
| 23 | + |
| 24 | + - name: Install Rust toolchain |
| 25 | + uses: dtolnay/rust-toolchain@stable |
| 26 | + |
| 27 | + - name: Cache cargo registry and build |
| 28 | + uses: Swatinem/rust-cache@v2 |
| 29 | + |
| 30 | + # The client crate links macroquad/miniquad (windowing + GL) and ALSA |
| 31 | + # (audio), which need these system libraries to compile on Linux. |
| 32 | + - name: Install system dependencies |
| 33 | + run: | |
| 34 | + sudo apt-get update |
| 35 | + sudo apt-get install -y --no-install-recommends \ |
| 36 | + pkg-config libasound2-dev libx11-dev libxi-dev libgl1-mesa-dev |
| 37 | +
|
| 38 | + # Compiles every target (libs, bins, unit tests, benches, and the |
| 39 | + # headless example) so nothing is left unchecked, without running benches. |
| 40 | + - name: Build all targets |
| 41 | + run: cargo build --workspace --all-targets |
| 42 | + |
| 43 | + - name: Run tests |
| 44 | + run: cargo test --workspace |
| 45 | + |
| 46 | + bench: |
| 47 | + name: Benchmarks |
| 48 | + runs-on: ubuntu-latest |
| 49 | + steps: |
| 50 | + - name: Checkout |
| 51 | + uses: actions/checkout@v4 |
| 52 | + |
| 53 | + - name: Install Rust toolchain |
| 54 | + uses: dtolnay/rust-toolchain@stable |
| 55 | + |
| 56 | + - name: Cache cargo registry and build |
| 57 | + uses: Swatinem/rust-cache@v2 |
| 58 | + |
| 59 | + # The `shared` crate has no graphical dependencies, so no system packages |
| 60 | + # are required for the benchmark suite. |
| 61 | + - name: Run benchmarks |
| 62 | + run: cargo bench -p shared |
0 commit comments