-
Notifications
You must be signed in to change notification settings - Fork 0
127 lines (108 loc) · 3.9 KB
/
Copy pathci.yml
File metadata and controls
127 lines (108 loc) · 3.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
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