Skip to content

Commit fe28c8c

Browse files
committed
ci(windows/gnu): install mingw via msys2/setup-msys2
1 parent 3582adc commit fe28c8c

File tree

2 files changed

+32
-42
lines changed

2 files changed

+32
-42
lines changed

.github/workflows/ci.yaml

+24-31
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ 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
4140
mingwdir: mingw64
4241
steps:
4342
- uses: actions/checkout@v4
@@ -57,17 +56,16 @@ jobs:
5756
New-Item "${env:USERPROFILE}\.cargo\git" -ItemType Directory -Force
5857
shell: powershell
5958
- name: Install mingw
59+
uses: msys2/setup-msys2@v2
60+
if: matrix.mingwdir != ''
61+
with:
62+
msystem: ${{ matrix.mingwdir }}
63+
- name: Add mingw tools to path
64+
shell: powershell
65+
if: matrix.mingwdir != ''
6066
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
6767
echo "C:\msys64\usr\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
6868
echo "C:\msys64\${{ matrix.mingwdir }}\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
69-
shell: powershell
70-
if: matrix.mingw != ''
7169
- name: Set PATH
7270
run: |
7371
echo "%USERPROFILE%\.cargo\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
@@ -123,7 +121,7 @@ jobs:
123121
cargo check --all --all-targets --features test
124122
git ls-files -- '*.rs' | xargs touch
125123
- name: Run cargo clippy
126-
if: matrix.mode != 'release' && matrix.mingw == ''
124+
if: matrix.mode != 'release' && matrix.mingwdir == ''
127125
env:
128126
TARGET: ${{ matrix.target }}
129127
run: |
@@ -179,7 +177,6 @@ jobs:
179177
- target: x86_64-pc-windows-msvc
180178
run_tests: YES
181179
- 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
183180
mingwdir: mingw64
184181
steps:
185182
- uses: actions/checkout@v4
@@ -199,17 +196,16 @@ jobs:
199196
New-Item "${env:USERPROFILE}\.cargo\git" -ItemType Directory -Force
200197
shell: powershell
201198
- name: Install mingw
199+
uses: msys2/setup-msys2@v2
200+
if: matrix.mingwdir != ''
201+
with:
202+
msystem: ${{ matrix.mingwdir }}
203+
- name: Add mingw tools to path
204+
shell: powershell
205+
if: matrix.mingwdir != ''
202206
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
209207
echo "C:\msys64\usr\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
210208
echo "C:\msys64\${{ matrix.mingwdir }}\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
211-
shell: powershell
212-
if: matrix.mingw != ''
213209
- name: Set PATH
214210
run: |
215211
echo "%USERPROFILE%\.cargo\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
@@ -265,7 +261,7 @@ jobs:
265261
cargo check --all --all-targets --features test
266262
git ls-files -- '*.rs' | xargs touch
267263
- name: Run cargo clippy
268-
if: matrix.mode != 'release' && matrix.mingw == ''
264+
if: matrix.mode != 'release' && matrix.mingwdir == ''
269265
env:
270266
TARGET: ${{ matrix.target }}
271267
run: |
@@ -323,11 +319,9 @@ jobs:
323319
- target: x86_64-pc-windows-msvc
324320
run_tests: YES
325321
- 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
327322
mingwdir: mingw64
328323
- target: i686-pc-windows-gnu # skip-pr skip-master
329324
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
331325
steps:
332326
- uses: actions/checkout@v4
333327
# v2 defaults to a shallow checkout, but we need at least to the previous tag
@@ -346,17 +340,16 @@ jobs:
346340
New-Item "${env:USERPROFILE}\.cargo\git" -ItemType Directory -Force
347341
shell: powershell
348342
- name: Install mingw
343+
uses: msys2/setup-msys2@v2
344+
if: matrix.mingwdir != ''
345+
with:
346+
msystem: ${{ matrix.mingwdir }}
347+
- name: Add mingw tools to path
348+
shell: powershell
349+
if: matrix.mingwdir != ''
349350
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
356351
echo "C:\msys64\usr\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
357352
echo "C:\msys64\${{ matrix.mingwdir }}\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
358-
shell: powershell
359-
if: matrix.mingw != ''
360353
- name: Set PATH
361354
run: |
362355
echo "%USERPROFILE%\.cargo\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
@@ -412,7 +405,7 @@ jobs:
412405
cargo check --all --all-targets --features test
413406
git ls-files -- '*.rs' | xargs touch
414407
- name: Run cargo clippy
415-
if: matrix.mode != 'release' && matrix.mingw == ''
408+
if: matrix.mode != 'release' && matrix.mingwdir == ''
416409
env:
417410
TARGET: ${{ matrix.target }}
418411
run: |

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

+8-11
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,9 @@ 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
3130
mingwdir: mingw64
3231
- target: i686-pc-windows-gnu # skip-pr skip-master
3332
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
3533
steps:
3634
- uses: actions/checkout@v4
3735
# v2 defaults to a shallow checkout, but we need at least to the previous tag
@@ -50,17 +48,16 @@ jobs: # skip-master skip-pr skip-stable
5048
New-Item "${env:USERPROFILE}\.cargo\git" -ItemType Directory -Force
5149
shell: powershell
5250
- name: Install mingw
51+
uses: msys2/setup-msys2@v2
52+
if: matrix.mingwdir != ''
53+
with:
54+
msystem: ${{ matrix.mingwdir }}
55+
- name: Add mingw tools to path
56+
shell: powershell
57+
if: matrix.mingwdir != ''
5358
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
6059
echo "C:\msys64\usr\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
6160
echo "C:\msys64\${{ matrix.mingwdir }}\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
62-
shell: powershell
63-
if: matrix.mingw != ''
6461
- name: Set PATH
6562
run: |
6663
echo "%USERPROFILE%\.cargo\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
@@ -116,7 +113,7 @@ jobs: # skip-master skip-pr skip-stable
116113
cargo check --all --all-targets --features test
117114
git ls-files -- '*.rs' | xargs touch
118115
- name: Run cargo clippy
119-
if: matrix.mode != 'release' && matrix.mingw == ''
116+
if: matrix.mode != 'release' && matrix.mingwdir == ''
120117
env:
121118
TARGET: ${{ matrix.target }}
122119
run: |

0 commit comments

Comments
 (0)