Skip to content

Commit 0af70d4

Browse files
ShaharNavehyouknowone
authored andcommitted
Use matrix for cargo check (RustPython#7388)
* Use matrix for cargo_check * Tweak `gcc-aarch64-linux-gnu` deps * Re-add redox comment
1 parent a6f3def commit 0af70d4

2 files changed

Lines changed: 49 additions & 72 deletions

File tree

.github/actions/install-linux-deps/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ runs:
4242
run: >
4343
sudo apt-get update
4444
45-
sudo apt-get install
45+
sudo apt-get install --no-install-recommends
4646
${{ fromJSON(inputs.gcc-multilib) && 'gcc-multilib' || '' }}
4747
${{ fromJSON(inputs.musl-tools) && 'musl-tools' || '' }}
4848
${{ fromJSON(inputs.clang) && 'clang' || '' }}
49-
${{ fromJSON(inputs.gcc-aarch64-linux-gnu) && 'gcc-aarch64-linux-gnu' || '' }}
49+
${{ fromJSON(inputs.gcc-aarch64-linux-gnu) && 'gcc-aarch64-linux-gnu linux-libc-dev-arm64-cross libc6-dev-arm64-cross' || '' }}

.github/workflows/ci.yaml

Lines changed: 47 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -188,94 +188,58 @@ jobs:
188188
PYTHONPATH: scripts
189189
if: runner.os == 'Linux'
190190

191-
- name: prepare Intel MacOS build
192-
uses: dtolnay/rust-toolchain@stable
193-
with:
194-
target: x86_64-apple-darwin
195-
if: runner.os == 'macOS'
196-
- name: Check compilation for Intel MacOS
197-
run: cargo check --target x86_64-apple-darwin
198-
if: runner.os == 'macOS'
199-
- name: prepare iOS build
200-
uses: dtolnay/rust-toolchain@stable
201-
with:
202-
target: aarch64-apple-ios
203-
if: runner.os == 'macOS'
204-
- name: Check compilation for iOS
205-
run: cargo check --target aarch64-apple-ios ${{ env.CARGO_ARGS_NO_SSL }}
206-
if: runner.os == 'macOS'
207-
208-
exotic_targets:
191+
cargo_check:
209192
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }}
210193
name: Ensure compilation on various targets
211-
runs-on: ubuntu-latest
212-
timeout-minutes: 30
194+
runs-on: ${{ matrix.os }}
195+
strategy:
196+
matrix:
197+
include:
198+
- os: ubuntu-latest
199+
targets:
200+
- aarch64-linux-android
201+
- i686-unknown-linux-gnu
202+
- i686-unknown-linux-musl
203+
- wasm32-wasip2
204+
- x86_64-unknown-freebsd
205+
dependencies:
206+
gcc-multilib: true
207+
musl-tools: true
208+
- os: ubuntu-latest
209+
targets:
210+
- aarch64-unknown-linux-gnu
211+
dependencies:
212+
gcc-aarch64-linux-gnu: true # conflict with `gcc-multilib`
213+
- os: macos-latest
214+
targets:
215+
- aarch64-apple-ios
216+
- x86_64-apple-darwin
217+
fail-fast: false
213218
steps:
214-
- uses: actions/checkout@v6
215-
- uses: dtolnay/rust-toolchain@stable
219+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
216220
with:
217-
target: i686-unknown-linux-gnu
221+
persist-credentials: false
218222

219-
- name: Install gcc-multilib and musl-tools
220-
uses: ./.github/actions/install-linux-deps
223+
- uses: Swatinem/rust-cache@v2
221224
with:
222-
gcc-multilib: true
223-
musl-tools: true
225+
prefix-key: v0-rust-${{ join(matrix.targets, '-') }}
224226

225-
- name: Check compilation for x86 32bit
226-
run: cargo check --target i686-unknown-linux-gnu ${{ env.CARGO_ARGS_NO_SSL }}
227+
- name: Install dependencies
228+
uses: ./.github/actions/install-linux-deps
229+
with: ${{ matrix.dependencies || fromJSON('{}') }}
227230

228231
- uses: dtolnay/rust-toolchain@stable
229232
with:
230-
target: aarch64-linux-android
233+
targets: ${{ join(matrix.targets, ',') }}
231234

232235
- name: Setup Android NDK
236+
if: ${{ contains(matrix.targets, 'aarch64-linux-android') }}
233237
id: setup-ndk
234238
uses: nttld/setup-ndk@v1
235239
with:
236240
ndk-version: r27
237241
add-to-path: true
238242

239-
- name: Check compilation for android
240-
run: cargo check --target aarch64-linux-android ${{ env.CARGO_ARGS_NO_SSL }}
241-
env:
242-
CC_aarch64_linux_android: ${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang
243-
AR_aarch64_linux_android: ${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar
244-
CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER: ${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang
245-
246-
- uses: dtolnay/rust-toolchain@stable
247-
with:
248-
target: aarch64-unknown-linux-gnu
249-
250-
- name: Install gcc-aarch64-linux-gnu
251-
uses: ./.github/actions/install-linux-deps
252-
with:
253-
gcc-aarch64-linux-gnu: true
254-
255-
- name: Check compilation for aarch64 linux gnu
256-
run: cargo check --target aarch64-unknown-linux-gnu ${{ env.CARGO_ARGS_NO_SSL }}
257-
258-
- uses: dtolnay/rust-toolchain@stable
259-
with:
260-
target: i686-unknown-linux-musl
261-
262-
- name: Check compilation for musl
263-
run: cargo check --target i686-unknown-linux-musl ${{ env.CARGO_ARGS_NO_SSL }}
264-
265-
- uses: dtolnay/rust-toolchain@stable
266-
with:
267-
target: x86_64-unknown-freebsd
268-
269-
- name: Check compilation for freebsd
270-
run: cargo check --target x86_64-unknown-freebsd ${{ env.CARGO_ARGS_NO_SSL }}
271-
272-
- uses: dtolnay/rust-toolchain@stable
273-
with:
274-
target: wasm32-wasip2
275-
276-
- name: Check compilation for wasip2
277-
run: cargo check --target wasm32-wasip2 ${{ env.CARGO_ARGS_NO_SSL }}
278-
279243
# - name: Prepare repository for redox compilation
280244
# run: bash scripts/redox/uncomment-cargo.sh
281245
# - name: Check compilation for Redox
@@ -284,6 +248,19 @@ jobs:
284248
# command: check
285249
# args: --ignore-rust-version
286250

251+
- name: Check compilation
252+
run: |
253+
for target in ${{ join(matrix.targets, ' ') }}
254+
do
255+
echo "::group::${target}"
256+
cargo check --target $target ${{ env.CARGO_ARGS_NO_SSL }}
257+
echo "::endgroup::"
258+
done
259+
env:
260+
CC_aarch64_linux_android: ${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang
261+
AR_aarch64_linux_android: ${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar
262+
CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER: ${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang
263+
287264
snippets_cpython:
288265
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }}
289266
env:

0 commit comments

Comments
 (0)