From 18c33afdda3f4cf7a99f3b733af3df530f90c048 Mon Sep 17 00:00:00 2001 From: Dario Curreri Date: Tue, 30 Apr 2024 10:58:18 +0200 Subject: [PATCH 1/5] Add `CARGO_HOME` to `GITHUB_ENV` --- action.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/action.yml b/action.yml index 18a2336..c63c8f0 100644 --- a/action.yml +++ b/action.yml @@ -68,6 +68,14 @@ runs: if: runner.os != 'Windows' shell: bash + - run: echo CARGO_HOME=${CARGO_HOME:-$HOME/.cargo} >> $GITHUB_ENV + if: runner.os != 'Windows' + shell: bash + + - run: echo CARGO_HOME=${CARGO_HOME:-$USERPROFILE/.cargo} >> $GITHUB_ENV + if: runner.os == 'Windows' + shell: bash + - name: rustup toolchain install ${{steps.parse.outputs.toolchain}} run: rustup toolchain install ${{steps.parse.outputs.toolchain}}${{steps.flags.outputs.targets}}${{steps.flags.outputs.components}} --profile minimal${{steps.flags.outputs.downgrade}} --no-self-update shell: bash From e4e1c59547d4ffb8ffb683416085dde74fde2e2e Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Wed, 1 May 2024 09:06:11 -0700 Subject: [PATCH 2/5] Combine CARGO_HOME choice into a single step --- action.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/action.yml b/action.yml index c63c8f0..b2b70d1 100644 --- a/action.yml +++ b/action.yml @@ -68,12 +68,7 @@ runs: if: runner.os != 'Windows' shell: bash - - run: echo CARGO_HOME=${CARGO_HOME:-$HOME/.cargo} >> $GITHUB_ENV - if: runner.os != 'Windows' - shell: bash - - - run: echo CARGO_HOME=${CARGO_HOME:-$USERPROFILE/.cargo} >> $GITHUB_ENV - if: runner.os == 'Windows' + - run: echo CARGO_HOME=${CARGO_HOME:-${{runner.os == 'Windows' && '$USERPROFILE' || '$HOME'}}/.cargo} >> $GITHUB_ENV shell: bash - name: rustup toolchain install ${{steps.parse.outputs.toolchain}} From 22eb75fbe04ff33393ccbf79244bf521c2f0c6bb Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Wed, 1 May 2024 09:09:04 -0700 Subject: [PATCH 3/5] Add description for CARGO_HOME step --- action.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index b2b70d1..9fb35f3 100644 --- a/action.yml +++ b/action.yml @@ -68,7 +68,9 @@ runs: if: runner.os != 'Windows' shell: bash - - run: echo CARGO_HOME=${CARGO_HOME:-${{runner.os == 'Windows' && '$USERPROFILE' || '$HOME'}}/.cargo} >> $GITHUB_ENV + - run: | + : set $CARGO_HOME + echo CARGO_HOME=${CARGO_HOME:-${{runner.os == 'Windows' && '$USERPROFILE' || '$HOME'}}/.cargo} >> $GITHUB_ENV shell: bash - name: rustup toolchain install ${{steps.parse.outputs.toolchain}} From d8352f6b1d2e870bc5716e7a6d9b65c4cc244a1a Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Wed, 1 May 2024 09:11:35 -0700 Subject: [PATCH 4/5] Move CARGO_HOME step in front of rustup install --- action.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/action.yml b/action.yml index 9fb35f3..23c6000 100644 --- a/action.yml +++ b/action.yml @@ -60,17 +60,17 @@ runs: shell: bash - run: | - : install rustup if needed - if ! command -v rustup &>/dev/null; then - curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused --location --silent --show-error --fail "https://sh.rustup.rs" | sh -s -- --default-toolchain none -y - echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> $GITHUB_PATH - fi - if: runner.os != 'Windows' + : set $CARGO_HOME + echo CARGO_HOME=${CARGO_HOME:-${{runner.os == 'Windows' && '$USERPROFILE' || '$HOME'}}/.cargo} >> $GITHUB_ENV shell: bash - run: | - : set $CARGO_HOME - echo CARGO_HOME=${CARGO_HOME:-${{runner.os == 'Windows' && '$USERPROFILE' || '$HOME'}}/.cargo} >> $GITHUB_ENV + : install rustup if needed + if ! command -v rustup &>/dev/null; then + curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused --location --silent --show-error --fail "https://sh.rustup.rs" | sh -s -- --default-toolchain none -y + echo "$CARGO_HOME/bin" >> $GITHUB_PATH + fi + if: runner.os != 'Windows' shell: bash - name: rustup toolchain install ${{steps.parse.outputs.toolchain}} From d388a4836fcdbde0e50e395dc79a2670ccdef13f Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Wed, 1 May 2024 09:12:27 -0700 Subject: [PATCH 5/5] toolchain: stable --- action.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 23c6000..5e9f759 100644 --- a/action.yml +++ b/action.yml @@ -8,7 +8,8 @@ branding: inputs: toolchain: description: Rust toolchain specification -- see https://rust-lang.github.io/rustup/concepts/toolchains.html#toolchain-specification - required: true + required: false + default: stable targets: description: Comma-separated list of target triples to install for this toolchain required: false