Skip to content

Commit cf2ac15

Browse files
authored
Enhance CI workflow for multi-architecture support
Refactor CI workflow to support multiple architectures for Linux, Windows, and macOS builds. Added conditional steps for dependency installation and compilation based on architecture.
1 parent 21a60e5 commit cf2ac15

File tree

1 file changed

+112
-56
lines changed

1 file changed

+112
-56
lines changed

.github/workflows/build.yml

Lines changed: 112 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -3,71 +3,127 @@ on: [push, pull_request]
33

44
jobs:
55
linux:
6-
name: Linux
6+
name: Linux (${{ matrix.arch }})
77
runs-on: ubuntu-22.04
8+
strategy:
9+
fail-fast: false
10+
matrix:
11+
arch: [x86_64, i386]
812
steps:
9-
- uses: actions/checkout@v4
10-
- name: Install Dependencies
11-
run: |
12-
sudo apt-get update
13-
sudo apt-get install libsdl2-dev
14-
- name: Compile
15-
run: make release -j$(nproc) -C engine
16-
env:
17-
ARCHIVE: 1
18-
- uses: actions/upload-artifact@v4
19-
with:
20-
name: Linux
21-
path: engine/build/*.zip
13+
- uses: actions/checkout@v4
14+
15+
- name: Install Dependencies (x86_64)
16+
if: matrix.arch == 'x86_64'
17+
run: |
18+
sudo apt-get update
19+
sudo apt-get install -y build-essential libsdl2-dev
20+
21+
- name: Install Dependencies (i386)
22+
if: matrix.arch == 'i386'
23+
run: |
24+
sudo dpkg --add-architecture i386
25+
sudo apt-get update
26+
sudo apt-get install -y build-essential gcc-multilib g++-multilib \
27+
libsdl2-dev:i386
28+
29+
- name: Compile (x86_64)
30+
if: matrix.arch == 'x86_64'
31+
run: make release -j$(nproc) -C engine
32+
env:
33+
ARCHIVE: 1
34+
35+
- name: Compile (i386)
36+
if: matrix.arch == 'i386'
37+
run: make release -j$(nproc) -C engine
38+
env:
39+
ARCHIVE: 1
40+
CFLAGS: -m32
41+
CXXFLAGS: -m32
42+
LDFLAGS: -m32
43+
44+
- uses: actions/upload-artifact@v4
45+
with:
46+
name: Linux-${{ matrix.arch }}
47+
path: engine/build/*.zip
48+
2249
windows:
23-
name: Windows
50+
name: Windows (${{ matrix.arch }})
2451
runs-on: windows-2022
52+
strategy:
53+
fail-fast: false
54+
matrix:
55+
arch: [x86_64, i686]
56+
defaults:
57+
run:
58+
shell: pwsh
2559
steps:
26-
- uses: actions/checkout@v4
27-
- name: Compile
28-
run: |
29-
choco install zip
30-
# HACK: This sets USE_CURL_DLOPEN=1 because Curl fails to link otherwise.
31-
make release -j $env:NUMBER_OF_PROCESSORS -C engine USE_CURL_DLOPEN=1
32-
env:
33-
ARCHIVE: 1
34-
- uses: actions/upload-artifact@v4
35-
with:
36-
name: Windows
37-
path: engine/build/*.zip
60+
- uses: actions/checkout@v4
61+
62+
- name: Install tools
63+
run: |
64+
choco install -y zip make mingw
65+
66+
- name: Compile (x86_64)
67+
if: matrix.arch == 'x86_64'
68+
run: |
69+
# HACK: This sets USE_CURL_DLOPEN=1 because Curl fails to link otherwise.
70+
make release -j $env:NUMBER_OF_PROCESSORS -C engine USE_CURL_DLOPEN=1
71+
env:
72+
ARCHIVE: 1
73+
74+
- name: Compile (i686 / 32-bit)
75+
if: matrix.arch == 'i686'
76+
run: |
77+
# Ensure MinGW is on PATH (Chocolatey mingw provides both 32/64; we force 32-bit toolchain)
78+
$mingw = "C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin"
79+
echo $mingw | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
80+
81+
# Force 32-bit compiler + flags; adjust variables if your Makefile uses different ones
82+
make release -j $env:NUMBER_OF_PROCESSORS -C engine USE_CURL_DLOPEN=1 `
83+
CC=i686-w64-mingw32-gcc CXX=i686-w64-mingw32-g++ `
84+
CFLAGS="-m32" CXXFLAGS="-m32" LDFLAGS="-m32"
85+
env:
86+
ARCHIVE: 1
87+
88+
- uses: actions/upload-artifact@v4
89+
with:
90+
name: Windows-${{ matrix.arch }}
91+
path: engine/build/*.zip
92+
3893
macos:
3994
name: macOS
4095
runs-on: macos-15
4196
steps:
42-
- uses: actions/checkout@v4
43-
- name: Compile
44-
run: make release -j$(sysctl -n hw.logicalcpu) -C engine
45-
env:
46-
ARCHIVE: 1
47-
- uses: actions/upload-artifact@v4
48-
with:
49-
name: macOS
50-
path: engine/build/*.zip
97+
- uses: actions/checkout@v4
98+
- name: Compile
99+
run: make release -j$(sysctl -n hw.logicalcpu) -C engine
100+
env:
101+
ARCHIVE: 1
102+
- uses: actions/upload-artifact@v4
103+
with:
104+
name: macOS
105+
path: engine/build/*.zip
106+
51107
web:
52108
runs-on: ubuntu-latest
53109
steps:
54-
- uses: actions/checkout@v4
55-
- uses: actions/checkout@v4
56-
with:
57-
repository: emscripten-core/emsdk
58-
path: emsdk
59-
- name: Install Dependencies
60-
run: |
61-
cd emsdk
62-
./emsdk install 3.1.58
63-
./emsdk activate 3.1.58
64-
- name: Compile
65-
env:
66-
ARCHIVE: 1
67-
run: |
68-
source emsdk/emsdk_env.sh
69-
emmake make release -j$(nproc) -C engine
70-
- uses: actions/upload-artifact@v4
71-
with:
72-
name: Web
73-
path: engine/build/*.zip
110+
- uses: actions/checkout@v4
111+
- uses: actions/checkout@v4
112+
with:
113+
repository: emscripten-core/emsdk
114+
path: emsdk
115+
- name: Install Dependencies
116+
run: |
117+
cd emsdk
118+
./emsdk install 3.1.58
119+
./emsdk activate 3.1.58
120+
- name: Compile
121+
env:
122+
ARCHIVE: 1
123+
run: |
124+
source emsdk/emsdk_env.sh
125+
emmake make release -j$(nproc) -C engine
126+
- uses: actions/upload-artifact@v4
127+
with:
128+
name: Web
129+
path: engine/build/*.zip

0 commit comments

Comments
 (0)