-
Notifications
You must be signed in to change notification settings - Fork 8
378 lines (367 loc) · 13.3 KB
/
build.yaml
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
name: build
on:
push:
tags-ignore:
- switch-portlibs
- mingw-packages
- macos-dylib
paths-ignore:
- scripts/mingw64/*/*
- scripts/switch/*/*
- scripts/l4t/*
- images/*
- CHANGELOG.md
- README.md
branches: [ dev ]
pull_request:
paths-ignore:
- scripts/mingw64/*/*
- scripts/switch/*/*
branches: [ dev ]
workflow_dispatch:
inputs:
nx:
description: build nintendo switch
type: boolean
ps4:
description: build playstation 4
type: boolean
macos:
description: build macos dmg
type: boolean
arm_flatpak:
description: build flatpak (aarch64)
type: boolean
deb:
description: build ubuntu deb
type: boolean
mingw64:
description: build win64 mingw64
type: boolean
msvc:
description: build win64 msvc
type: boolean
permissions:
contents: write
jobs:
upload-release:
needs: [ build-mingw, build-nx, build-macos, build-flatpak ]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download Assets
uses: actions/download-artifact@v4
- name: Package Assets
run: |
for p in Switchfin-windows-*; do
[[ -d $p ]] && 7z a -mx=9 $p.7z ./$p/*
done
- name: Release and Upload Assets
uses: softprops/action-gh-release@v2
with:
name: Switchfin ${{ github.ref_name }}
tag_name: ${{ github.ref_name }}
generate_release_notes: true
draft: true
files: |
Switchfin-windows-*.7z
Switchfin-macos-*/*.dmg
Switchfin-deko3d-*/*.nro
Switchfin-linux-*/*.flatpak
body: |

build-nx:
runs-on: ubuntu-latest
if: ${{ inputs.nx || github.event_name != 'workflow_dispatch' }}
strategy:
fail-fast: false
matrix:
include:
- { driver: opengl }
- { driver: deko3d, cmake: "-DUSE_DEKO3D=ON" }
driver: [opengl, deko3d]
container:
image: devkitpro/devkita64:20240324
env:
BASE_URL: https://github.com/dragonflylee/switchfin/releases/download/switch-portlibs
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set workspace permissions
run: |
chown $(id -u):$(id -g) -R "$GITHUB_WORKSPACE"
git config --system --add safe.directory '*'
- name: Update dependencies
run: |
dkp-pacman --noconfirm -U $BASE_URL/hacBrewPack-3.05-1-any.pkg.tar.zst
dkp-pacman --noconfirm -U $BASE_URL/libnx-4.7.0-1-any.pkg.tar.zst
for pkg in curl-8.7.1-1 libass-0.17.2-1 dav1d-1.4.3-1 ffmpeg-7.0.1-1 nspmini-main-1; do
dkp-pacman --noconfirm -U $BASE_URL/switch-${pkg}-any.pkg.tar.zst
done
dkp-pacman --noconfirm -R switch-libmpv
- name: Update mpv opengl
if: ${{ matrix.driver == 'opengl' }}
run: |
for pkg in switch-libmpv-0.36.0-5; do
dkp-pacman --noconfirm -U $BASE_URL/${pkg}-any.pkg.tar.zst
done
- name: Update mpv deko3d
if: ${{ matrix.driver == 'deko3d' }}
run: |
for pkg in libuam-master-1 switch-libmpv-deko3d-0.36.0-6; do
dkp-pacman --noconfirm -U $BASE_URL/${pkg}-any.pkg.tar.zst
done
- name: Build nro
run: |
cp /etc/ssl/certs/ca-certificates.crt resources/ca-bundle.crt
cmake -B build_switch -DCMAKE_BUILD_TYPE=Release -DPLATFORM_SWITCH=ON -DBUILTIN_NSP=ON -DVERSION_BUILD=${{ github.run_number }} ${{ matrix.cmake }}
make -C build_switch Switchfin.nro -j$(nproc)
- name: Set outputs
id: vars
run: echo "sha_short=${{ matrix.driver }}-$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Upload Assets
uses: actions/upload-artifact@v4
with:
name: Switchfin-${{ steps.vars.outputs.sha_short }}
path: |
build_switch/Switchfin.nro
build_switch/Switchfin.elf
build-ps4:
runs-on: ubuntu-latest
if: ${{ inputs.ps4 || github.event_name != 'workflow_dispatch' }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Build
run: |
docker run --rm -v $(pwd):/src -u $(id -u):$(id -g) xfangfang/wiliwili_ps4_builder \
"cmake -B build_ps4 -DPLATFORM_PS4=ON -DVERSION_BUILD=${{ github.run_number }} && \
make -C build_ps4 -j$(nproc)"
- name: Set outputs
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Upload Assets
uses: actions/upload-artifact@v4
with:
name: Switchfin-ps4-${{ steps.vars.outputs.sha_short }}
path: |
build_ps4/Switchfin.oelf
build_ps4/*.pkg
build-flatpak:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
arch: [ x86_64, aarch64 ]
container:
image: bilelmoussaoui/flatpak-github-actions:freedesktop-22.08
options: --privileged
if: ${{ inputs.arm_flatpak || github.event_name != 'workflow_dispatch' }}
steps:
- uses: actions/checkout@v4
if: ${{ matrix.arch == 'x86_64' || (matrix.arch == 'aarch64' && inputs.arm_flatpak) }}
with:
submodules: recursive
- name: Install docker
if: ${{ matrix.arch == 'aarch64' && inputs.arm_flatpak }}
run: dnf -y install docker
- name: Set up QEMU
if: ${{ matrix.arch == 'aarch64' && inputs.arm_flatpak }}
uses: docker/setup-qemu-action@v3
- name: Set workspace permissions
run: git config --system --add safe.directory '*'
- name: Set outputs
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- uses: flatpak/flatpak-github-actions/flatpak-builder@v6
if: ${{ matrix.arch == 'x86_64' || (matrix.arch == 'aarch64' && inputs.arm_flatpak) }}
with:
bundle: Switchfin-linux-${{ steps.vars.outputs.sha_short }}.flatpak
manifest-path: scripts/flatpak.yaml
cache-key: flatpak-builder-${{ hashFiles('scripts/flatpak.yaml') }}
verbose: true
arch: ${{ matrix.arch }}
build-deb:
strategy:
fail-fast: false
matrix:
release: [ switchroot-bionic, ubuntu-focal, kylin-v10 ]
runs-on: ubuntu-latest
if: ${{ inputs.deb }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up QEMU
if: ${{ matrix.release != 'ubuntu-focal' }}
uses: docker/setup-qemu-action@v3
- name: Download deps
run: curl -sSL https://github.com/dragonflylee/switchfin/releases/download/switch-portlibs/${{ matrix.release }}.tar.gz | tar zxf -
- name: Build deb
run: docker run --rm -u $(id -u):$(id -g) -v $PWD:/opt -w /opt -e VERSION_BUILD=${{ github.run_number }} dragonflylee/build:${{ matrix.release }} bash scripts/deb/${{ matrix.release }}/build.sh
- name: Set outputs
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Upload Assets
uses: actions/upload-artifact@v4
with:
name: Switchfin-${{ matrix.release }}-${{ steps.vars.outputs.sha_short }}
path: Switchfin-*.deb
build-macos:
runs-on: macos-12
if: ${{ inputs.macos || github.event_name != 'workflow_dispatch' }}
strategy:
fail-fast: false
matrix:
include:
- tag: Silicon
arch: arm64
target: "11.0"
- tag: Intel
arch: x86_64
target: "10.11"
cmake: -DUSE_BOOST_FILESYSTEM=ON
tag: [ Silicon, Intel ]
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install deps
run: |
brew install create-dmg dylibbundler
curl -sSL https://github.com/dragonflylee/switchfin/releases/download/macos-dylib/dylib-ffmpeg7-mpv36-${{ matrix.tag }}.tar.gz | tar zxf - -C /tmp
- name: Build App
env:
DYLD_LIBRARY_PATH: /tmp/lib
run: |
cmake -B build ${{ matrix.cmake }} \
-DCMAKE_PREFIX_PATH=/tmp \
-DCMAKE_BUILD_TYPE=Release \
-DPLATFORM_DESKTOP=ON \
-DUSE_SYSTEM_GLFW=ON \
-DCMAKE_OSX_ARCHITECTURES=${{ matrix.arch }} \
-DCMAKE_OSX_DEPLOYMENT_TARGET=${{ matrix.target }} \
-DVERSION_BUILD=${{ github.run_number }}
make -C build -j$(sysctl -n hw.ncpu)
- name: Create DMG
run: |
mkdir -p dist
mv build/Switchfin.app dist/
cp README.md dist
create-dmg --window-pos 200 120 --window-size 800 400 \
--icon-size 100 --icon "Switchfin.app" 200 190 \
--icon "README.md" 400 100 --hide-extension "Switchfin.app" \
--app-drop-link 600 185 --volicon ./scripts/macos/dmg.icns \
--volname "Switchfin" Switchfin-macOS-${{ matrix.tag }}.dmg "dist/"
- name: Set outputs
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Upload Assets
uses: actions/upload-artifact@v4
with:
name: Switchfin-macos-${{ matrix.tag }}-${{ steps.vars.outputs.sha_short }}
path: Switchfin-*.dmg
build-mingw:
if: ${{ inputs.mingw64 == true || github.event_name != 'workflow_dispatch'}}
strategy:
fail-fast: false
matrix:
include:
- { arch: x64, driver: d3d11, msystem: MINGW64, cmake: "-DUSE_D3D11=ON" }
- { arch: x86, driver: opengl, msystem: MINGW32, cmake: "-DUSE_GL2=ON" }
arch: [ x64, x86 ]
runs-on: windows-latest
env:
MSYSTEM: ${{ matrix.msystem }}
MSYS2_PATH_TYPE: inherit
defaults:
run:
shell: C:\shells\msys2bash.cmd {0}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install dependency
run: |
for pkg in glfw-3.5.0-1 curl-8.7.1-1 mpv-0.36.0-4 libwebp-1.4.0-1; do
curl -sLO https://github.com/dragonflylee/switchfin/releases/download/mingw-packages/${MINGW_PACKAGE_PREFIX}-${pkg}-any.pkg.tar.zst
done
pacman -U --noconfirm *.pkg.tar.zst
pacman -S --needed --noconfirm \
${MINGW_PACKAGE_PREFIX}-cc \
${MINGW_PACKAGE_PREFIX}-ninja unzip
curl -sLO https://github.com/rainers/cv2pdb/releases/download/v0.52/cv2pdb-0.52.zip
unzip cv2pdb-0.52.zip cv2pdb64.exe -d /usr/bin
- if: matrix.arch == 'x86'
name: Config Editbin
shell: powershell
run: |
$vcvarsall_path = vswhere.exe -latest -products * -find "VC\Auxiliary\Build\vcvarsall.bat"
$cc1_path = Get-ChildItem -Path "C:\msys64\mingw32\lib\gcc" -Filter cc1plus.exe -Recurse -ErrorAction SilentlyContinue | ForEach-Object { $_.FullName }
cmd.exe /c "call ""$vcvarsall_path"" x86_amd64 && editbin /LARGEADDRESSAWARE $cc1_path"
- name: Build
run: |
cmake -B build_mingw -G Ninja \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DPLATFORM_DESKTOP=ON \
-DWIN32_TERMINAL=OFF \
-DZLIB_USE_STATIC_LIBS=ON \
-DUSE_SYSTEM_GLFW=ON \
-DUSE_LIBROMFS=ON \
-DVERSION_BUILD=${{ github.run_number }} ${{ matrix.cmake }}
cmake --build build_mingw
cv2pdb64 build_mingw/Switchfin.exe
cp -a README.md ${MINGW_PREFIX}/bin/libmpv-2.dll build_mingw
- name: Set outputs
id: vars
run: echo "sha_short=${{ matrix.arch }}-$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Upload Assets
uses: actions/upload-artifact@v4
with:
name: Switchfin-windows-${{ steps.vars.outputs.sha_short }}
path: |
build_mingw/Switchfin.exe
build_mingw/Switchfin.pdb
build_mingw/libmpv-2.dll
build_mingw/README.md
build-msvc:
runs-on: windows-latest
if: ${{ inputs.msvc }}
strategy:
fail-fast: false
matrix:
arch: [ x64 ]
steps:
- name: Install xmake
shell: powershell
run: |
Invoke-Expression (Invoke-Webrequest 'https://xmake.io/psget.text' -UseBasicParsing).Content
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Cache xmake packages
uses: actions/cache@v3
with:
key: ${{ runner.os }}-{{ matrix.arch }}-xmake
path: |
${{ runner.temp }}/.xmake/packages
- name: Build
shell: powershell
run: |
$env:path+=";$env:USERPROFILE\xmake"
$env:XMAKE_GLOBALDIR="${{ runner.temp }}"
xmake config -c -y -a ${{ matrix.arch }}
xmake build -y
cd build\windows\${{ matrix.arch }}\release
7z a -mx=9 "$env:GITHUB_WORKSPACE\Switchfin-${{ matrix.arch }}-msvc.7z" *
- name: Set outputs
id: vars
shell: bash
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Upload Assets
uses: actions/upload-artifact@v4
with:
name: Switchfin-msvc-${{ matrix.arch }}-${{ steps.vars.outputs.sha_short }}
path: Switchfin-*.7z