Skip to content

Commit 1260a3f

Browse files
committed
CI run clippy for all target triplets
1 parent e0f3615 commit 1260a3f

File tree

1 file changed

+31
-8
lines changed

1 file changed

+31
-8
lines changed

.github/workflows/ci.yml

Lines changed: 31 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,21 +90,32 @@ 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
103+
- name: Disable bench dependencies
104+
if: matrix.target != ''
105+
run: ./.github/workflows/disable-bench-deps.sh
89106
- name: Install dependencies
90107
if: matrix.os == 'ubuntu-latest'
91108
run: sudo bash ./.github/workflows/install-deps.sh
92109
- name: Install Rust nightly
93110
run: |
94111
rustup toolchain install nightly
95112
rustup component add clippy --toolchain nightly
113+
- name: Install Rust target
114+
if: matrix.target != ''
115+
run: |
116+
rustup target add ${{ matrix.target }}
117+
rustup target add ${{ matrix.target }} --toolchain nightly
118+
echo 'CARGO_BUILD_TARGET=${{ matrix.target }}' >> $GITHUB_ENV
96119
- name: Restore cargo caches
97120
uses: Swatinem/rust-cache@v2
98121
- name: Run clippy
@@ -106,6 +129,8 @@ jobs:
106129
echo "::warning title=nightly clippy::Detected $WARNS warnings"
107130
fi
108131
- name: Run clippy nightly for benches
132+
# Not all bench deps support all tier-2 targets
133+
if: matrix.target == ''
109134
run: |
110135
cargo +nightly clippy --all-features --benches -- -A clippy::incompatible_msrv
111136
@@ -115,11 +140,12 @@ jobs:
115140
fi
116141
117142
check:
143+
needs: [matrix]
118144
strategy:
119145
fail-fast: false
120146
matrix:
121147
os: ['ubuntu-latest', 'windows-latest', 'macos-latest']
122-
target: ['', 'x86_64-apple-ios', 'x86_64-unknown-freebsd', 'x86_64-unknown-illumos', 'aarch64-linux-android']
148+
target: ${{ fromJSON(needs.matrix.outputs.ci_targets) }}
123149
runs-on: ${{ matrix.os }}
124150
steps:
125151
- name: Checkout repository
@@ -131,16 +157,13 @@ jobs:
131157
run: sudo bash ./.github/workflows/install-deps.sh
132158
- name: Install Rust target
133159
if: matrix.target != ''
134-
run: rustup target add ${{ matrix.target }}
160+
run: |
161+
rustup target add ${{ matrix.target }}
162+
echo 'CARGO_BUILD_TARGET=${{ matrix.target }}' >> $GITHUB_ENV
135163
- name: Restore cargo caches
136164
uses: Swatinem/rust-cache@v2
137165
- 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
166+
run: cargo check --all-features --verbose
144167

145168
check-doc:
146169
strategy:

0 commit comments

Comments
 (0)