Skip to content

Commit 09a9c45

Browse files
committed
ci(windows/gnu): install mingw via bwoodsend/setup-winlibs-action
1 parent c91abc7 commit 09a9c45

File tree

2 files changed

+52
-50
lines changed

2 files changed

+52
-50
lines changed

.github/workflows/ci.yaml

+38-37
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@ jobs:
3737
- target: x86_64-pc-windows-msvc
3838
run_tests: YES
3939
- target: x86_64-pc-windows-gnu
40-
mingw: https://ci-mirrors.rust-lang.org/rustc/x86_64-6.3.0-release-posix-seh-rt_v5-rev2.7z
40+
arch: x86_64
4141
mingwdir: mingw64
42+
gcc: x86_64-w64-mingw32-gcc
4243
steps:
4344
- uses: actions/checkout@v4
4445
# v2 defaults to a shallow checkout, but we need at least to the previous tag
@@ -57,17 +58,16 @@ jobs:
5758
New-Item "${env:USERPROFILE}\.cargo\git" -ItemType Directory -Force
5859
shell: powershell
5960
- name: Install mingw
60-
run: |
61-
# We retrieve mingw from the Rust CI buckets
62-
# Disable the download progress bar which can cause perf issues
63-
$ProgressPreference = "SilentlyContinue"
64-
Invoke-WebRequest ${{ matrix.mingw }} -OutFile mingw.7z
65-
7z x -y mingw.7z -oC:\msys64 | Out-Null
66-
del mingw.7z
67-
echo "C:\msys64\usr\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
68-
echo "C:\msys64\${{ matrix.mingwdir }}\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
61+
uses: bwoodsend/setup-winlibs-action@v1
62+
if: matrix.mingwdir != ''
63+
with:
64+
architecture: ${{ matrix.arch }}
65+
- name: Verify mingw gcc installation
6966
shell: powershell
70-
if: matrix.mingw != ''
67+
if: matrix.mingwdir != ''
68+
run: |
69+
Get-Command ${{ matrix.gcc }}
70+
${{ matrix.gcc }} --version
7171
- name: Set PATH
7272
run: |
7373
echo "%USERPROFILE%\.cargo\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
@@ -123,7 +123,7 @@ jobs:
123123
cargo check --all --all-targets --features test
124124
git ls-files -- '*.rs' | xargs touch
125125
- name: Run cargo clippy
126-
if: matrix.mode != 'release' && matrix.mingw == ''
126+
if: matrix.mode != 'release' && matrix.mingwdir == ''
127127
env:
128128
TARGET: ${{ matrix.target }}
129129
run: |
@@ -179,8 +179,9 @@ jobs:
179179
- target: x86_64-pc-windows-msvc
180180
run_tests: YES
181181
- target: x86_64-pc-windows-gnu
182-
mingw: https://ci-mirrors.rust-lang.org/rustc/x86_64-6.3.0-release-posix-seh-rt_v5-rev2.7z
182+
arch: x86_64
183183
mingwdir: mingw64
184+
gcc: x86_64-w64-mingw32-gcc
184185
steps:
185186
- uses: actions/checkout@v4
186187
# v2 defaults to a shallow checkout, but we need at least to the previous tag
@@ -199,17 +200,16 @@ jobs:
199200
New-Item "${env:USERPROFILE}\.cargo\git" -ItemType Directory -Force
200201
shell: powershell
201202
- name: Install mingw
202-
run: |
203-
# We retrieve mingw from the Rust CI buckets
204-
# Disable the download progress bar which can cause perf issues
205-
$ProgressPreference = "SilentlyContinue"
206-
Invoke-WebRequest ${{ matrix.mingw }} -OutFile mingw.7z
207-
7z x -y mingw.7z -oC:\msys64 | Out-Null
208-
del mingw.7z
209-
echo "C:\msys64\usr\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
210-
echo "C:\msys64\${{ matrix.mingwdir }}\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
203+
uses: bwoodsend/setup-winlibs-action@v1
204+
if: matrix.mingwdir != ''
205+
with:
206+
architecture: ${{ matrix.arch }}
207+
- name: Verify mingw gcc installation
211208
shell: powershell
212-
if: matrix.mingw != ''
209+
if: matrix.mingwdir != ''
210+
run: |
211+
Get-Command ${{ matrix.gcc }}
212+
${{ matrix.gcc }} --version
213213
- name: Set PATH
214214
run: |
215215
echo "%USERPROFILE%\.cargo\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
@@ -265,7 +265,7 @@ jobs:
265265
cargo check --all --all-targets --features test
266266
git ls-files -- '*.rs' | xargs touch
267267
- name: Run cargo clippy
268-
if: matrix.mode != 'release' && matrix.mingw == ''
268+
if: matrix.mode != 'release' && matrix.mingwdir == ''
269269
env:
270270
TARGET: ${{ matrix.target }}
271271
run: |
@@ -323,11 +323,13 @@ jobs:
323323
- target: x86_64-pc-windows-msvc
324324
run_tests: YES
325325
- target: x86_64-pc-windows-gnu
326-
mingw: https://ci-mirrors.rust-lang.org/rustc/x86_64-6.3.0-release-posix-seh-rt_v5-rev2.7z
326+
arch: x86_64
327327
mingwdir: mingw64
328+
gcc: x86_64-w64-mingw32-gcc
328329
- target: i686-pc-windows-gnu # skip-pr skip-master
330+
arch: i686 # skip-pr skip-master
329331
mingwdir: mingw32 # skip-pr skip-master
330-
mingw: https://ci-mirrors.rust-lang.org/rustc/i686-6.3.0-release-posix-dwarf-rt_v5-rev2.7z # skip-pr skip-master
332+
gcc: i686-w64-mingw32-gcc # skip-pr skip-master
331333
steps:
332334
- uses: actions/checkout@v4
333335
# v2 defaults to a shallow checkout, but we need at least to the previous tag
@@ -346,17 +348,16 @@ jobs:
346348
New-Item "${env:USERPROFILE}\.cargo\git" -ItemType Directory -Force
347349
shell: powershell
348350
- name: Install mingw
349-
run: |
350-
# We retrieve mingw from the Rust CI buckets
351-
# Disable the download progress bar which can cause perf issues
352-
$ProgressPreference = "SilentlyContinue"
353-
Invoke-WebRequest ${{ matrix.mingw }} -OutFile mingw.7z
354-
7z x -y mingw.7z -oC:\msys64 | Out-Null
355-
del mingw.7z
356-
echo "C:\msys64\usr\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
357-
echo "C:\msys64\${{ matrix.mingwdir }}\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
351+
uses: bwoodsend/setup-winlibs-action@v1
352+
if: matrix.mingwdir != ''
353+
with:
354+
architecture: ${{ matrix.arch }}
355+
- name: Verify mingw gcc installation
358356
shell: powershell
359-
if: matrix.mingw != ''
357+
if: matrix.mingwdir != ''
358+
run: |
359+
Get-Command ${{ matrix.gcc }}
360+
${{ matrix.gcc }} --version
360361
- name: Set PATH
361362
run: |
362363
echo "%USERPROFILE%\.cargo\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
@@ -412,7 +413,7 @@ jobs:
412413
cargo check --all --all-targets --features test
413414
git ls-files -- '*.rs' | xargs touch
414415
- name: Run cargo clippy
415-
if: matrix.mode != 'release' && matrix.mingw == ''
416+
if: matrix.mode != 'release' && matrix.mingwdir == ''
416417
env:
417418
TARGET: ${{ matrix.target }}
418419
run: |

ci/actions-templates/windows-builds-template.yaml

+14-13
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,13 @@ jobs: # skip-master skip-pr skip-stable
2727
- target: x86_64-pc-windows-msvc
2828
run_tests: YES
2929
- target: x86_64-pc-windows-gnu
30-
mingw: https://ci-mirrors.rust-lang.org/rustc/x86_64-6.3.0-release-posix-seh-rt_v5-rev2.7z
30+
arch: x86_64
3131
mingwdir: mingw64
32+
gcc: x86_64-w64-mingw32-gcc
3233
- target: i686-pc-windows-gnu # skip-pr skip-master
34+
arch: i686 # skip-pr skip-master
3335
mingwdir: mingw32 # skip-pr skip-master
34-
mingw: https://ci-mirrors.rust-lang.org/rustc/i686-6.3.0-release-posix-dwarf-rt_v5-rev2.7z # skip-pr skip-master
36+
gcc: i686-w64-mingw32-gcc # skip-pr skip-master
3537
steps:
3638
- uses: actions/checkout@v4
3739
# v2 defaults to a shallow checkout, but we need at least to the previous tag
@@ -50,17 +52,16 @@ jobs: # skip-master skip-pr skip-stable
5052
New-Item "${env:USERPROFILE}\.cargo\git" -ItemType Directory -Force
5153
shell: powershell
5254
- name: Install mingw
53-
run: |
54-
# We retrieve mingw from the Rust CI buckets
55-
# Disable the download progress bar which can cause perf issues
56-
$ProgressPreference = "SilentlyContinue"
57-
Invoke-WebRequest ${{ matrix.mingw }} -OutFile mingw.7z
58-
7z x -y mingw.7z -oC:\msys64 | Out-Null
59-
del mingw.7z
60-
echo "C:\msys64\usr\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
61-
echo "C:\msys64\${{ matrix.mingwdir }}\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
55+
uses: bwoodsend/setup-winlibs-action@v1
56+
if: matrix.mingwdir != ''
57+
with:
58+
architecture: ${{ matrix.arch }}
59+
- name: Verify mingw gcc installation
6260
shell: powershell
63-
if: matrix.mingw != ''
61+
if: matrix.mingwdir != ''
62+
run: |
63+
Get-Command ${{ matrix.gcc }}
64+
${{ matrix.gcc }} --version
6465
- name: Set PATH
6566
run: |
6667
echo "%USERPROFILE%\.cargo\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
@@ -116,7 +117,7 @@ jobs: # skip-master skip-pr skip-stable
116117
cargo check --all --all-targets --features test
117118
git ls-files -- '*.rs' | xargs touch
118119
- name: Run cargo clippy
119-
if: matrix.mode != 'release' && matrix.mingw == ''
120+
if: matrix.mode != 'release' && matrix.mingwdir == ''
120121
env:
121122
TARGET: ${{ matrix.target }}
122123
run: |

0 commit comments

Comments
 (0)