-
Notifications
You must be signed in to change notification settings - Fork 2
228 lines (199 loc) · 8.21 KB
/
build.yml
File metadata and controls
228 lines (199 loc) · 8.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
name: Build CI
on:
push:
branches: ['main']
pull_request:
workflow_dispatch:
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}-${{ matrix.config.os-version }}
strategy:
fail-fast: false
matrix:
config:
- name: Windows MSVC (dynamic)
os: windows
os-version: 2025
environment: msvc
shell: pwsh
static: false
fatal_warnings: false # TODO: enable fatal warnings, once cpp-httplib is patched either by ourselves or by the maintainers
- name: Windows MSVC (static)
os: windows
os-version: 2025
environment: msvc
shell: pwsh
static: true
fatal_warnings: false # TODO: enable fatal warnings, once cpp-httplib is patched either by ourselves or by the maintainers
- name: Windows MingGW
os: windows
os-version: 2025
environment: mingw
architecture: x86_64
shell: 'msys2 {0}'
fatal_warnings: true
- name: Windows UCRT
os: windows
os-version: 2025
environment: ucrt
architecture: ucrt-x86_64
shell: 'msys2 {0}'
fatal_warnings: true
- name: Linux (ARM64)
os: ubuntu
os-version: 24.04-arm
use-clang: false
arm: true
shell: bash
fatal_warnings: true
- name: Linux
os: ubuntu
os-version: 24.04
use-clang: false
arm: false
shell: bash
fatal_warnings: true
- name: Linux Clang (libstdc++)
os: ubuntu
os-version: 24.04
use-clang: true
use-clang_stdlib: false
arm: false
shell: bash
fatal_warnings: true
- name: Linux Clang (libc++)
os: ubuntu
os-version: 24.04
use-clang: true
use-clang_stdlib: true
arm: false
shell: bash
fatal_warnings: true
- name: MacOS
os: macos
os-version: 13
arm: false
shell: bash
fatal_warnings: true
- name: MacOS (Arm64)
os: macos
os-version: 15
arm: true
shell: bash
fatal_warnings: true
defaults:
run:
shell: ${{ matrix.config.shell }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Setup MSVC (Windows)
if: matrix.config.os == 'windows' && matrix.config.environment == 'msvc'
uses: TheMrMilchmann/setup-msvc-dev@v3
with:
arch: x64
toolset: '14.44'
- name: Setup MSYS2 (Windows)
if: matrix.config.os == 'windows' && ( matrix.config.environment == 'mingw' || matrix.config.environment == 'ucrt' )
uses: msys2/setup-msys2@v2
with:
msystem: ${{matrix.config.environment == 'mingw' && 'MINGW64' || 'UCRT64'}}
update: true
install: >-
mingw-w64-${{matrix.config.architecture}}-ninja
mingw-w64-${{matrix.config.architecture}}-python
mingw-w64-${{matrix.config.architecture}}-python-pip
mingw-w64-${{matrix.config.architecture}}-SDL2
mingw-w64-${{matrix.config.architecture}}-SDL2_ttf
mingw-w64-${{matrix.config.architecture}}-SDL2_mixer
mingw-w64-${{matrix.config.architecture}}-SDL2_image
mingw-w64-${{matrix.config.architecture}}-pkg-config
mingw-w64-${{matrix.config.architecture}}-ca-certificates
mingw-w64-${{matrix.config.architecture}}-cmake
git
- name: Setup GCC (MSYS2)
if: matrix.config.os == 'windows' && ( matrix.config.environment == 'mingw' || matrix.config.environment == 'ucrt' )
uses: Totto16/msys2-install-packages-pinned@v1
with:
msystem: ${{matrix.config.environment == 'mingw' && 'MINGW64' || 'UCRT64'}}
install: |
gcc=15 gcc-libs=!
- name: Setup Clang (Linux) (libc++)
if: matrix.config.os == 'ubuntu' && matrix.config.use-clang == true && matrix.config.use-clang_stdlib
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 20
sudo apt-get install libc++-20* libc++abi*20* -y --no-install-recommends
echo "CC=clang-20" >> "$GITHUB_ENV"
echo "CXX=clang++-20" >> "$GITHUB_ENV"
echo "OBJC=clang-20" >> "$GITHUB_ENV"
- name: Setup Clang (Linux) (libstdc++)
if: matrix.config.os == 'ubuntu' && matrix.config.use-clang == true && (! matrix.config.use-clang_stdlib)
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 20
echo "CC=clang-20" >> "$GITHUB_ENV"
echo "CXX=clang++-20" >> "$GITHUB_ENV"
echo "OBJC=clang-20" >> "$GITHUB_ENV"
- name: Setup GCC (Linux)
if: matrix.config.os == 'ubuntu' && matrix.config.use-clang == false
uses: egor-tensin/setup-gcc@v1
with:
version: 14
platform: x64
- name: Unbreak Python in GHA (MacOS 13 image)
if: matrix.config.os == 'macos' && matrix.config.os-version == 13
run: |
# TODO: remove this, after it works again
# A workaround for "The `brew link` step did not complete successfully" error.
# See e.g. https://github.com/Homebrew/homebrew-core/issues/165793#issuecomment-1991817938
find /usr/local/bin -lname '*/Library/Frameworks/Python.framework/*' -delete
sudo rm -rf /Library/Frameworks/Python.framework/
brew install --force python3 && brew unlink python3 && brew unlink python3 && brew link --overwrite python3
- name: Setup Clang (MacOS)
if: matrix.config.os == 'macos'
run: |
brew update
brew install llvm@20 lld@20
echo "$(brew --prefix)/opt/llvm@20/bin:$(brew --prefix)/opt/lld@20/bin" >> $GITHUB_PATH
echo "LDFLAGS=-L$(brew --prefix)/opt/llvm@20/lib -L$(brew --prefix)/opt/llvm@20/lib/c++ -Wl,-rpath,$(brew --prefix)/opt/llvm@20/lib/c++ -L$(brew --prefix)/opt/lld@20/lib" >> "$GITHUB_ENV"
echo "CPPFLAGS=-I$(brew --prefix)/opt/llvm@20/include -I$(brew --prefix)/opt/lld@20/include" >> "$GITHUB_ENV"
echo "CC=clang" >> "$GITHUB_ENV"
echo "CXX=clang++" >> "$GITHUB_ENV"
echo "OBJC=clang" >> "$GITHUB_ENV"
echo "CC_LD=lld" >> "$GITHUB_ENV"
echo "CXX_LD=lld" >> "$GITHUB_ENV"
echo "OBJC_LD=lld" >> "$GITHUB_ENV"
- name: Setup meson (MacOS)
if: matrix.config.os == 'macos'
run: |
brew update
brew install meson
# NOTE: meson has no dependencies, so --break-system-packages doesn't really break anything!
- name: Setup meson
if: matrix.config.os != 'macos'
run: |
pip install meson --break-system-packages
- name: Install dependencies (Linux)
if: matrix.config.os == 'ubuntu'
run: |
sudo apt-get update
sudo apt-get install ninja-build libsdl2-2.0-0 libsdl2-dev libsdl2-ttf* libsdl2-mixer* libsdl2-image* -y --no-install-recommends
- name: Install dependencies (MacOS)
if: matrix.config.os == 'macos'
run: |
brew update
brew install sdl2 sdl2_ttf sdl2_mixer sdl2_image
- name: Configure
run: meson setup build -Dbuildtype=release -Ddefault_library=${{( matrix.config.os == 'windows' && matrix.config.environment == 'msvc' && matrix.config.static ) && 'static' ||'shared' }} -Dclang_libcpp=${{ ( ( matrix.config.os == 'ubuntu' && matrix.config.use-clang == true && matrix.config.use-clang_stdlib ) || matrix.config.os == 'macos' ) && 'enabled' || 'disabled' }} -Drun_in_ci=true ${{( matrix.config.fatal_warnings ) && '--fatal-meson-warnings' || '' }}
- name: Build
run: meson compile -C build
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.config.name }} Executable
path: build/src/executables/oopetris*