2727 PYTHON_VERSION : " 3.14.3"
2828 X86_64_PC_WINDOWS_MSVC_OPENSSL_LIB_DIR : C:\Program Files\OpenSSL\lib\VC\x64\MD
2929 X86_64_PC_WINDOWS_MSVC_OPENSSL_INCLUDE_DIR : C:\Program Files\OpenSSL\include
30+ CARGO_INCREMENTAL : 0
31+ CARGO_TERM_COLOR : always
3032
3133jobs :
3234 rust_tests :
4547 with :
4648 persist-credentials : false
4749
48- - uses : dtolnay/rust-toolchain@efa25f7f19611383d5b0ccf2d1c8914531636bf9
50+ - uses : dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9
4951 with :
5052 components : clippy
5153 toolchain : stable
@@ -108,41 +110,39 @@ jobs:
108110
109111 cargo_check :
110112 if : ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }}
111- name : Ensure compilation on various targets
113+ name : cargo check
112114 runs-on : ${{ matrix.os }}
113115 strategy :
114116 matrix :
115117 include :
116118 - os : ubuntu-latest
117- targets :
118- - aarch64-linux-android
119- - i686-unknown-linux-gnu
120- - i686-unknown-linux-musl
121- - wasm32-wasip2
122- - x86_64-unknown-freebsd
119+ target : aarch64-linux-android
120+ - os : ubuntu-latest
121+ target : i686-unknown-linux-gnu
123122 dependencies :
124123 gcc-multilib : true
124+ - os : ubuntu-latest
125+ target : i686-unknown-linux-musl
126+ dependencies :
125127 musl-tools : true
126128 - os : ubuntu-latest
127- targets :
128- - aarch64-unknown-linux-gnu
129+ target : wasm32-wasip2
130+ - os : ubuntu-latest
131+ target : x86_64-unknown-freebsd
132+ - os : ubuntu-latest
133+ target : aarch64-unknown-linux-gnu
129134 dependencies :
130- gcc-aarch64-linux-gnu : true # conflict with `gcc-multilib`
135+ gcc-aarch64-linux-gnu : true
131136 - os : macos-latest
132- targets :
133- - aarch64-apple-ios
134- - x86_64-apple-darwin
137+ target : aarch64-apple-ios
138+ - os : macos-latest
139+ target : x86_64-apple-darwin
135140 fail-fast : false
136141 steps :
137142 - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
138143 with :
139144 persist-credentials : false
140145
141- - uses : Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
142- with :
143- prefix-key : v0-rust-${{ join(matrix.targets, '-') }}
144- save-if : ${{ github.ref == 'refs/heads/main' }}
145-
146146 - name : Install dependencies
147147 uses : ./.github/actions/install-linux-deps
148148 # zizmor has an issue with dynamic `with`
@@ -152,13 +152,25 @@ jobs:
152152 musl-tools : ${{ matrix.dependencies.musl-tools || false }}
153153 gcc-aarch64-linux-gnu : ${{ matrix.dependencies.gcc-aarch64-linux-gnu || false }}
154154
155- - uses : dtolnay/rust-toolchain@efa25f7f19611383d5b0ccf2d1c8914531636bf9
155+ - name : Restore cache
156+ uses : actions/cache/restore@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
157+ if : ${{ github.ref != 'refs/heads/main' }} # Never restore on main
156158 with :
157- targets : ${{ join(matrix.targets, ',') }}
158- toolchain : stable
159+ path : |
160+ ~/.cargo/bin/
161+ ~/.cargo/registry/index/
162+ ~/.cargo/registry/cache/
163+ ~/.cargo/git/db/
164+ target/
165+ # key won't match, will rely on restore-keys
166+ key : cargo-check-${{ runner.os }}-${{ matrix.target }}
167+ restore-keys : |
168+ cargo-check-${{ runner.os }}-${{ matrix.target }}-
169+
170+ - run : rustup toolchain install stable --target "${{ matrix.target }}"
159171
160172 - name : Setup Android NDK
161- if : ${{ contains( matrix.targets, 'aarch64-linux-android') }}
173+ if : ${{ matrix.target == 'aarch64-linux-android' }}
162174 id : setup-ndk
163175 uses : nttld/setup-ndk@v1
164176 with :
@@ -174,18 +186,24 @@ jobs:
174186 # args: --ignore-rust-version
175187
176188 - name : Check compilation
177- run : |
178- for target in ${{ join(matrix.targets, ' ') }}
179- do
180- echo "::group::${target}"
181- cargo check --target $target ${{ env.CARGO_ARGS_NO_SSL }}
182- echo "::endgroup::"
183- done
189+ run : cargo check --target "${{ matrix.target }}" ${{ env.CARGO_ARGS_NO_SSL }}
184190 env :
185191 CC_aarch64_linux_android : ${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang
186192 AR_aarch64_linux_android : ${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar
187193 CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER : ${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang
188194
195+ - name : Save cache
196+ if : ${{ github.ref == 'refs/heads/main' }} # only save on main
197+ uses : actions/cache/save@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
198+ with :
199+ path : |
200+ ~/.cargo/bin/
201+ ~/.cargo/registry/index/
202+ ~/.cargo/registry/cache/
203+ ~/.cargo/git/db/
204+ target/
205+ key : cargo-check-${{ runner.os }}-${{ matrix.target }}-${{ hashFiles('**/Cargo.toml') }}-${{ hashFiles('Cargo.lock') }}-${{ github.sha }}
206+
189207 snippets_cpython :
190208 if : ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }}
191209 env :
@@ -230,7 +248,7 @@ jobs:
230248 with :
231249 persist-credentials : false
232250
233- - uses : dtolnay/rust-toolchain@efa25f7f19611383d5b0ccf2d1c8914531636bf9
251+ - uses : dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9
234252 with :
235253 toolchain : stable
236254
@@ -345,7 +363,7 @@ jobs:
345363 with :
346364 python-version : ${{ env.PYTHON_VERSION }}
347365
348- - uses : dtolnay/rust-toolchain@efa25f7f19611383d5b0ccf2d1c8914531636bf9
366+ - uses : dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9
349367 with :
350368 toolchain : stable
351369 components : rustfmt
@@ -372,7 +390,7 @@ jobs:
372390
373391 - name : prek
374392 id : prek
375- uses : j178/prek-action@79f765515bd648eb4d6bb1b17277b7cb22cb6468 # v2.0.0
393+ uses : j178/prek-action@53276d8b0d10f8b6672aa85b4588c6921d0370cc # v2.0.1
376394 with :
377395 cache : false
378396 show-verbose-logs : false
@@ -404,7 +422,7 @@ jobs:
404422 with :
405423 persist-credentials : false
406424
407- - uses : dtolnay/rust-toolchain@efa25f7f19611383d5b0ccf2d1c8914531636bf9
425+ - uses : dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9
408426 with :
409427 toolchain : ${{ env.NIGHTLY_CHANNEL }}
410428 components : miri
@@ -430,7 +448,7 @@ jobs:
430448 with :
431449 persist-credentials : false
432450
433- - uses : dtolnay/rust-toolchain@efa25f7f19611383d5b0ccf2d1c8914531636bf9
451+ - uses : dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9
434452 with :
435453 components : clippy
436454 toolchain : stable
@@ -508,7 +526,7 @@ jobs:
508526 with :
509527 persist-credentials : false
510528
511- - uses : dtolnay/rust-toolchain@efa25f7f19611383d5b0ccf2d1c8914531636bf9
529+ - uses : dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9
512530 with :
513531 target : wasm32-wasip1
514532 toolchain : stable
0 commit comments