Skip to content

Commit c6086ae

Browse files
committed
test: add toolchain file override test
1 parent d473183 commit c6086ae

File tree

1 file changed

+24
-7
lines changed

1 file changed

+24
-7
lines changed

.github/workflows/ci.yml

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,15 @@ jobs:
1212
strategy:
1313
fail-fast: false
1414
matrix:
15+
os:
16+
- ubuntu-latest
17+
- windows-latest
18+
- macos-latest
19+
write-toolchain-file:
20+
- false
21+
- true
1522
rust:
16-
# Test with toolchain file override
23+
# use stable toolchain as default
1724
- null
1825

1926
# Test that the sparse registry check works.
@@ -23,21 +30,17 @@ jobs:
2330
- "nightly"
2431
- "beta"
2532
- "stable"
26-
os:
27-
- ubuntu-latest
28-
- windows-latest
29-
- macos-latest
3033
steps:
3134
- uses: actions/checkout@v4
3235

3336
# Test toolchain file support
3437
- name: Write rust-toolchain.toml
35-
if: matrix.rust == null
38+
if: matrix.write-toolchain-file
3639
shell: bash
3740
run: |
3841
cat <<EOF >>rust-toolchain.toml
3942
[toolchain]
40-
channel = "nightly-2024-01-11"
43+
channel = "nightly-2024-01-10"
4144
components = [ "rustfmt", "rustc-dev" ]
4245
targets = [ "wasm32-unknown-unknown", "thumbv7m-none-eabi" ]
4346
profile = "minimal"
@@ -59,6 +62,20 @@ jobs:
5962
- name: Check ${{'${{steps.toolchain.outputs.rustup-version}}'}}
6063
run: echo '${{steps.toolchain.outputs.rustup-version}}'
6164

65+
- name: Check lack of toolchain input or file results in stable
66+
if: !matrix.write-toolchain-file && matrix.rust == null
67+
shell: bash
68+
run: |-
69+
rustcv="$(rustc --version)"
70+
[[ "$rustcv" != *"nightly"* && "$rustcv" != *"beta"* ]]
71+
72+
- name: Check toolchain file is being overridden
73+
if: matrix.write-toolchain-file
74+
shell: bash
75+
run: |-
76+
rustcv="$(rustc --version)"
77+
[[ ! ( "$rustcv" == *"nightly"* && "$rustcv" == *"2024-01-10"* ) ]]
78+
6279
- shell: bash
6380
run: rustc --version && cargo --version
6481

0 commit comments

Comments
 (0)