Skip to content

Commit

Permalink
Merge pull request #33 from fprasx/fprasx/fix-toolchain-overrides
Browse files Browse the repository at this point in the history
  • Loading branch information
robjtede authored Jan 13, 2024
2 parents d5fcac4 + ba41ca6 commit bcda41b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
33 changes: 25 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,20 @@ on:

jobs:
install:
name: Rust ${{matrix.rust || '(toolchain file)'}} ${{matrix.os}}
name: Rust ${{matrix.rust || '(default)'}} (toolchain-file=${{matrix.write-toolchain-file}}) (${{matrix.os}})
runs-on: ${{matrix.os}}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest
write-toolchain-file:
- false
- true
rust:
# Test with toolchain file override
# use stable toolchain as default
- null

# Test that the sparse registry check works.
Expand All @@ -23,21 +30,17 @@ jobs:
- "nightly"
- "beta"
- "stable"
os:
- ubuntu-latest
- windows-latest
- macos-latest
steps:
- uses: actions/checkout@v4

# Test toolchain file support
- name: Write rust-toolchain.toml
if: matrix.rust == null
if: matrix.write-toolchain-file
shell: bash
run: |
cat <<EOF >>rust-toolchain.toml
[toolchain]
channel = "nightly-2024-01-11"
channel = "nightly-2024-01-10"
components = [ "rustfmt", "rustc-dev" ]
targets = [ "wasm32-unknown-unknown", "thumbv7m-none-eabi" ]
profile = "minimal"
Expand All @@ -59,6 +62,20 @@ jobs:
- name: Check ${{'${{steps.toolchain.outputs.rustup-version}}'}}
run: echo '${{steps.toolchain.outputs.rustup-version}}'

- name: Check lack of toolchain input or file results in stable
if: matrix.write-toolchain-file == false && matrix.rust == null
shell: bash
run: |-
rustcv="$(rustc --version)"
[[ "$rustcv" != *"nightly"* && "$rustcv" != *"beta"* ]]
- name: Check toolchain file is being overridden
if: matrix.write-toolchain-file
shell: bash
run: |-
rustcv="$(rustc --version)"
[[ ! ( "$rustcv" == *"nightly"* && "$rustcv" == *"2024-01-10"* ) ]]
- shell: bash
run: rustc --version && cargo --version

Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ runs:
toolchain=stable
fi
rustup toolchain install $toolchain${{steps.flags.outputs.targets}}${{steps.flags.outputs.components}} --profile minimal${{steps.flags.outputs.downgrade}} --no-self-update
rustup default $toolchain
rustup override set $toolchain
fi
- id: versions
Expand Down

0 comments on commit bcda41b

Please sign in to comment.