Skip to content

Commit b6d2785

Browse files
committed
Extract Windows ARM64 rustup setup to a composite action
Because it was duplicated, such that it would be easy to wrongly change one but not the other occurrence.
1 parent 92c9d48 commit b6d2785

File tree

2 files changed

+23
-22
lines changed

2 files changed

+23
-22
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: setup-windows-arm-rustup
2+
3+
description: Set up Rustup for AMD64 Windows
4+
5+
runs:
6+
using: composite
7+
8+
steps:
9+
- name: Install Rustup
10+
run: |
11+
if (Get-Command rustup -ErrorAction SilentlyContinue) {
12+
Write-Output '::warning:: The runner has rustup. Consider removing this step.'
13+
} else {
14+
$file = 'rustup-init.exe'
15+
$url = "https://static.rust-lang.org/rustup/dist/aarch64-pc-windows-msvc/$file"
16+
curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL --output $file $url
17+
& ".\$file" --default-toolchain none -y
18+
Remove-Item $file
19+
Add-Content -Value "$Env:USERPROFILE\.cargo\bin" -Path $Env:GITHUB_PATH
20+
}
21+
shell: pwsh

.github/workflows/ci.yml

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -223,17 +223,7 @@ jobs:
223223
- uses: actions/checkout@v4
224224
- name: Install rustup
225225
if: matrix.os == 'windows-11-arm'
226-
run: |
227-
if (Get-Command rustup -ErrorAction SilentlyContinue) {
228-
Write-Output '::warning:: The runner has rustup. Consider removing this step.'
229-
} else {
230-
$file = 'rustup-init.exe'
231-
$url = "https://static.rust-lang.org/rustup/dist/aarch64-pc-windows-msvc/$file"
232-
curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL --output $file $url
233-
& ".\$file" --default-toolchain none -y
234-
Remove-Item $file
235-
Add-Content -Value "$Env:USERPROFILE\.cargo\bin" -Path $Env:GITHUB_PATH
236-
}
226+
uses: ./.github/actions/setup-windows-arm-rustup
237227
- uses: dtolnay/rust-toolchain@stable
238228
- uses: Swatinem/rust-cache@v2
239229
- name: cargo check default features
@@ -300,17 +290,7 @@ jobs:
300290
- uses: actions/checkout@v4
301291
- name: Install rustup
302292
if: matrix.os == 'windows-11-arm'
303-
run: |
304-
if (Get-Command rustup -ErrorAction SilentlyContinue) {
305-
Write-Output '::warning:: The runner has rustup. Consider removing this step.'
306-
} else {
307-
$file = 'rustup-init.exe'
308-
$url = "https://static.rust-lang.org/rustup/dist/aarch64-pc-windows-msvc/$file"
309-
curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL --output $file $url
310-
& ".\$file" --default-toolchain none -y
311-
Remove-Item $file
312-
Add-Content -Value "$Env:USERPROFILE\.cargo\bin" -Path $Env:GITHUB_PATH
313-
}
293+
uses: ./.github/actions/setup-windows-arm-rustup
314294
- uses: dtolnay/rust-toolchain@stable
315295
- uses: Swatinem/rust-cache@v2
316296
- uses: taiki-e/install-action@v2

0 commit comments

Comments
 (0)