| 1 | name: Rust build and tests |
| 2 | |
| 3 | on: |
| 4 | pull_request: |
| 5 | push: |
| 6 | branches: [main] |
| 7 | workflow_dispatch: |
| 8 | |
| 9 | permissions: |
| 10 | contents: read |
| 11 | |
| 12 | concurrency: |
| 13 | group: rust-${{ github.workflow }}-${{ github.ref }} |
| 14 | cancel-in-progress: true |
| 15 | |
| 16 | jobs: |
| 17 | rust: |
| 18 | name: Rust (${{ matrix.os }}) |
| 19 | runs-on: ${{ matrix.os }} |
| 20 | timeout-minutes: 45 |
| 21 | strategy: |
| 22 | fail-fast: false |
| 23 | matrix: |
| 24 | os: [ubuntu-latest, windows-latest] |
| 25 | env: |
| 26 | CARGO_TERM_COLOR: always |
| 27 | CARGO_BUILD_JOBS: 1 |
| 28 | CARGO_TARGET_DIR: ${{ github.workspace }}/tests/ci/target |
| 29 | RUST_BACKTRACE: 1 |
| 30 | steps: |
| 31 | - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 |
| 32 | env: |
| 33 | GIT_CONFIG_COUNT: 1 |
| 34 | GIT_CONFIG_KEY_0: core.autocrlf |
| 35 | GIT_CONFIG_VALUE_0: false |
| 36 | with: |
| 37 | persist-credentials: false |
| 38 | - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 |
| 39 | with: |
| 40 | python-version: '3.13' |
| 41 | - name: Install Rust |
| 42 | run: rustup toolchain install 1.99.1 --profile minimal --no-self-update |
| 43 | - name: Install Linux GUI build dependencies and test font |
| 44 | if: runner.os == 'Linux' |
| 45 | run: | |
| 46 | sudo apt-get update |
| 47 | sudo apt-get install -y pkg-config libxkbcommon-dev libwayland-dev libgl1-mesa-dev fonts-noto-cjk |
| 48 | - name: Check CI runner |
| 49 | run: python -m unittest discover -s tests/ci -p 'test_*.py' -v |
| 50 | - name: Build every Rust crate and test harness |
| 51 | timeout-minutes: 20 |
| 52 | run: python tests/ci/run_rust.py build |
| 53 | - name: Run Rust tests |
| 54 | if: ${{ !cancelled() }} |
| 55 | timeout-minutes: 20 |
| 56 | run: python tests/ci/run_rust.py test |