Skip to content

Commit cf1da0e

Browse files
committed
CI Reduce jobs by performing check and clippy by cross compile
1 parent 9efe6a8 commit cf1da0e

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

.github/workflows/ci.yml

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ 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']"
23+
ci_targets: "['x86_64-unknown-linux-gnu', 'x86_64-pc-windows-msvc', 'aarch64-apple-darwin', 'x86_64-apple-ios', 'x86_64-unknown-freebsd', 'x86_64-unknown-illumos', 'aarch64-linux-android']"
2424

2525
defaults:
2626
run:
@@ -94,24 +94,21 @@ jobs:
9494
strategy:
9595
fail-fast: false
9696
matrix:
97-
os: ['ubuntu-latest', 'windows-latest', 'macos-latest']
9897
target: ${{ fromJSON(needs.matrix.outputs.ci_targets) }}
99-
runs-on: ${{ matrix.os }}
98+
runs-on: ubuntu-latest
10099
steps:
101100
- name: Checkout repository
102101
uses: actions/checkout@v4
103102
- name: Disable bench dependencies
104-
if: matrix.target != ''
103+
if: matrix.target != fromJSON(needs.matrix.outputs.ci_targets)[0]
105104
run: ./.github/workflows/disable-bench-deps.sh
106105
- name: Install dependencies
107-
if: matrix.os == 'ubuntu-latest'
108106
run: sudo bash ./.github/workflows/install-deps.sh
109107
- name: Install Rust nightly
110108
run: |
111109
rustup toolchain install nightly
112110
rustup component add clippy --toolchain nightly
113111
- name: Install Rust target
114-
if: matrix.target != ''
115112
run: |
116113
rustup target add ${{ matrix.target }}
117114
rustup target add ${{ matrix.target }} --toolchain nightly
@@ -130,7 +127,7 @@ jobs:
130127
fi
131128
- name: Run clippy nightly for benches
132129
# Not all bench deps support all tier-2 targets
133-
if: matrix.target == ''
130+
if: matrix.target == fromJSON(needs.matrix.outputs.ci_targets)[0]
134131
run: |
135132
cargo +nightly clippy --all-features --benches -- -A clippy::incompatible_msrv
136133
@@ -144,19 +141,16 @@ jobs:
144141
strategy:
145142
fail-fast: false
146143
matrix:
147-
os: ['ubuntu-latest', 'windows-latest', 'macos-latest']
148144
target: ${{ fromJSON(needs.matrix.outputs.ci_targets) }}
149-
runs-on: ${{ matrix.os }}
145+
runs-on: ubuntu-latest
150146
steps:
151147
- name: Checkout repository
152148
uses: actions/checkout@v4
153149
- name: Disable bench dependencies
154150
run: ./.github/workflows/disable-bench-deps.sh
155151
- name: Install dependencies
156-
if: matrix.os == 'ubuntu-latest'
157152
run: sudo bash ./.github/workflows/install-deps.sh
158153
- name: Install Rust target
159-
if: matrix.target != ''
160154
run: |
161155
rustup target add ${{ matrix.target }}
162156
echo 'CARGO_BUILD_TARGET=${{ matrix.target }}' >> $GITHUB_ENV
@@ -190,23 +184,28 @@ jobs:
190184
cargo +nightly rustdoc --all-features --verbose -- -D warnings
191185
192186
check-msrv:
187+
needs: [matrix]
193188
strategy:
194189
fail-fast: false
195190
matrix:
196-
os: ['ubuntu-latest', 'windows-latest', 'macos-latest']
197-
runs-on: ${{ matrix.os }}
191+
target: ${{ fromJSON(needs.matrix.outputs.ci_targets) }}
192+
runs-on: ubuntu-latest
198193
steps:
199194
- name: Checkout repository
200195
uses: actions/checkout@v4
201196
- name: Disable bench dependencies
202197
run: ./.github/workflows/disable-bench-deps.sh
203-
- name: Install dependencies (Linux)
204-
if: matrix.os == 'ubuntu-latest'
198+
- name: Install dependencies
205199
run: sudo bash ./.github/workflows/install-deps.sh
206200
- name: Install Rust nightly
207201
run: rustup toolchain install nightly
208202
- name: Install Rust ${{ env.rust_minver }}
209203
run: rustup toolchain install ${{ env.rust_minver }}
204+
- name: Install Rust target
205+
run: |
206+
rustup target add ${{ matrix.target }} --toolchain nightly
207+
rustup target add ${{ matrix.target }} --toolchain ${{ env.rust_minver }}
208+
echo 'CARGO_BUILD_TARGET=${{ matrix.target }}' >> $GITHUB_ENV
210209
- name: Restore cargo caches
211210
uses: Swatinem/rust-cache@v2
212211
- name: Avoid dev-dependencies

0 commit comments

Comments
 (0)