Skip to content

Commit 645122c

Browse files
committed
Install missing rustup in windows-11-arm jobs
This works around the combination of these two conditions, which individually wouldn't be a problem but are a problem together: - The newly available `windows-11-arm` runner does not currently have `rustup` installed on it. - Although the `dtolnay/rust-toolchain` action will attempt to install `rustup` when it is absent on Unix-like systems, it does not attempt to do so on Windows. (If the latter condition is fixed, however, then depending on *how* it is fixed, it might still be necessary to install `rustup` ourselves. Specifically, it is easy to accidentally download a `rustup-init.exe` for x86-64 even when on ARM64/AArch64 Windows.) The new step here, added for both of the `windows-11-arm` jobs, is intended to be similar in its effect to these commands that `dtolnay/rustup-init` runs on Unix-like systems: https://github.com/actions-rust-lang/setup-rust-toolchain/blob/9399c7bb15d4c7d47b27263d024f0a4978346ba4/action.yml#L136-L139 Note that this is not quite equivalent. It is intentionally less versatile in two ways: - It hard-codes the AArch64 `rustup-init.exe` URL, to ensure that it is selected, rather than not finding anything or wrongly getting a URL for a Unix-like system or for x86-64 Windows. - No attempt is made to respect a preexisting `CARGO_HOME` environment variable (since we do not set one in these jobs). (This uses the style `$Env:varname` rather than `$env:varname` in PowerShell because the former seems to be much more common in the Microsoft documentation, and changes one preexisting occurrence of `$env` to `$Env` for stylistic consistency.)
1 parent e45ec79 commit 645122c

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

.github/workflows/ci.yml

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,19 @@ jobs:
170170

171171
steps:
172172
- uses: actions/checkout@v4
173+
- name: Install rustup
174+
if: matrix.os == 'windows-11-arm'
175+
run: |
176+
if (Get-Command rustup -ErrorAction SilentlyContinue) {
177+
Write-Output '::warning:: The runner has rustup. Consider removing this step.'
178+
} else {
179+
curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL `
180+
--output rustup-init.exe `
181+
https://static.rust-lang.org/rustup/dist/aarch64-pc-windows-msvc/rustup-init.exe
182+
.\rustup-init.exe --default-toolchain none -y
183+
Remove-Item rustup-init.exe
184+
Add-Content -Value "PATH=$Env:USERPROFILE\.cargo\bin;$Env:PATH" -Path $Env:GITHUB_ENV
185+
}
173186
- uses: dtolnay/rust-toolchain@stable
174187
- uses: Swatinem/rust-cache@v2
175188
- name: cargo check default features
@@ -194,6 +207,19 @@ jobs:
194207

195208
steps:
196209
- uses: actions/checkout@v4
210+
- name: Install rustup
211+
if: matrix.os == 'windows-11-arm'
212+
run: |
213+
if (Get-Command rustup -ErrorAction SilentlyContinue) {
214+
Write-Output '::warning:: The runner has rustup. Consider removing this step.'
215+
} else {
216+
curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL `
217+
--output rustup-init.exe `
218+
https://static.rust-lang.org/rustup/dist/aarch64-pc-windows-msvc/rustup-init.exe
219+
.\rustup-init.exe --default-toolchain none -y
220+
Remove-Item rustup-init.exe
221+
Add-Content -Value "PATH=$Env:USERPROFILE\.cargo\bin;$Env:PATH" -Path $Env:GITHUB_ENV
222+
}
197223
- uses: dtolnay/rust-toolchain@stable
198224
- uses: Swatinem/rust-cache@v2
199225
- uses: taiki-e/install-action@v2
@@ -296,7 +322,7 @@ jobs:
296322
with:
297323
tool: nextest
298324
- name: Test data structure sizes (nextest)
299-
run: cargo nextest run --target $env:TARGET --workspace --no-fail-fast size
325+
run: cargo nextest run --target $Env:TARGET --workspace --no-fail-fast size
300326
- name: Doctest
301327
run: cargo test --workspace --doc --no-fail-fast
302328

0 commit comments

Comments
 (0)