Skip to content

Commit e389b87

Browse files
committed
Fix CI by relaxing our MSRV constraint
Recently a transitive dev-dependency published a new version that is incompatible with Nix's MSRV, causing CI to break. That's annoying, because there's really no reason why a crate's dev-dependencies ought to respect the MSRV. Fix Nix's CI by: * Running all tests with stable Rust (or nightly, for certain targets) * Adding an additional set of CI checks to ensure that the crate will compile with MSRV, on all of the major operating systems, but don't try to compile its tests. * Eliminate the now-redundant "rust-stable" CI task.
1 parent e1e630f commit e389b87

File tree

3 files changed

+66
-43
lines changed

3 files changed

+66
-43
lines changed

.cirrus.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ task:
5050
setup_script:
5151
- kldload mqueuefs
5252
- fetch https://sh.rustup.rs -o rustup.sh
53-
- sh rustup.sh -y --profile=minimal --default-toolchain $MSRV
53+
- sh rustup.sh -y --profile=minimal --default-toolchain stable
5454
- . $HOME/.cargo/env
5555
- rustup target add i686-unknown-freebsd
5656
- rustup component add clippy

.github/actions/build/action.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,16 @@ inputs:
3030
required: false
3131
default:
3232

33+
NOCLIPPY:
34+
description: "whether to run cargo clippy"
35+
required: false
36+
default: false
37+
38+
NODOC:
39+
description: "whether to run cargo doc"
40+
required: false
41+
default: false
42+
3343
NOHACK:
3444
description: "whether to run cargo hack"
3545
required: false
@@ -55,10 +65,12 @@ runs:
5565
run: ${{ inputs.TOOL }} ${{ inputs.BUILD }} ${{ inputs.ZFLAGS }} --target ${{ inputs.TARGET }} --all-targets --all-features
5666

5767
- name: doc
68+
if: inputs.NODOC == 'false'
5869
shell: bash
5970
run: ${{ inputs.TOOL }} doc ${{ inputs.ZFLAGS }} --no-deps --target ${{ inputs.TARGET }} --all-features
6071

6172
- name: clippy
73+
if: inputs.NOCLIPPY == 'false'
6274
shell: bash
6375
run: ${{ inputs.TOOL}} clippy ${{ inputs.ZFLAGS }} --target ${{ inputs.TARGET }} --all-targets --all-features -- ${{ inputs.CLIPPYFLAGS }}
6476

.github/workflows/ci.yml

Lines changed: 53 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ permissions:
1414

1515
env:
1616
MSRV: 1.69.0
17-
# Rust's Loongarch support merged in 1.71.0
18-
MSRV_LOONGARCH: 1.71.0
19-
# Minimal Rust version to support all 3 official OpenHarmony targets as tier2
20-
MSRV_OHOS: 1.78.0
2117
RUSTFLAGS: -Dwarnings
2218

2319
jobs:
@@ -32,7 +28,7 @@ jobs:
3228
- name: setup Rust
3329
uses: dtolnay/rust-toolchain@master
3430
with:
35-
toolchain: '${{ env.MSRV }}'
31+
toolchain: stable
3632
components: clippy
3733

3834
- name: build
@@ -59,7 +55,7 @@ jobs:
5955
- name: setup Rust
6056
uses: dtolnay/rust-toolchain@master
6157
with:
62-
toolchain: '${{ env.MSRV }}'
58+
toolchain: stable
6359
components: clippy
6460

6561
- name: build
@@ -79,7 +75,7 @@ jobs:
7975
# cross needs to execute Docker, GitHub Action already has it installed
8076
cross:
8177
runs-on: ubuntu-24.04
82-
needs: [rustfmt, minver, macos, x86_64_linux_native_builds, rust_stable]
78+
needs: [rustfmt, minver, macos, x86_64_linux_native_builds]
8379
strategy:
8480
fail-fast: false
8581
matrix:
@@ -108,8 +104,7 @@ jobs:
108104
- name: setup Rust
109105
uses: dtolnay/rust-toolchain@master
110106
with:
111-
# Use a newer version rustc if the target is Loongarch, remove this workaround after MSRV is newer than 1.71.0
112-
toolchain: "${{ matrix.target == 'loongarch64-unknown-linux-gnu' && env.MSRV_LOONGARCH || env.MSRV }}"
107+
toolchain: stable
113108
components: clippy
114109

115110
# cross relies on docker or podman, GitHub Acton already has it installed.
@@ -156,7 +151,7 @@ jobs:
156151
- name: setup Rust
157152
uses: dtolnay/rust-toolchain@master
158153
with:
159-
toolchain: '${{ env.MSRV }}'
154+
toolchain: stable
160155
components: clippy
161156

162157
- name: install targets
@@ -193,7 +188,7 @@ jobs:
193188
- name: setup Rust
194189
uses: dtolnay/rust-toolchain@master
195190
with:
196-
toolchain: '${{ env.MSRV }}'
191+
toolchain: stable
197192
components: clippy
198193

199194
- name: install targets
@@ -212,38 +207,11 @@ jobs:
212207
- name: before_cache_script
213208
run: sudo rm -rf $CARGO_HOME/registry/index;
214209

215-
rust_stable:
216-
runs-on: ubuntu-latest
217-
env:
218-
TARGET: x86_64-unknown-linux-gnu
219-
steps:
220-
- name: checkout
221-
uses: actions/checkout@v4
222-
223-
- name: setup Rust
224-
uses: dtolnay/rust-toolchain@stable
225-
with:
226-
components: clippy
227-
228-
- name: build
229-
uses: ./.github/actions/build
230-
with:
231-
TARGET: '${{ env.TARGET }}'
232-
233-
- name: test
234-
uses: ./.github/actions/test
235-
with:
236-
TARGET: '${{ env.TARGET }}'
237-
238-
- name: before_cache_script
239-
run: sudo rm -rf $CARGO_HOME/registry/index
240-
241-
242210

243211
# Tasks for cross-compiling, but no testing
244212
cross_compiling:
245213
runs-on: ubuntu-latest
246-
needs: [rustfmt, minver, macos, x86_64_linux_native_builds, rust_stable]
214+
needs: [rustfmt, minver, macos, x86_64_linux_native_builds]
247215
env:
248216
BUILD: check
249217
strategy:
@@ -282,8 +250,7 @@ jobs:
282250
- name: setup Rust
283251
uses: dtolnay/rust-toolchain@master
284252
with:
285-
# Use a newer version rustc if it is OpenHarmony, remove this workaround after MSRV is newer than 1.78.0
286-
toolchain: "${{ contains(matrix.target, 'ohos') && env.MSRV_OHOS || env.MSRV }}"
253+
toolchain: stable
287254
components: clippy
288255

289256
- name: install targets
@@ -299,10 +266,54 @@ jobs:
299266
- name: before_cache_script
300267
run: rm -rf $CARGO_HOME/registry/index
301268

269+
# Check that Nix will build on the MSRV, on a variety of operating systems.
270+
# But don't check the tests. Those are not required to build on MSRV.
271+
msrv:
272+
runs-on: ubuntu-latest
273+
needs: [rustfmt, minver, macos, x86_64_linux_native_builds]
274+
env:
275+
BUILD: check
276+
NOCLIPPY: true
277+
NODOC: true
278+
NOHACK: true
279+
strategy:
280+
fail-fast: false
281+
matrix:
282+
include:
283+
- target: aarch64-linux-android
284+
- target: x86_64-unknown-linux-gnu
285+
- target: x86_64-unknown-linux-musl
286+
- target: aarch64-apple-darwin
287+
- target: x86_64-unknown-freebsd
288+
- target: x86_64-unknown-netbsd
289+
steps:
290+
- name: checkout
291+
uses: actions/checkout@v4
292+
293+
- name: setup Rust
294+
uses: dtolnay/rust-toolchain@master
295+
with:
296+
toolchain: $MSRV
297+
298+
- name: install targets
299+
run: rustup target add ${{ matrix.target }}
300+
301+
- name: build
302+
uses: ./.github/actions/build
303+
with:
304+
TARGET: '${{ matrix.target }}'
305+
BUILD: '${{ env.BUILD }}'
306+
NOCLIPPY: '${{ matrix.NOCLIPPY }}'
307+
NODOC: '${{ matrix.NODOC }}'
308+
NOHACK: '${{ matrix.NOHACK }}'
309+
310+
- name: before_cache_script
311+
run: rm -rf $CARGO_HOME/registry/index
312+
302313

303314
redox:
304315
runs-on: ubuntu-latest
305-
needs: [rustfmt, minver, macos, x86_64_linux_native_builds, rust_stable]
316+
needs: [rustfmt, minver, macos, x86_64_linux_native_builds]
306317
env:
307318
TARGET: x86_64-unknown-redox
308319
CLIPPYFLAGS: -D warnings

0 commit comments

Comments
 (0)