1010env :
1111 CARGO_TERM_COLOR : always
1212 CARGO_INCREMENTAL : 0
13- RUST_BACKTRACE : 1
13+ RUST_BACKTRACE : short
14+ CARGO_NET_RETRY : 10
15+ RUSTUP_MAX_RETRIES : 10
1416 REGISTRY : ghcr.io
1517 IMAGE_NAME : ${{ github.repository }}
1618
19+ # Cancel in-progress runs for the same branch
20+ concurrency :
21+ group : ${{ github.workflow }}-${{ github.ref }}
22+ cancel-in-progress : true
23+
1724jobs :
25+ # Build job - creates shared cache for other jobs
1826 build :
1927 name : Build
2028 runs-on : ubuntu-latest
@@ -23,23 +31,46 @@ jobs:
2331 run : |
2432 sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL
2533 sudo docker image prune --all --force
26- df -h
2734
28- - name : Checkout code
29- uses : actions/checkout@v4
35+ - uses : actions/checkout@v4
3036
31- - name : Setup Rust toolchain
32- uses : dtolnay/rust-toolchain@stable
37+ - uses : dtolnay/rust-toolchain@stable
3338
3439 - name : Cache cargo
3540 uses : Swatinem/rust-cache@v2
3641 with :
3742 cache-on-failure : true
38- shared-key : " platform-release "
43+ shared-key : " platform-ci "
3944
4045 - name : Build
4146 run : cargo build --release
4247
48+ # Clippy runs in parallel with build (shares cache)
49+ clippy :
50+ name : Clippy
51+ runs-on : ubuntu-latest
52+ steps :
53+ - name : Free disk space
54+ run : |
55+ sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL
56+ sudo docker image prune --all --force
57+
58+ - uses : actions/checkout@v4
59+
60+ - uses : dtolnay/rust-toolchain@stable
61+ with :
62+ components : clippy
63+
64+ - name : Cache cargo
65+ uses : Swatinem/rust-cache@v2
66+ with :
67+ cache-on-failure : true
68+ shared-key : " platform-ci"
69+
70+ - name : Run clippy
71+ run : cargo clippy --all-targets --workspace -- -W clippy::all
72+
73+ # Test job - runs faster with nextest
4374 test :
4475 name : Test
4576 runs-on : ubuntu-latest
@@ -51,25 +82,32 @@ jobs:
5182 sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL
5283 sudo docker image prune --all --force
5384
54- - name : Checkout code
55- uses : actions/checkout@v4
85+ - uses : actions/checkout@v4
5686
57- - name : Setup Rust toolchain
58- uses : dtolnay/rust-toolchain@stable
87+ - uses : dtolnay/rust-toolchain@stable
5988 with :
6089 components : llvm-tools-preview
6190
62- - name : Install cargo-llvm-cov
63- uses : taiki-e/install-action@cargo-llvm-cov
91+ - name : Install cargo-nextest and cargo-llvm-cov
92+ uses : taiki-e/install-action@v2
93+ with :
94+ tool : cargo-nextest,cargo-llvm-cov
6495
6596 - name : Cache cargo
6697 uses : Swatinem/rust-cache@v2
6798 with :
6899 cache-on-failure : true
69- shared-key : " platform-debug"
100+ shared-key : " platform-ci"
101+
102+ # Run tests with nextest (faster) - coverage only on main
103+ - name : Run tests
104+ if : github.ref != format('refs/heads/{0}', github.event.repository.default_branch)
105+ run : cargo nextest run --workspace -E 'not (test(/live/) | test(/integration/))'
70106
71107 - name : Run tests with coverage
72- run : cargo llvm-cov --workspace --json --output-path coverage.json
108+ if : github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
109+ run : |
110+ cargo llvm-cov nextest --workspace --json --output-path coverage.json -- -E 'not (test(/live/) | test(/integration/))'
73111
74112 - name : Generate coverage badge
75113 if : github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
@@ -92,32 +130,7 @@ jobs:
92130 destination_dir : badges
93131 keep_files : true
94132
95- clippy :
96- name : Clippy
97- runs-on : ubuntu-latest
98- steps :
99- - name : Free disk space
100- run : |
101- sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL
102- sudo docker image prune --all --force
103-
104- - name : Checkout code
105- uses : actions/checkout@v4
106-
107- - name : Setup Rust toolchain
108- uses : dtolnay/rust-toolchain@stable
109- with :
110- components : clippy
111-
112- - name : Cache cargo
113- uses : Swatinem/rust-cache@v2
114- with :
115- cache-on-failure : true
116- shared-key : " platform-debug"
117-
118- - name : Run clippy
119- run : cargo clippy --all-targets --workspace -- -W clippy::all
120-
133+ # Docker build - only after tests pass
121134 docker :
122135 name : Build & Push Docker
123136 runs-on : ubuntu-latest
@@ -131,11 +144,9 @@ jobs:
131144 sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL
132145 sudo docker image prune --all --force
133146
134- - name : Checkout code
135- uses : actions/checkout@v4
147+ - uses : actions/checkout@v4
136148
137- - name : Set up Docker Buildx
138- uses : docker/setup-buildx-action@v3
149+ - uses : docker/setup-buildx-action@v3
139150
140151 - name : Log in to Container Registry
141152 if : github.event_name != 'pull_request'
@@ -169,6 +180,7 @@ jobs:
169180 cache-from : type=gha
170181 cache-to : type=gha,mode=max
171182
183+ # Release - only on tags
172184 release :
173185 name : Release
174186 runs-on : ubuntu-latest
@@ -182,16 +194,14 @@ jobs:
182194 sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL
183195 sudo docker image prune --all --force
184196
185- - name : Checkout code
186- uses : actions/checkout@v4
197+ - uses : actions/checkout@v4
187198
188- - name : Setup Rust toolchain
189- uses : dtolnay/rust-toolchain@stable
199+ - uses : dtolnay/rust-toolchain@stable
190200
191201 - name : Cache cargo
192202 uses : Swatinem/rust-cache@v2
193203 with :
194- shared-key : " platform-release "
204+ shared-key : " platform-ci "
195205 save-if : false
196206
197207 - name : Build release binaries
0 commit comments