@@ -59,17 +59,21 @@ runs:
5959 shell : bash
6060
6161 - id : flags
62+ env :
63+ targets : ${{inputs.target}}
64+ components : ${{inputs.components}}
65+ shell : bash
6266 run : |
6367 : construct rustup command line
6468 echo "targets=$(for t in ${targets//,/ }; do echo -n ' --target' $t; done)" >> $GITHUB_OUTPUT
6569 echo "components=$(for c in ${components//,/ }; do echo -n ' --component' $c; done)" >> $GITHUB_OUTPUT
6670 echo "downgrade=${{inputs.toolchain == 'nightly' && inputs.components && ' --allow-downgrade' || ''}}" >> $GITHUB_OUTPUT
71+
72+ # The environment variables always need to be set before the caching action
73+ - name : Setting Environment Variables
6774 env :
68- targets : ${{inputs.target}}
69- components : ${{inputs.components}}
75+ NEW_RUSTFLAGS : ${{inputs.rustflags}}
7076 shell : bash
71- # The environment variables always need to be set before the caching action
72- - name : " Setting Environment Variables"
7377 run : |
7478 if [[ ! -v CARGO_INCREMENTAL ]]; then
7579 echo "CARGO_INCREMENTAL=0" >> $GITHUB_ENV
@@ -95,23 +99,27 @@ runs:
9599 if [[ ! -v CARGO_REGISTRIES_CRATES_IO_PROTOCOL ]]; then
96100 echo "CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse" >> $GITHUB_ENV
97101 fi
98- shell : bash
99- env :
100- NEW_RUSTFLAGS : ${{inputs.rustflags}}
101- - name : " Install Rust Problem Matcher"
102+
103+ - name : Install Rust Problem Matcher
102104 if : inputs.matcher == 'true'
103- run : echo "::add-matcher::${{ github.action_path }}/rust.json"
104105 shell : bash
106+ run : echo "::add-matcher::${{ github.action_path }}/rust.json"
105107
106108 - name : Install rustup, if needed
109+ if : runner.os != 'Windows'
110+ shell : bash
107111 run : |
108112 if ! command -v rustup &> /dev/null ; then
109113 curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL "https://sh.rustup.rs" | sh -s -- --default-toolchain none -y
110114 echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> $GITHUB_PATH
111115 fi
112- if : runner.os != 'Windows'
113- shell : bash
116+
114117 - name : rustup toolchain install ${{inputs.toolchain || 'stable'}}
118+ env :
119+ toolchain : ${{inputs.toolchain}}
120+ targets : ${{inputs.target}}
121+ components : ${{inputs.components}}
122+ shell : bash
115123 run : |
116124 if [[ -z "$toolchain" && ( -f "rust-toolchain" || -f "rust-toolchain.toml" ) ]]
117125 then
@@ -132,14 +140,10 @@ runs:
132140 rustup toolchain install $toolchain${{steps.flags.outputs.targets}}${{steps.flags.outputs.components}} --profile minimal${{steps.flags.outputs.downgrade}} --no-self-update
133141 rustup default $toolchain
134142 fi
135- env :
136- toolchain : ${{inputs.toolchain}}
137- targets : ${{inputs.target}}
138- components : ${{inputs.components}}
139- shell : bash
140143
141- - name : Print installed versions
142- id : versions
144+ - id : versions
145+ name : Print installed versions
146+ shell : bash
143147 run : |
144148 echo "rustc-version=$(rustc --version)" >> $GITHUB_OUTPUT
145149 rustc --version --verbose
@@ -151,9 +155,9 @@ runs:
151155 DATE=$(rustc --version --verbose | sed -ne 's/^commit-date: \(20[0-9][0-9]\)-\([01][0-9]\)-\([0-3][0-9]\)$/\1\2\3/p')
152156 HASH=$(rustc --version --verbose | sed -ne 's/^commit-hash: //p')
153157 echo "cachekey=$(echo $DATE$HASH | head -c12)" >> $GITHUB_OUTPUT
154- shell : bash
155158
156- - name : " Downgrade registry access protocol when needed"
159+ - name : Downgrade registry access protocol when needed
160+ shell : bash
157161 run : |
158162 # Not all versions support setting CARGO_REGISTRIES_CRATES_IO_PROTOCOL
159163 # On versions 1.66, 1.67, and 1.68.0-nightly the value "sparse" is still unstable.
@@ -163,8 +167,7 @@ runs:
163167 echo "Downgrade cargo registry protocol to git"
164168 echo "CARGO_REGISTRIES_CRATES_IO_PROTOCOL=git" >> $GITHUB_ENV
165169 fi
166- shell : bash
167170
168- - name : " Setup Rust Caching"
171+ - name : Setup Rust Caching
169172 if : inputs.cache == 'true'
170173 uses : Swatinem/rust-cache@v2
0 commit comments