Skip to content

Commit 7ba67b2

Browse files
committed
build(ci): Add MinGW-w64 i686 cross-compilation to CI workflow (#2163)
Add automated MinGW-w64 (i686) build jobs for both Generals and GeneralsMD to the CI pipeline, enabling Linux-hosted cross-compilation with artifact collection matching the MSVC PDB workflow. Changes: - .github/workflows/ci.yml: Add two new matrix build jobs - build-mingw-generals: Builds Generals with mingw-w64-i686 toolchain - build-mingw-generalsmd: Builds GeneralsMD with mingw-w64-i686 toolchain - Matrix: mingw-w64-i686 (Release), mingw-w64-i686-debug (Debug) - Profile preset excluded (uses MSVC inline ASM with no GCC equivalent) Toolchain setup (ubuntu-latest): - MinGW-w64 cross-compiler (i686-w64-mingw32-gcc) - Wine stable + widl for COM interface compilation - CMake with Unix Makefiles generator - Cached toolchain and dependencies Artifact collection: - Stripped executable (.exe) + separate debug symbols (.exe.debug) for Release - Single executable with embedded symbols for Debug - Matches MSVC .exe + .pdb workflow - Static linked (no DLL dependencies) - 30-day retention period Jobs respect detect-changes filter (Generals/**, GeneralsMD/**, Core/**, .github/workflows/**, etc.) for conditional execution, identical to existing VC6 and win32 build triggers. Result: 4 new artifact combinations - Generals-mingw-w64-i686 (76 MB: 12 MB exe + 229 MB debug) - Generals-mingw-w64-i686-debug (56.6 MB: 200 MB exe) - GeneralsMD-mingw-w64-i686 (82.2 MB: 13 MB exe + 248 MB debug) - GeneralsMD-mingw-w64-i686-debug (61.4 MB: 215 MB exe)
1 parent f244a23 commit 7ba67b2

1 file changed

Lines changed: 194 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,3 +178,197 @@ jobs:
178178
userdata: "GeneralsReplays/GeneralsZH/1.04"
179179
preset: ${{ matrix.preset }}
180180
secrets: inherit
181+
182+
build-mingw-generals:
183+
name: Build Generals MinGW-w64 (${{ matrix.preset }})
184+
needs: detect-changes
185+
if: ${{ github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.generals == 'true' || needs.detect-changes.outputs.shared == 'true' }}
186+
runs-on: ubuntu-latest
187+
timeout-minutes: 45
188+
strategy:
189+
matrix:
190+
preset: ["mingw-w64-i686", "mingw-w64-i686-debug"]
191+
# Note: mingw-w64-i686-profile excluded - profiling uses ASM with no GCC equivalent
192+
fail-fast: false
193+
194+
steps:
195+
- name: Checkout Code
196+
uses: actions/checkout@v4
197+
198+
- name: Cache MinGW-w64 Dependencies
199+
id: cache-mingw-deps
200+
uses: actions/cache@v4
201+
with:
202+
path: |
203+
/usr/lib/gcc/i686-w64-mingw32
204+
/usr/i686-w64-mingw32
205+
key: mingw-w64-deps-${{ runner.os }}-v1
206+
207+
- name: Install MinGW-w64 Toolchain
208+
run: |
209+
sudo apt-get update
210+
sudo apt-get install -y mingw-w64 cmake
211+
212+
- name: Install Wine and widl
213+
run: |
214+
215+
# Add Wine repository
216+
sudo dpkg --add-architecture i386
217+
sudo mkdir -pm755 /etc/apt/keyrings
218+
sudo wget -O /etc/apt/keyrings/winehq-archive.key https://dl.winehq.org/wine-builds/winehq.key
219+
220+
# Determine Ubuntu codename
221+
CODENAME=$(lsb_release -cs)
222+
223+
# Download appropriate sources file
224+
sudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/${CODENAME}/winehq-${CODENAME}.sources || {
225+
sudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/jammy/winehq-jammy.sources
226+
}
227+
228+
# Update and install Wine
229+
sudo apt-get update
230+
sudo apt-get install -y --install-recommends winehq-stable wine-stable-dev || {
231+
sudo apt-get install -y wine-stable-dev
232+
}
233+
234+
- name: Cache CMake Dependencies
235+
id: cache-cmake-deps
236+
uses: actions/cache@v4
237+
with:
238+
path: build/${{ matrix.preset }}/_deps
239+
key: cmake-deps-mingw-${{ matrix.preset }}-${{ hashFiles('CMakePresets.json','cmake/**/*.cmake','**/CMakeLists.txt') }}
240+
241+
- name: Configure Generals with CMake (${{ matrix.preset }})
242+
run: |
243+
244+
# Unset LD_LIBRARY_PATH to avoid library conflicts
245+
unset LD_LIBRARY_PATH
246+
247+
# Configure with appropriate flags
248+
cmake --preset ${{ matrix.preset }} \
249+
-DRTS_BUILD_ZEROHOUR=OFF \
250+
-DRTS_BUILD_GENERALS=ON \
251+
-DRTS_BUILD_CORE_TOOLS=OFF \
252+
-DRTS_BUILD_GENERALS_TOOLS=OFF \
253+
-DRTS_BUILD_ZEROHOUR_TOOLS=OFF \
254+
-DRTS_BUILD_CORE_EXTRAS=OFF \
255+
-DRTS_BUILD_GENERALS_EXTRAS=OFF \
256+
-DRTS_BUILD_ZEROHOUR_EXTRAS=OFF
257+
- name: Build Generals (${{ matrix.preset }})
258+
run: |
259+
260+
# Build with parallel jobs
261+
cmake --build build/${{ matrix.preset }} --target g_generals -j$(nproc)
262+
263+
- name: Collect Generals Artifacts
264+
run: |
265+
ARTIFACTS_DIR="build/${{ matrix.preset }}/Generals/artifacts"
266+
mkdir -p "$ARTIFACTS_DIR"
267+
268+
# Copy executables, DLLs, and debug symbols
269+
find build/${{ matrix.preset }}/Core build/${{ matrix.preset }}/Generals -type f \( -name "*.exe" -o -name "*.dll" -o -name "*.exe.debug" \) -exec cp {} "$ARTIFACTS_DIR/" \; 2>/dev/null || true
270+
271+
- name: Upload Generals ${{ matrix.preset }} Artifact
272+
uses: actions/upload-artifact@v4
273+
with:
274+
name: Generals-${{ matrix.preset }}
275+
path: build/${{ matrix.preset }}/Generals/artifacts
276+
retention-days: 30
277+
if-no-files-found: error
278+
279+
build-mingw-generalsmd:
280+
name: Build GeneralsMD MinGW-w64 (${{ matrix.preset }})
281+
needs: detect-changes
282+
if: ${{ github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.generalsmd == 'true' || needs.detect-changes.outputs.shared == 'true' }}
283+
runs-on: ubuntu-latest
284+
timeout-minutes: 45
285+
strategy:
286+
matrix:
287+
preset: ["mingw-w64-i686", "mingw-w64-i686-debug"]
288+
# Note: mingw-w64-i686-profile excluded - profiling uses ASM with no GCC equivalent
289+
fail-fast: false
290+
291+
steps:
292+
- name: Checkout Code
293+
uses: actions/checkout@v4
294+
295+
- name: Cache MinGW-w64 Dependencies
296+
id: cache-mingw-deps
297+
uses: actions/cache@v4
298+
with:
299+
path: |
300+
/usr/lib/gcc/i686-w64-mingw32
301+
/usr/i686-w64-mingw32
302+
key: mingw-w64-deps-${{ runner.os }}-v1
303+
304+
- name: Install MinGW-w64 Toolchain
305+
run: |
306+
sudo apt-get update
307+
sudo apt-get install -y mingw-w64 cmake
308+
309+
- name: Install Wine and widl
310+
run: |
311+
312+
# Add Wine repository
313+
sudo dpkg --add-architecture i386
314+
sudo mkdir -pm755 /etc/apt/keyrings
315+
sudo wget -O /etc/apt/keyrings/winehq-archive.key https://dl.winehq.org/wine-builds/winehq.key
316+
317+
# Determine Ubuntu codename
318+
CODENAME=$(lsb_release -cs)
319+
320+
# Download appropriate sources file
321+
sudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/${CODENAME}/winehq-${CODENAME}.sources || {
322+
sudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/jammy/winehq-jammy.sources
323+
}
324+
325+
# Update and install Wine
326+
sudo apt-get update
327+
sudo apt-get install -y --install-recommends winehq-stable wine-stable-dev || {
328+
sudo apt-get install -y wine-stable-dev
329+
}
330+
331+
- name: Cache CMake Dependencies
332+
id: cache-cmake-deps
333+
uses: actions/cache@v4
334+
with:
335+
path: build/${{ matrix.preset }}/_deps
336+
key: cmake-deps-mingw-${{ matrix.preset }}-${{ hashFiles('CMakePresets.json','cmake/**/*.cmake','**/CMakeLists.txt') }}
337+
338+
- name: Configure GeneralsMD with CMake (${{ matrix.preset }})
339+
run: |
340+
341+
# Unset LD_LIBRARY_PATH to avoid library conflicts
342+
unset LD_LIBRARY_PATH
343+
344+
# Configure with appropriate flags
345+
cmake --preset ${{ matrix.preset }} \
346+
-DRTS_BUILD_ZEROHOUR=ON \
347+
-DRTS_BUILD_GENERALS=OFF \
348+
-DRTS_BUILD_CORE_TOOLS=OFF \
349+
-DRTS_BUILD_GENERALS_TOOLS=OFF \
350+
-DRTS_BUILD_ZEROHOUR_TOOLS=OFF \
351+
-DRTS_BUILD_CORE_EXTRAS=OFF \
352+
-DRTS_BUILD_GENERALS_EXTRAS=OFF \
353+
-DRTS_BUILD_ZEROHOUR_EXTRAS=OFF
354+
- name: Build GeneralsMD (${{ matrix.preset }})
355+
run: |
356+
357+
# Build with parallel jobs
358+
cmake --build build/${{ matrix.preset }} --target z_generals -j$(nproc)
359+
360+
- name: Collect GeneralsMD Artifacts
361+
run: |
362+
ARTIFACTS_DIR="build/${{ matrix.preset }}/GeneralsMD/artifacts"
363+
mkdir -p "$ARTIFACTS_DIR"
364+
365+
# Copy executables, DLLs, and debug symbols
366+
find build/${{ matrix.preset }}/Core build/${{ matrix.preset }}/GeneralsMD -type f \( -name "*.exe" -o -name "*.dll" -o -name "*.exe.debug" \) -exec cp {} "$ARTIFACTS_DIR/" \; 2>/dev/null || true
367+
368+
- name: Upload GeneralsMD ${{ matrix.preset }} Artifact
369+
uses: actions/upload-artifact@v4
370+
with:
371+
name: GeneralsMD-${{ matrix.preset }}
372+
path: build/${{ matrix.preset }}/GeneralsMD/artifacts
373+
retention-days: 30
374+
if-no-files-found: error

0 commit comments

Comments
 (0)