-
Notifications
You must be signed in to change notification settings - Fork 41
327 lines (270 loc) · 10.4 KB
/
build.yml
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
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
name: Build
on:
push:
# branches-ignore:
# - main
paths-ignore:
- '*.json'
- '*.md'
- '*LICENSE'
pull_request:
env:
BUILDCACHE_VERSION: v0.27.3
BUILDCACHE_ACCURACY: STRICT
BUILDCACHE_MAX_CACHE_SIZE: 1073741824 # 1GiB
jobs:
build-linux:
name: Build Linux (${{matrix.name}} x86_64)
runs-on: ubuntu-latest
env:
BUILDCACHE_DIR: ${{github.workspace}}/.buildcache
strategy:
fail-fast: false
matrix:
include:
- name: GCC
preset: gcc
- name: Clang
preset: clang
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: recursive
- name: Install dependencies
run: |
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
sudo apt-get -y install ninja-build clang lld libcurl4-openssl-dev intel-oneapi-ipp-devel \
zlib1g-dev libglu1-mesa-dev libdbus-1-dev libvulkan-dev libxi-dev libxrandr-dev libasound2-dev \
libpulse-dev libudev-dev libpng-dev libncurses5-dev libx11-xcb-dev libfreetype-dev \
libxinerama-dev libxcursor-dev python3-markupsafe libgtk-3-dev
# setup buildcache
curl -LSfs https://github.com/encounter/buildcache/releases/download/$BUILDCACHE_VERSION/buildcache-linux.tar.gz | tar xz -C "$RUNNER_WORKSPACE"
echo "$RUNNER_WORKSPACE"/buildcache/bin >> $GITHUB_PATH
# free up disk space
# https://github.com/actions/virtual-environments/issues/2840#issuecomment-790492173
echo Before
df -h .
sudo apt-get clean
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf /usr/local/share/boost
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
echo After
df -h .
- name: Restore buildcache
uses: pat-s/always-upload-cache@v2
with:
path: ${{env.BUILDCACHE_DIR}}
key: buildcache-${{runner.os}}-${{matrix.preset}}-${{github.sha}}
restore-keys: |
buildcache-${{runner.os}}-${{matrix.preset}}-
- name: Configure CMake
run: cmake --preset x-linux-ci-${{matrix.preset}}
- name: Build
run: cmake --build --preset x-linux-ci-${{matrix.preset}}
- name: Print buildcache stats
run: buildcache -s
- name: Generate AppImage
run: ci/build-appimage.sh
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: metaforce-${{env.METAFORCE_VERSION}}-linux-${{matrix.preset}}-x86_64
path: |
build/install/Metaforce-*.AppImage
build/install/debug.tar.*
build-macos:
name: Build macOS (AppleClang universal)
runs-on: macos-latest
env:
IPP_VERSION: 2021.2.0.192
BUILDCACHE_DIR: ${{github.workspace}}/.buildcache
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: recursive
- name: Install dependencies
run: |
brew update
brew upgrade --formula
brew install ninja graphicsmagick imagemagick
yarn global add create-dmg
pip3 install markupsafe
# setup buildcache
curl -LSfs https://github.com/encounter/buildcache/releases/download/$BUILDCACHE_VERSION/buildcache-macos.zip -o /tmp/buildcache-macos.zip
unzip /tmp/buildcache-macos.zip -d "$RUNNER_WORKSPACE"
echo "$RUNNER_WORKSPACE"/buildcache/bin >> $GITHUB_PATH
- name: Install Intel IPP
if: 'false' # not supported for universal build
run: |
NAME="m_ipp_oneapi_p_${IPP_VERSION}_offline"
curl -LSfs https://registrationcenter-download.intel.com/akdlm/irc_nas/17606/$NAME.dmg -o /tmp/$NAME.dmg
sudo hdiutil attach /tmp/$NAME.dmg -quiet
sudo /Volumes/$NAME/bootstrapper.app/Contents/MacOS/install.sh -c --action install --eula accept
sudo hdiutil detach /Volumes/$NAME -quiet
rm /tmp/$NAME.dmg
- name: Restore buildcache
uses: pat-s/always-upload-cache@v2
with:
path: ${{env.BUILDCACHE_DIR}}
key: buildcache-${{runner.os}}-universal-${{github.sha}}
restore-keys: |
buildcache-${{runner.os}}-universal-
- name: Configure CMake
run: cmake --preset x-macos-ci
- name: Build
run: cmake --build --preset x-macos-ci
- name: Print buildcache stats
if: 'false' # temporarily disabled
run: buildcache -s
- name: Import signing certificate
uses: devbotsxyz/xcode-import-certificate@master
with:
certificate-data: ${{secrets.MACOS_CERTIFICATE_DATA}}
certificate-passphrase: ${{secrets.MACOS_CERTIFICATE_PASSWORD}}
keychain-password: ${{secrets.MACOS_KEYCHAIN_PASSWORD}}
- name: Deploy & codesign application
env:
ASC_USERNAME: ${{secrets.MACOS_ASC_USERNAME}}
ASC_PASSWORD: ${{secrets.MACOS_ASC_PASSWORD}}
ASC_TEAM_ID: ${{secrets.MACOS_ASC_TEAM_ID}}
CODESIGN_IDENT: ${{secrets.MACOS_CODESIGN_IDENT}}
run: ci/build-dmg.sh
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: metaforce-${{env.METAFORCE_VERSION}}-macos-appleclang-universal
path: |
build/install/Metaforce *.dmg
build/install/debug.tar.*
build-ios:
name: Build iOS (AppleClang arm64)
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: recursive
- name: Install dependencies
run: |
brew update
brew upgrade --formula
brew install ninja
pip3 install markupsafe
- name: Configure CMake
run: cmake --preset ios-default
- name: Build
run: cmake --build --preset ios-default --target install
- name: Generate IPA
run: ci/build-ipa.sh
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: metaforce-${{env.METAFORCE_VERSION}}-ios-appleclang-arm64
path: |
build/install/Metaforce.ipa
build/install/debug.tar.*
build-tvos:
name: Build tvOS (AppleClang arm64)
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: recursive
- name: Install dependencies
run: |
brew update
brew upgrade --formula
brew install ninja
pip3 install markupsafe
- name: Configure CMake
run: cmake --preset tvos-default
- name: Build
run: cmake --build --preset tvos-default --target install
- name: Generate IPA
run: ci/build-ipa.sh
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: metaforce-${{env.METAFORCE_VERSION}}-tvos-appleclang-arm64
path: |
build/install/Metaforce.ipa
build/install/debug.tar.*
build-windows:
name: Build Windows (${{matrix.name}} x86_64)
runs-on: windows-latest
env:
Qt_VERSION: 5.15.2
IPP_VERSION: 2021.2.0.210
# C: has ~90GB available space at the moment
BUILDCACHE_DIR: C:\buildcache
BUILD_DIR: C:\build
strategy:
fail-fast: false
matrix:
include:
- name: MSVC
preset: msvc
#- name: Clang
# preset: clang
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: recursive
- name: Install vcpkg Qt
run: |
$TempDir = "$env:RUNNER_WORKSPACE\temp"
$Filename = "vcpkg-qt-$env:Qt_VERSION-full.7z"
New-Item -Path "$TempDir" -ItemType Directory -ea 0
(New-Object Net.WebClient).DownloadFile("https://axiodl.com/files/$Filename", "$TempDir\$Filename")
7z x "-o$env:RUNNER_WORKSPACE" -aos "$TempDir\$Filename"
- name: Install Intel IPP
if: 'false' # takes >10min, not worth it
run: |
$TempDir = "$env:RUNNER_WORKSPACE\temp"
$Filename = "w_ipp_oneapi_p_${env:IPP_VERSION}_offline.exe"
New-Item -Path "$TempDir" -ItemType Directory -ea 0
(New-Object Net.WebClient).DownloadFile("https://registrationcenter-download.intel.com/akdlm/irc_nas/17739/$Filename", "$TempDir\$Filename")
Start-Process "$TempDir\$Filename" -ArgumentList "--x --s --f $TempDir\ipp" -Wait
Start-Process "$TempDir\ipp\bootstrapper.exe" -ArgumentList "--eula accept -c --action install" -Wait
- name: Install dependencies
run: |
choco install ninja vulkan-sdk
pip install markupsafe
# set up buildcache
$TempDir = "$env:RUNNER_WORKSPACE\temp"
New-Item -Path "$TempDir" -ItemType Directory -ea 0
(New-Object Net.WebClient).DownloadFile("https://github.com/encounter/buildcache/releases/download/$env:BUILDCACHE_VERSION/buildcache-windows.zip", "$TempDir\buildcache.zip")
Expand-Archive -LiteralPath "$TempDir\buildcache.zip" -DestinationPath "$TempDir" -Force
echo "$TempDir\buildcache\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
# check available disk space
Get-PSDrive
- name: Restore buildcache
uses: pat-s/always-upload-cache@v2
with:
path: ${{env.BUILDCACHE_DIR}}
key: buildcache-${{runner.os}}-${{matrix.preset}}-${{github.sha}}
restore-keys: |
buildcache-${{runner.os}}-${{matrix.preset}}-
- name: Enable Visual Studio environment
uses: ilammy/msvc-dev-cmd@v1
- name: Configure CMake
run: cmake --preset x-windows-ci-${{matrix.preset}}
- name: Build
run: cmake --build --preset x-windows-ci-${{matrix.preset}}
- name: Print buildcache stats
run: buildcache -s
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: metaforce-${{env.METAFORCE_VERSION}}-win32-${{matrix.preset}}-x86_64
path: |
${{env.BUILD_DIR}}/install/*.exe
${{env.BUILD_DIR}}/install/debug.7z