Skip to content

Commit a386535

Browse files
committed
fix: removed MinGW build
Signed-off-by: rafaeljohn9 <[email protected]>
1 parent 34b7526 commit a386535

File tree

3 files changed

+42
-12
lines changed

3 files changed

+42
-12
lines changed

.github/workflows/build.yml

Lines changed: 40 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,7 @@ jobs:
7878
NPM_PUBLISH: false,
7979
PYPI_PUBLISH: true
8080
}
81-
- {
82-
NAME: win32-x64-mingw,
83-
OS: windows-latest,
84-
TOOLCHAIN: stable,
85-
TARGET: x86_64-pc-windows-gnu,
86-
NPM_PUBLISH: false,
87-
PYPI_PUBLISH: false
88-
}
81+
8982
- {
9083
NAME: win32-x64-msvc,
9184
OS: windows-latest,
@@ -160,12 +153,49 @@ jobs:
160153
cp target/${{ matrix.build.TARGET }}/release/$BINARY .
161154
chmod +x $BINARY
162155
156+
- name: Setup MinGW environment (Windows MinGW builds)
157+
if: runner.os == 'Windows' && contains(matrix.build.TARGET, 'windows-gnu')
158+
shell: pwsh
159+
run: |
160+
# Install MSYS2 and MinGW-w64
161+
choco install msys2 -y
162+
163+
# Update MSYS2 and install required packages
164+
C:\tools\msys64\usr\bin\bash.exe -lc "pacman -Syu --noconfirm"
165+
C:\tools\msys64\usr\bin\bash.exe -lc "pacman -S --noconfirm mingw-w64-x86_64-gcc mingw-w64-x86_64-openssl mingw-w64-x86_64-pkg-config perl"
166+
167+
# Add MinGW to PATH
168+
echo "C:\tools\msys64\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
169+
echo "C:\tools\msys64\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
170+
163171
- name: Build (Windows)
164172
if: runner.os == 'Windows'
165173
shell: pwsh
166174
run: |
167-
# Build
168-
cargo build --release --target ${{ matrix.build.TARGET }}
175+
# Set environment variables for MinGW builds
176+
if ("${{ matrix.build.TARGET }}" -like "*windows-gnu*") {
177+
$env:OPENSSL_DIR = "C:\tools\msys64\mingw64"
178+
$env:PKG_CONFIG_PATH = "C:\tools\msys64\mingw64\lib\pkgconfig"
179+
$env:PKG_CONFIG_ALLOW_CROSS = "1"
180+
$env:OPENSSL_STATIC = "1"
181+
# Use the MSYS2 Perl instead of Windows Perl
182+
$env:PATH = "C:\tools\msys64\usr\bin;C:\tools\msys64\mingw64\bin;" + $env:PATH
183+
}
184+
185+
# Build with retry mechanism for MinGW
186+
if ("${{ matrix.build.TARGET }}" -like "*windows-gnu*") {
187+
# Try building with native OpenSSL first
188+
try {
189+
cargo build --release --target ${{ matrix.build.TARGET }}
190+
} catch {
191+
Write-Host "First build attempt failed, trying with vendored OpenSSL..."
192+
$env:OPENSSL_STATIC = "1"
193+
$env:OPENSSL_VENDOR = "1"
194+
cargo build --release --target ${{ matrix.build.TARGET }} --features vendored-openssl
195+
}
196+
} else {
197+
cargo build --release --target ${{ matrix.build.TARGET }}
198+
}
169199
170200
# Copy binary
171201
$BINARY = "gh-templates.exe"

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22

33
name = "gh-templates"
4-
version = "0.1.26"
4+
version = "0.1.27"
55
edition = "2021"
66
authors = ["John Kagunda [email protected]"]
77
description = "A template project for GitHub-related utilities."

0 commit comments

Comments
 (0)