Skip to content

Commit af8d48f

Browse files
committed
WIP: CI run clippy for all target triplets
1 parent 2399735 commit af8d48f

File tree

1 file changed

+25
-8
lines changed

1 file changed

+25
-8
lines changed

.github/workflows/ci.yml

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,24 @@ env:
2020
# - Cargo.toml
2121
# - README.md
2222
rust_minver: 1.63.0
23+
ci_targets: "['', 'x86_64-apple-ios', 'x86_64-unknown-freebsd', 'x86_64-unknown-illumos', 'aarch64-linux-android']"
2324

2425
defaults:
2526
run:
2627
shell: bash
2728

2829
jobs:
30+
matrix:
31+
strategy:
32+
fail-fast: false
33+
runs-on: ubuntu-latest
34+
outputs:
35+
ci_targets: ${{ steps.generate.outputs.ci_targets }}
36+
steps:
37+
- name: Generate matrix
38+
id: generate
39+
run: echo "ci_targets=${{ env.ci_targets }}" >> $GITHUB_OUTPUT
40+
2941
format:
3042
strategy:
3143
fail-fast: false
@@ -78,17 +90,24 @@ jobs:
7890
done
7991
8092
clippy:
93+
needs: [matrix]
8194
strategy:
8295
fail-fast: false
8396
matrix:
8497
os: ['ubuntu-latest', 'windows-latest', 'macos-latest']
98+
target: ${{ fromJSON(needs.matrix.outputs.ci_targets) }}
8599
runs-on: ${{ matrix.os }}
86100
steps:
87101
- name: Checkout repository
88102
uses: actions/checkout@v4
89103
- name: Install dependencies
90104
if: matrix.os == 'ubuntu-latest'
91105
run: sudo bash ./.github/workflows/install-deps.sh
106+
- name: Install Rust target
107+
if: matrix.target != ''
108+
run: |
109+
rustup target add ${{ matrix.target }}
110+
echo 'CARGO_BUILD_TARGET=${{ matrix.target }}' >> $GITHUB_ENV
92111
- name: Install Rust nightly
93112
run: |
94113
rustup toolchain install nightly
@@ -115,11 +134,12 @@ jobs:
115134
fi
116135
117136
check:
137+
needs: [matrix]
118138
strategy:
119139
fail-fast: false
120140
matrix:
121141
os: ['ubuntu-latest', 'windows-latest', 'macos-latest']
122-
target: ['', 'x86_64-apple-ios', 'x86_64-unknown-freebsd', 'x86_64-unknown-illumos', 'aarch64-linux-android']
142+
target: ${{ fromJSON(needs.matrix.outputs.ci_targets) }}
123143
runs-on: ${{ matrix.os }}
124144
steps:
125145
- name: Checkout repository
@@ -131,16 +151,13 @@ jobs:
131151
run: sudo bash ./.github/workflows/install-deps.sh
132152
- name: Install Rust target
133153
if: matrix.target != ''
134-
run: rustup target add ${{ matrix.target }}
154+
run: |
155+
rustup target add ${{ matrix.target }}
156+
echo 'CARGO_BUILD_TARGET=${{ matrix.target }}' >> $GITHUB_ENV
135157
- name: Restore cargo caches
136158
uses: Swatinem/rust-cache@v2
137159
- name: Run check
138-
run: |
139-
if [[ -z "${{ matrix.target }}" ]]; then
140-
cargo check --all-features
141-
else
142-
cargo check --all-features --target ${{ matrix.target }}
143-
fi
160+
run: cargo check --all-features --verbose
144161

145162
check-doc:
146163
strategy:

0 commit comments

Comments
 (0)