forked from mkxp-z/mkxp-z
-
Notifications
You must be signed in to change notification settings - Fork 0
485 lines (429 loc) · 18.1 KB
/
autobuild.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
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
# I have no idea what I'm doing
name: Automatic Build
on:
push:
branches: ['dev', 'autobuild', 'libretro']
paths-ignore: ['*.md', '*.json', '*.png']
pull_request:
branches: ['dev', 'autobuild', 'libretro']
paths-ignore: ['*.md', '*.json', '*.png']
workflow_dispatch:
jobs:
build-windows:
name: Windows
runs-on: windows-latest
steps:
- uses: benjlevesque/short-sha@v2.2
id: short-sha
with:
length: 7
- uses: msys2/setup-msys2@v2
with:
msystem: mingw64
# zip is just used for artifact compression at the end.
install: >-
base-devel
git
ruby
vim
mingw-w64-x86_64-cmake
mingw-w64-x86_64-meson
mingw-w64-x86_64-autotools
mingw-w64-x86_64-gcc
zip
- name: Checkout repository
uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
windows/build-mingw64
windows/downloads
key: win-${{ hashFiles('windows/Makefile') }}
- name: Build all dependencies
shell: msys2 {0}
run: |
cd windows
make
- name: Build exe
shell: msys2 {0}
run: |
source windows/vars.sh
meson setup build
cd build
ninja
strip ./mkxp-z.exe
- name: Prepare archive
shell: msys2 {0}
run: |
mkdir build/artifact
cd build/artifact
cp /mingw64/bin/zlib1.dll .
cp ../../windows/build-mingw64/bin/x64-msvcrt-ruby310.dll .
cp -r ../../windows/build-mingw64/lib/ruby/3.1.0 .
mv ./3.1.0 ./stdlib
cp ../mkxp-z.exe .
cp ../../mkxp.json .
cp -r ../../scripts .
cp ../../assets/LICENSE.mkxp-z-with-https.txt .
cd ..
# Zipping before uploading decreases the upload time considerably.
# Unfortunately this results in double-zipping; tracked at:
# https://github.com/actions/upload-artifact/issues/426
zip -r artifact.zip artifact
- uses: actions/upload-artifact@v3
with:
name: mkxp-z.windows.${{github.event_name == 'pull_request' && format('PR{0}', github.event.number) || github.ref_name}}-${{steps.short-sha.outputs.sha}}
path: build/artifact.zip
build-linux-native:
name: Ubuntu 22.04 x86_64
runs-on: ubuntu-22.04
steps:
- uses: benjlevesque/short-sha@v2.2
id: short-sha
with:
length: 7
- name: Checkout repository
uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
linux/build-x86_64
linux/downloads
key: lin-x86_64-${{ hashFiles('linux/Makefile') }}
- name: Install apt dependencies
run: |
sudo apt update
sudo apt install git build-essential cmake meson autoconf automake libtool pkg-config ruby bison zlib1g-dev libbz2-dev xorg-dev libgl1-mesa-dev libasound2-dev libpulse-dev -y
- name: Build everything else
run: |
cd linux
make
- name: Build executable
run: |
source linux/vars.sh
meson setup build --bindir=. --prefix=$GITHUB_WORKSPACE/build/local
cd build
ninja
ninja install
- name: Prepare archive
run: |
cd build/local
cp -r ../../linux/build-x86_64/lib/ruby/3.1.0 .
mv ./3.1.0 ./stdlib
cp ../../mkxp.json .
cp -r ../../scripts .
cp ../../assets/LICENSE.mkxp-z-with-https.txt .
cd ..
# Zipping before uploading preserves +x permissions.
# Unfortunately this results in double-zipping; tracked at:
# https://github.com/actions/upload-artifact/issues/426
zip -r local.zip local
- uses: actions/upload-artifact@v3
with:
name: mkxp-z.linux.x86_64.${{github.event_name == 'pull_request' && format('PR{0}', github.event.number) || github.ref_name}}-${{steps.short-sha.outputs.sha}}
path: build/local.zip
build-linux-cross:
name: Ubuntu 22.04 ${{matrix.arch_mkxpz}}
runs-on: ubuntu-22.04
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
matrix:
include:
- arch_mkxpz: armv6
arch_debian: armhf
arch_gcc: arm-linux-gnueabihf
experimental: false
- arch_mkxpz: armv7
arch_debian: armhf
arch_gcc: arm-linux-gnueabihf
experimental: false
- arch_mkxpz: armv7-neon
arch_debian: armhf
arch_gcc: arm-linux-gnueabihf
experimental: false
- arch_mkxpz: arm64
arch_debian: arm64
arch_gcc: aarch64-linux-gnu
experimental: false
- arch_mkxpz: power8le
arch_debian: ppc64el
arch_gcc: powerpc64le-linux-gnu
experimental: false
- arch_mkxpz: power9le
arch_debian: ppc64el
arch_gcc: powerpc64le-linux-gnu
experimental: false
- arch_mkxpz: s390x
arch_debian: s390x
arch_gcc: s390x-linux-gnu
# src/util/serial-util.h errors on big-endian targets.
experimental: true
- arch_mkxpz: riscv64
arch_debian: riscv64
arch_gcc: riscv64-linux-gnu
# libjxl/highway compatibility issue, TODO check if fixed in later SDL_image.
# Also probably an OpenSSL arch name issue, which might be fixed by now.
experimental: true
steps:
- uses: benjlevesque/short-sha@v2.2
id: short-sha
with:
length: 7
- name: Checkout repository
uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
linux/build-${{matrix.arch_mkxpz}}
linux/downloads
key: lin-${{matrix.arch_mkxpz}}-${{ hashFiles('linux/Makefile', 'linux/target*', 'linux/toolchain*') }}
- name: Install apt dependencies
run: |
sudo sed -i "s/deb /deb [arch=amd64] /g" /etc/apt/sources.list
sudo dpkg --add-architecture ${{matrix.arch_debian}}
echo "deb [arch=${{matrix.arch_debian}}] http://ports.ubuntu.com/ jammy main restricted" | sudo tee -a /etc/apt/sources.list
echo "deb [arch=${{matrix.arch_debian}}] http://ports.ubuntu.com/ jammy-updates main restricted" | sudo tee -a /etc/apt/sources.list
echo "deb [arch=${{matrix.arch_debian}}] http://ports.ubuntu.com/ jammy universe" | sudo tee -a /etc/apt/sources.list
echo "deb [arch=${{matrix.arch_debian}}] http://ports.ubuntu.com/ jammy-updates universe" | sudo tee -a /etc/apt/sources.list
echo "deb [arch=${{matrix.arch_debian}}] http://ports.ubuntu.com/ jammy multiverse" | sudo tee -a /etc/apt/sources.list
echo "deb [arch=${{matrix.arch_debian}}] http://ports.ubuntu.com/ jammy-updates multiverse" | sudo tee -a /etc/apt/sources.list
echo "deb [arch=${{matrix.arch_debian}}] http://ports.ubuntu.com/ jammy-backports main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list
sudo apt update
sudo apt install git build-essential cmake meson autoconf automake libtool pkg-config ruby bison -y
sudo apt install libdmx-dev:${{matrix.arch_debian}} libfontenc-dev:${{matrix.arch_debian}} libfs-dev:${{matrix.arch_debian}} libice-dev:${{matrix.arch_debian}} libsm-dev:${{matrix.arch_debian}} libx11-dev:${{matrix.arch_debian}} libxau-dev:${{matrix.arch_debian}} libxaw7-dev:${{matrix.arch_debian}} libxcomposite-dev:${{matrix.arch_debian}} libxcursor-dev:${{matrix.arch_debian}} libxdamage-dev:${{matrix.arch_debian}} libxdmcp-dev:${{matrix.arch_debian}} libxext-dev:${{matrix.arch_debian}} libxfixes-dev:${{matrix.arch_debian}} libxfont-dev:${{matrix.arch_debian}} libxft-dev:${{matrix.arch_debian}} libxi-dev:${{matrix.arch_debian}} libxinerama-dev:${{matrix.arch_debian}} libxkbfile-dev:${{matrix.arch_debian}} libxmu-dev:${{matrix.arch_debian}} libxmuu-dev:${{matrix.arch_debian}} libxpm-dev:${{matrix.arch_debian}} libxrandr-dev:${{matrix.arch_debian}} libxrender-dev:${{matrix.arch_debian}} libxres-dev:${{matrix.arch_debian}} libxss-dev:${{matrix.arch_debian}} libxt-dev:${{matrix.arch_debian}} libxtst-dev:${{matrix.arch_debian}} libxv-dev:${{matrix.arch_debian}} libxvmc-dev:${{matrix.arch_debian}} libxxf86dga-dev:${{matrix.arch_debian}} libxxf86vm-dev:${{matrix.arch_debian}} x11proto-dev:${{matrix.arch_debian}} xserver-xorg-dev:${{matrix.arch_debian}} xtrans-dev:${{matrix.arch_debian}} -y
sudo apt install gcc-${{matrix.arch_gcc}} g++-${{matrix.arch_gcc}} zlib1g-dev:${{matrix.arch_debian}} libbz2-dev:${{matrix.arch_debian}} libgl1-mesa-dev:${{matrix.arch_debian}} libasound2-dev:${{matrix.arch_debian}} libpulse-dev:${{matrix.arch_debian}} -y
- name: Build everything else
run: |
cd linux
source target-${{matrix.arch_mkxpz}}.sh
make
- name: Build executable
run: |
source linux/target-${{matrix.arch_mkxpz}}.sh
source linux/vars.sh
meson setup --cross-file linux/$ARCH_MESON_TOOLCHAIN build --bindir=. --prefix=$GITHUB_WORKSPACE/build/local
cd build
ninja
ninja install
cp "$MKXPZ_PREFIX/lib/$("$ARCH_CONFIGURE-objdump" -p local/mkxp-z* | grep -i NEEDED | grep -Eo 'libruby.so.[0-9\.]+')" local/lib*/
cp "/usr/lib/$ARCH_CONFIGURE/$("$ARCH_CONFIGURE-objdump" -p local/lib*/libruby.so* | grep -i NEEDED | grep -Eo 'libcrypt.so.[0-9\.]+')" local/lib*/
- name: Prepare archive
run: |
cd build/local
cp -r ../../linux/build-${{matrix.arch_mkxpz}}/lib/ruby/3.1.0 .
mv ./3.1.0 ./stdlib
cp ../../mkxp.json .
cp -r ../../scripts .
cp ../../assets/LICENSE.mkxp-z-with-https.txt .
cd ..
zip -r local.zip local
- uses: actions/upload-artifact@v3
with:
name: mkxp-z.linux.${{matrix.arch_mkxpz}}.${{github.event_name == 'pull_request' && format('PR{0}', github.event.number) || github.ref_name}}-${{steps.short-sha.outputs.sha}}
path: build/local.zip
build-macos:
name: macOS
runs-on: macos-latest
steps:
- uses: benjlevesque/short-sha@v2.2
id: short-sha
with:
length: 7
- name: Remove pre-existing homebrew packages
run: brew remove --force $(brew list)
- name: Checkout repository
uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
macos/Dependencies/build-macosx-x86_64
macos/Dependencies/build-macosx-arm64
macos/Dependencies/build-macosx-universal
macos/Dependencies/downloads
key: mac-${{ hashFiles('macos/Dependencies/*.make', 'macos/Dependencies/*.sh') }}
- name: Install Homebrew tools
run: |
cd macos/Dependencies
brew bundle
- name: Build all dependencies
run: |
cd macos/Dependencies
./setup.sh
- name: Build app
run: |
cd macos
xcodebuild -project mkxp-z.xcodeproj -configuration "Release" -scheme "Universal" -derivedDataPath "$GITHUB_WORKSPACE/build"
- name: Compress app
run: |
cd build/Build/Products/Release
cp ../../../../assets/LICENSE.mkxp-z-with-https.txt ./Z-universal.app/
ditto -c -k --sequesterRsrc --keepParent Z-universal.app Z-universal.app.zip
- name: Upload archive
uses: actions/upload-artifact@v3
with:
name: mkxp-z.macos.${{github.event_name == 'pull_request' && format('PR{0}', github.event.number) || github.ref_name}}-${{steps.short-sha.outputs.sha}}
path: build/Build/Products/Release/Z-universal.app.zip
build-retro-phase1:
name: Libretro phase 1
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
retro/build
key: retro-phase1-${{ hashFiles('retro/Makefile', 'retro/extra-ruby-bindings.h') }}
- name: Install apt dependencies
run: |
sudo apt update
sudo apt install git curl build-essential automake libtool binaryen wabt zip -y
- name: Download WASI SDK
run: |
curl -Lo ${{ runner.temp }}/wasi-sdk.tar.gz https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-21/wasi-sdk-21.0-linux.tar.gz
mkdir ${{ runner.temp }}/wasi-sdk
tar xzf ${{ runner.temp }}/wasi-sdk.tar.gz -C ${{ runner.temp }}/wasi-sdk --strip-components=1
rm ${{ runner.temp }}/wasi-sdk.tar.gz
- name: Build phase 1
run: |
cd retro
make WASI_SDK=${{ runner.temp }}/wasi-sdk
- uses: actions/upload-artifact@v4
with:
name: retro-phase1
path: retro/build/retro-phase1
build-retro-phase2-windows:
needs: build-retro-phase1
name: Libretro Windows
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: retro-phase1
path: retro/build/retro-phase1
- uses: msys2/setup-msys2@v2
with:
msystem: mingw64
install: base-devel git mingw-w64-x86_64-gcc mingw-w64-x86_64-meson mingw-w64-x86_64-cmake
- name: Build phase 2
shell: msys2 {0}
run: |
runner_temp="$(cygpath '${{ runner.temp }}')"
mkdir "$runner_temp"/retro-phase2
cp retro/core.info "$runner_temp"/retro-phase2/libretro-mkxp-z.info
meson setup build -Dretro=true -Dretro_phase1_path=retro/build/retro-phase1
cd build
ninja -v
mv libretro-mkxp-z.dll "$runner_temp"/retro-phase2
- uses: actions/upload-artifact@v4
with:
name: libretro-mkxp-z.windows
path: ${{ runner.temp }}/retro-phase2
build-retro-phase2-linux:
needs: build-retro-phase1
name: Libretro Linux ${{ matrix.arch_mkxpz }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- arch_mkxpz: x86_64
arch_debian: amd64
arch_gcc: x86_64-linux-gnu
- arch_mkxpz: armv6
arch_debian: armhf
arch_gcc: arm-linux-gnueabihf
- arch_mkxpz: armv7
arch_debian: armhf
arch_gcc: arm-linux-gnueabihf
- arch_mkxpz: armv7-neon
arch_debian: armhf
arch_gcc: arm-linux-gnueabihf
- arch_mkxpz: arm64
arch_debian: arm64
arch_gcc: aarch64-linux-gnu
- arch_mkxpz: power8le
arch_debian: ppc64el
arch_gcc: powerpc64le-linux-gnu
- arch_mkxpz: power9le
arch_debian: ppc64el
arch_gcc: powerpc64le-linux-gnu
- arch_mkxpz: s390x
arch_debian: s390x
arch_gcc: s390x-linux-gnu
- arch_mkxpz: riscv64
arch_debian: riscv64
arch_gcc: riscv64-linux-gnu
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: retro-phase1
path: retro/build/retro-phase1
- name: Install apt dependencies
run: |
if [ '${{ matrix.arch_mkxpz }}' != 'x86_64' ]
then
codename=$(grep VERSION_CODENAME /etc/os-release | cut -f 2 -d '=')
sudo sed -i 's/^Types: deb$/Types: deb\nArchitectures: amd64/g' /etc/apt/sources.list.d/ubuntu.sources
sudo dpkg --add-architecture ${{ matrix.arch_debian }}
echo 'Types: deb' | sudo tee -a /etc/apt/sources.list.d/ubuntu.sources
echo "Architectures: ${{ matrix.arch_debian }}" | sudo tee -a /etc/apt/sources.list.d/ubuntu.sources
echo 'URIs: http://ports.ubuntu.com/' | sudo tee -a /etc/apt/sources.list.d/ubuntu.sources
echo "Suites: $codename $codename-updates" | sudo tee -a /etc/apt/sources.list.d/ubuntu.sources
echo 'Components: main universe' | sudo tee -a /etc/apt/sources.list.d/ubuntu.sources
fi
sudo apt update
sudo apt install git build-essential meson cmake -y
if [ '${{ matrix.arch_mkxpz }}' != 'x86_64' ]
then
sudo apt install gcc-${{ matrix.arch_gcc }} g++-${{ matrix.arch_gcc }} -y
fi
- name: Build phase 2
run: |
mkdir ${{ runner.temp }}/retro-phase2
cp retro/core.info ${{ runner.temp }}/retro-phase2/libretro-mkxp-z.info
if [ '${{ matrix.arch_mkxpz }}' != 'x86_64' ]
then
cross_arg='--cross-file linux/meson-${{ matrix.arch_mkxpz }}.txt'
else
cross_arg=
fi
meson setup build $cross_arg -Dretro=true -Dretro_phase1_path=retro/build/retro-phase1
cd build
ninja -v
mv libretro-mkxp-z.so ${{ runner.temp }}/retro-phase2
- uses: actions/upload-artifact@v4
with:
name: libretro-mkxp-z.linux.${{ matrix.arch_mkxpz }}
path: ${{ runner.temp }}/retro-phase2
build-retro-phase2-macos:
needs: build-retro-phase1
name: Libretro macOS
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: retro-phase1
path: retro/build/retro-phase1
- name: Install dependencies
run: |
brew install -q git gpatch meson cmake
- name: Build phase 2
run: |
mkdir ${{ runner.temp }}/retro-phase2
cp retro/core.info ${{ runner.temp }}/retro-phase2/libretro-mkxp-z.info
PATH="$HOMEBREW_PREFIX/opt/gpatch/libexec/gnubin:$PATH" meson setup build -Dretro=true -Dretro_phase1_path=retro/build/retro-phase1
cd build
ninja -v
mv libretro-mkxp-z.dylib ${{ runner.temp }}/retro-phase2
- uses: actions/upload-artifact@v4
with:
name: libretro-mkxp-z.macos
path: ${{ runner.temp }}/retro-phase2