forked from JACoders/OpenJK
-
Notifications
You must be signed in to change notification settings - Fork 4
345 lines (295 loc) · 12.9 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
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
name: build
on:
workflow_dispatch:
push:
branches: [rend2-builds]
paths-ignore:
- "**.md"
- ".gitignore"
- "docs/*"
pull_request:
branches: [rend2-builds]
paths-ignore:
- "**.md"
- ".gitignore"
- "docs/*"
release:
types: [published]
jobs:
msvc:
name: Windows ${{ matrix.arch }} ${{ matrix.build_type }} (${{ matrix.portable }})
runs-on: windows-2022
strategy:
matrix:
arch: [x86, x86_64]
build_type: [Debug, Release]
portable: [Portable, Non-Portable]
exclude:
- build_type: Debug
portable: Portable
include:
- arch: x86
platform: Win32
- arch: x86_64
platform: x64
steps:
- uses: actions/checkout@v3
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.1
- name: Create Build Environment
run: cmake -E make_directory ${{ github.workspace }}/build
- name: Configure CMake
shell: bash
working-directory: ${{ github.workspace }}/build
run: |
OPTIONS="-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_INSTALL_PREFIX=bin"
if [ "${{ matrix.portable }}" == "Portable" ]; then
OPTIONS+=" -DBuildPortableVersion=ON"
else
OPTIONS+=" -DBuildPortableVersion=OFF"
fi
OPTIONS+=" -DBuildJK2SPEngine=ON -DBuildJK2SPGame=ON -DBuildJK2SPRdVanilla=ON -DBuildJK2SPRdRend2=ON"
cmake $GITHUB_WORKSPACE -A ${{ matrix.platform }} $OPTIONS
- name: Build
working-directory: ${{ github.workspace }}/build
shell: bash
run: cmake --build . --config ${{ matrix.build_type }} -j $NUMBER_OF_PROCESSORS
- name: Install
if: ${{ matrix.build_type == 'Release' }}
working-directory: ${{ github.workspace }}/build
shell: bash
run: cmake --install . --config ${{ matrix.build_type }}
- uses: actions/upload-artifact@v3
if: ${{ matrix.build_type == 'Release' }}
with:
name: OpenJK-windows-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }}
path: ${{ github.workspace }}/build/bin/JediAcademy
if-no-files-found: error
- uses: actions/upload-artifact@v3
if: ${{ matrix.build_type == 'Release' }}
with:
name: OpenJO-windows-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }}
path: ${{ github.workspace }}/build/bin/JediOutcast
if-no-files-found: error
ubuntu:
name: Ubuntu ${{ matrix.arch }} ${{ matrix.build_type }} (${{ matrix.portable }})
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
arch: [x86, x86_64]
build_type: [Debug, Release]
portable: [Non-Portable]
steps:
- uses: actions/checkout@v3
- name: Create Build Environment
run: |
if [ ${{ matrix.arch }} == "x86" ]; then
sudo dpkg --add-architecture i386
sudo apt-get -qq update
sudo apt-get -y install aptitude
sudo apt-get -y install gcc-multilib g++-multilib ninja-build
sudo apt-get -y install --allow-downgrades libpcre2-8-0:i386 libjpeg-dev:i386 libpng-dev:i386 libcurl4-openssl-dev:i386
sudo aptitude -y install libglib2.0-dev:i386 libsdl2-dev:i386
else
sudo apt-get -qq update
sudo apt-get install libjpeg-dev libpng-dev zlib1g-dev libsdl2-dev
fi
cmake -E make_directory ${{ github.workspace }}/build
- name: Configure CMake
shell: bash
working-directory: ${{ github.workspace }}/build
run: |
OPTIONS="-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/install"
if [ "${{ matrix.portable }}" == "Portable" ]; then
OPTIONS+=" -DUseInternalLibs=ON -DBuildPortableVersion=ON"
else
OPTIONS+=" -DUseInternalLibs=OFF -DBuildPortableVersion=OFF"
fi
if [ ${{ matrix.arch }} == "x86" ]; then
OPTIONS+=" -DCMAKE_TOOLCHAIN_FILE=cmake/Toolchains/linux-i686.cmake"
fi
OPTIONS+=" -DBuildJK2SPEngine=ON -DBuildJK2SPGame=ON -DBuildJK2SPRdVanilla=ON"
cmake $GITHUB_WORKSPACE $OPTIONS
- name: Build
working-directory: ${{ github.workspace }}/build
shell: bash
run: cmake --build . -j $(nproc)
- name: Install
if: ${{ matrix.build_type == 'Release' }}
working-directory: ${{ github.workspace }}/build
shell: bash
run: cmake --install .
- name: Create OpenJK binary archive
if: ${{ matrix.build_type == 'Release' }}
working-directory: ${{ github.workspace }}/install/JediAcademy
shell: bash
run: tar -czvf OpenJK-linux-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }}.tar.gz *
- name: Create OpenJO binary archive
if: ${{ matrix.build_type == 'Release' }}
working-directory: ${{ github.workspace }}/install/JediOutcast
shell: bash
run: tar -czvf OpenJO-linux-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }}.tar.gz *
- uses: actions/upload-artifact@v3
if: ${{ matrix.build_type == 'Release' }}
with:
name: OpenJK-linux-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }}
path: ${{github.workspace}}/install/JediAcademy/OpenJK-linux-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }}.tar.gz
if-no-files-found: error
- uses: actions/upload-artifact@v3
if: ${{ matrix.build_type == 'Release' }}
with:
name: OpenJO-linux-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }}
path: ${{github.workspace}}/install/JediOutcast/OpenJO-linux-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }}.tar.gz
if-no-files-found: error
macos:
name: macOS ${{ matrix.arch }} ${{ matrix.build_type }} (${{ matrix.portable}})
runs-on: macos-12
strategy:
fail-fast: false
matrix:
arch: [x86_64]
build_type: [Debug, Release]
portable: [Non-Portable]
steps:
- uses: actions/checkout@v3
- name: Create Build Environment
run: |
brew install zlib libjpeg libpng sdl2
cmake -E make_directory ${{ github.workspace }}/build
- name: Configure CMake
shell: bash
working-directory: ${{ github.workspace }}/build
run: |
OPTIONS="-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/install"
if [ "${{ matrix.portable }}" == "Portable" ]; then
OPTIONS+=" -DUseInternalLibs=ON -DBuildPortableVersion=ON"
else
OPTIONS+=" -DUseInternalLibs=OFF -DBuildPortableVersion=OFF"
fi
OPTIONS+=" -DBuildJK2SPEngine=ON -DBuildJK2SPGame=ON -DBuildJK2SPRdVanilla=ON"
cmake $GITHUB_WORKSPACE $OPTIONS
- name: Build
working-directory: ${{ github.workspace }}/build
shell: bash
run: cmake --build . -j $(getconf _NPROCESSORS_ONLN)
- name: Install
if: ${{ matrix.build_type == 'Release' }}
working-directory: ${{ github.workspace }}/build
shell: bash
run: cmake --install .
- name: Create OpenJK binary archive
if: ${{ matrix.build_type == 'Release' }}
working-directory: ${{ github.workspace }}/install/JediAcademy
shell: bash
run: |
chmod +x openjk.x86_64.app/Contents/MacOS/openjk.x86_64
tar -czvf openjk-macos-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }}.tar.gz *
- name: Create OpenJO binary archive
if: ${{ matrix.build_type == 'Release' }}
working-directory: ${{ github.workspace }}/install/JediOutcast
shell: bash
run: |
chmod +x openjo_sp.x86_64.app/Contents/MacOS/openjo_sp.x86_64
tar -czvf openjo_sp-macos-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }}.tar.gz *
- uses: actions/upload-artifact@v3
if: ${{ matrix.build_type == 'Release' }}
with:
name: OpenJK-macos-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }}
path: ${{ github.workspace }}/install/JediAcademy/openjk-macos-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }}.tar.gz
if-no-files-found: error
- uses: actions/upload-artifact@v3
if: ${{ matrix.build_type == 'Release' }}
with:
name: OpenJO-macos-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }}
path: ${{ github.workspace }}/install/JediOutcast/openjo_sp-macos-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }}.tar.gz
if-no-files-found: error
create-latest:
if: github.event_name == 'workflow_dispatch'
needs: [msvc, ubuntu, macos]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Download Artifacts
uses: actions/download-artifact@v3
- name: Create binary archives
run: |
7z a -r OpenJK-rend2-windows-x86.zip ./OpenJK-windows-x86-Release-Non-Portable/* '-x!msvcp*.*' '-x!vcruntime*.*' '-x!concrt*.*'
7z a -r OpenJK-rend2-windows-x86_64.zip ./OpenJK-windows-x86_64-Release-Non-Portable/* '-x!msvcp*.*' '-x!vcruntime*.*' '-x!concrt*.*'
mv ./OpenJK-linux-x86-Release-Non-Portable/* OpenJK-rend2-linux-x86.tar.gz
mv ./OpenJK-linux-x86_64-Release-Non-Portable/* OpenJK-rend2-linux-x86_64.tar.gz
mv ./OpenJK-macos-x86_64-Release-Non-Portable/* OpenJK-rend2-macos-x86_64.tar.gz
7z a -r OpenJO-rend2-windows-x86.zip ./OpenJO-windows-x86-Release-Non-Portable/* '-x!msvcp*.*' '-x!vcruntime*.*' '-x!concrt*.*'
7z a -r OpenJO-rend2-windows-x86_64.zip ./OpenJO-windows-x86_64-Release-Non-Portable/* '-x!msvcp*.*' '-x!vcruntime*.*' '-x!concrt*.*'
mv ./OpenJO-linux-x86-Release-Non-Portable/* OpenJO-rend2-linux-x86.tar.gz
mv ./OpenJO-linux-x86_64-Release-Non-Portable/* OpenJO-rend2-linux-x86_64.tar.gz
mv ./OpenJO-macos-x86_64-Release-Non-Portable/* OpenJO-rend2-macos-x86_64.tar.gz
- name: Create latest build
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
automatic_release_tag: "latest"
prerelease: false
title: Latest rend2 builds
files: |
*.zip
*.tar.gz
create-release:
if: github.event_name == 'release'
needs: [msvc, ubuntu, macos]
runs-on: ubuntu-22.04
strategy:
matrix:
include:
- artifact_dir: OpenJK-windows-x86-Release-Non-Portable/JediAcademy
artifact_name: OpenJK-rend2-windows-x86.zip
zip: true
- artifact_dir: OpenJK-windows-x86_64-Release-Non-Portable/JediAcademy
artifact_name: OpenJK-rend2-windows-x86_64.zip
zip: true
- artifact_dir: OpenJK-linux-x86-Release-Non-Portable
artifact_name: OpenJK-rend2-linux-x86.tar.gz
zip: false
- artifact_dir: OpenJK-linux-x86_64-Release-Non-Portable
artifact_name: OpenJK-rend2-linux-x86_64.tar.gz
zip: false
- artifact_dir: OpenJK-macos-x86_64-Release-Non-Portable
artifact_name: OpenJK-rend2-macos-x86_64.tar.gz
zip: false
- artifact_dir: OpenJO-windows-x86-Release-Non-Portable/JediOutcast
artifact_name: OpenJO-rend2-windows-x86.zip
zip: true
- artifact_dir: OpenJO-windows-x86_64-Release-Non-Portable/JediOutcast
artifact_name: OpenJO-rend2-windows-x86_64.zip
zip: true
- artifact_dir: OpenJO-linux-x86-Release-Non-Portable
artifact_name: OpenJO-rend2-linux-x86.tar.gz
zip: false
- artifact_dir: OpenJO-linux-x86_64-Release-Non-Portable
artifact_name: OpenJO-rend2-linux-x86_64.tar.gz
zip: false
- artifact_dir: OpenJO-macos-x86_64-Release-Non-Portable
artifact_name: OpenJO-rend2-macos-x86_64.tar.gz
zip: false
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Download Artifacts
uses: actions/download-artifact@v3
- name: Create archive
run: |
if [ "${{ matrix.zip }}" == "true" ]; then
7z a -r ${{ matrix.artifact_name }} ./${{ matrix.artifact_dir }}/* '-x!msvcp*.*' '-x!vcruntime*.*' '-x!concrt*.*'
else
mv ./${{ matrix.artifact_dir }}/* ${{ matrix.artifact_name }}
fi
- name: Upload archives
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
overwrite: true
file: ${{ matrix.artifact_name }}