From d473183fe9998a8cc8675f8f421fd2ab7044b784 Mon Sep 17 00:00:00 2001 From: Felix Prasanna Date: Fri, 12 Jan 2024 17:14:34 -0500 Subject: [PATCH 1/4] use rustup override set to select toolchain Using rustup override set will override a local rust-toolchain.toml file while rustup default will not. --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 45eda54..997b954 100644 --- a/action.yml +++ b/action.yml @@ -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 From c6086ae6e539b9cca10fba3642fe77e559ba5705 Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Sat, 13 Jan 2024 15:54:38 +0000 Subject: [PATCH 2/4] test: add toolchain file override test --- .github/workflows/ci.yml | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 521e3f6..5fc202d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,8 +12,15 @@ jobs: 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. @@ -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 <>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" @@ -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 && 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 From aa089182f268c0255577cdc57a82a9b0819d59c3 Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Sat, 13 Jan 2024 15:57:48 +0000 Subject: [PATCH 3/4] ci: fix conditional --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5fc202d..c9120aa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -63,7 +63,7 @@ jobs: run: echo '${{steps.toolchain.outputs.rustup-version}}' - name: Check lack of toolchain input or file results in stable - if: !matrix.write-toolchain-file && matrix.rust == null + if: matrix.write-toolchain-file == false && matrix.rust == null shell: bash run: |- rustcv="$(rustc --version)" From ba41ca6f71dca3d3a627600631fedb7f260d083e Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Sat, 13 Jan 2024 16:03:46 +0000 Subject: [PATCH 4/4] ci: clearer test names --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c9120aa..8f3020a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,7 +7,7 @@ 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