-
Notifications
You must be signed in to change notification settings - Fork 161
330 lines (300 loc) · 11.9 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
name: Build wiliwili
on:
push:
branches:
- yoga
- dev
pull_request:
workflow_dispatch:
inputs:
ssh_darwin:
description: 'SSH connection to Darwin'
required: false
default: 'false'
ssh_ubuntu:
description: 'SSH connection to Ubuntu'
required: false
default: 'false'
release:
description: 'Push a new release'
required: false
default: 'false'
version:
description: 'Version'
required: false
default: '0.0.0'
jobs:
version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.info.outputs.version }}
standard_version: ${{ steps.info.outputs.standard_version }}
DIST_EXE: ${{ steps.info.outputs.DIST_EXE }}
DIST_UWP: ${{ steps.info.outputs.DIST_UWP }}
DIST_NRO: ${{ steps.info.outputs.DIST_NRO }}
DIST_DMG_PREFIX: ${{ steps.info.outputs.DIST_DMG_PREFIX }}
DIST_INTEL_DMG: ${{ steps.info.outputs.DIST_INTEL_DMG }}
DIST_ARM_DMG: ${{ steps.info.outputs.DIST_ARM_DMG }}
DIST_UNIVERSAL_DMG: ${{ steps.info.outputs.DIST_UNIVERSAL_DMG }}
DIST_FLATPAK_X86_64: ${{ steps.info.outputs.DIST_FLATPAK_X86_64 }}
DIST_FLATPAK_AARCH64: ${{ steps.info.outputs.DIST_FLATPAK_AARCH64 }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
repository: ${{ github.repository }}
- name: Debug version
run: |
export VERSION=`git rev-parse --short HEAD`
echo "VERSION=${VERSION}" >> $GITHUB_ENV
- name: Release version
if: github.event.inputs.release == 'true' && github.event.inputs.release != 'false' && !cancelled()
run: |
export VERSION="${{ github.event.inputs.version }}"
echo "VERSION=${VERSION}" >> $GITHUB_ENV
- name: Version
id: info
env:
VERSION: ${{ env.VERSION }}
run: |
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "DIST_EXE=wiliwili-Windows-x64-${VERSION}" >> $GITHUB_OUTPUT
echo "DIST_UWP=wiliwili-windows-x64-uwp-${VERSION}" >> $GITHUB_OUTPUT
echo "DIST_NRO=wiliwili-NintendoSwitch-${VERSION}" >> $GITHUB_OUTPUT
echo "DIST_DMG_PREFIX=wiliwili-macOS" >> $GITHUB_OUTPUT
echo "DIST_INTEL_DMG=wiliwili-macOS-IntelChip-${VERSION}" >> $GITHUB_OUTPUT
echo "DIST_ARM_DMG=wiliwili-macOS-AppleSilicon-${VERSION}" >> $GITHUB_OUTPUT
echo "DIST_UNIVERSAL_DMG=wiliwili-macOS-Universal-${VERSION}" >> $GITHUB_OUTPUT
echo "DIST_FLATPAK_X86_64=wiliwili-Linux-${VERSION}-x86_64" >> $GITHUB_OUTPUT
echo "DIST_FLATPAK_AARCH64=wiliwili-Linux-${VERSION}-aarch64" >> $GITHUB_OUTPUT
echo $VERSION
echo "${{ github.event.inputs.version }}"
release:
needs: [ build-win-x64, build-switch, build-macos, build-flatpak, version ]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
- name: Rename Flatpak
run: |
mv ${{ needs.version.outputs.DIST_FLATPAK_X86_64 }}/wiliwili-Linux-${{ needs.version.outputs.version }}.flatpak \
${{ needs.version.outputs.DIST_FLATPAK_X86_64 }}/${{ needs.version.outputs.DIST_FLATPAK_X86_64 }}.flatpak
- name: Upload Release
if: github.event.inputs.release == 'true' && !cancelled()
uses: ncipollo/release-action@v1
with:
name: wiliwili ${{ github.event.inputs.version }}
tag: ${{ github.event.inputs.version }}
omitBodyDuringUpdate: true
body: This release is built by github-action.
token: ${{ secrets.GITHUB_TOKEN }}
allowUpdates: true
artifacts: >
${{ needs.version.outputs.DIST_EXE }}/${{ needs.version.outputs.DIST_EXE }}.tar.gz
${{ needs.version.outputs.DIST_NRO }}/${{ needs.version.outputs.DIST_NRO }}.tar.gz
${{ needs.version.outputs.DIST_INTEL_DMG }}/${{ needs.version.outputs.DIST_INTEL_DMG }}.dmg
${{ needs.version.outputs.DIST_ARM_DMG }}/${{ needs.version.outputs.DIST_ARM_DMG }}.dmg
${{ needs.version.outputs.DIST_UNIVERSAL_DMG }}/${{ needs.version.outputs.DIST_UNIVERSAL_DMG }}.dmg
${{ needs.version.outputs.DIST_FLATPAK_X86_64 }}/${{ needs.version.outputs.DIST_FLATPAK_X86_64 }}.flatpak
build-win-x64:
needs: [ version ]
runs-on: windows-2022
steps:
- name: Checkout
uses: actions/checkout@v3
with:
repository: ${{ github.repository }}
submodules: 'recursive'
fetch-depth: 0
- name: Update gamepad db
run: |
cmake -P library/borealis/library/lib/extern/glfw//CMake/GenerateMappings.cmake library/borealis/library/lib/extern/glfw//src/mappings.h.in library/borealis/library/lib/extern/glfw//src/mappings.h
- name: Install dependency
uses: msys2/setup-msys2@v2
with:
update: true
install: >-
mingw-w64-x86_64-gcc
mingw-w64-x86_64-cmake
mingw-w64-x86_64-make
mingw-w64-x86_64-mpv
mingw-w64-x86_64-libwebp
git
p7zip
- name: Build
shell: msys2 {0}
id: compile
run: |
mkdir -p build && pushd build
cmake .. -G "MinGW Makefiles" -DPLATFORM_DESKTOP=ON -DWIN32_TERMINAL=OFF -DCMAKE_BUILD_TYPE=Release
mingw32-make wiliwili -j4
strip wiliwili.exe
mkdir wiliwili && mv wiliwili.exe wiliwili && mv resources wiliwili
for i in {libwinpthread-1,libgcc_s_seh-1,zlib1,libssh2-1,libstdc++-6,libcrypto-3-x64,libwebp-7,libsharpyuv-0}; do
cp /mingw64/bin/${i}.dll wiliwili
done
wget https://github.com/xfangfang/wiliwili/releases/download/v0.1.0/mpv-dev-x86_64-20221204-git-4574dd5.7z -O mpv.7z
7z e mpv.7z -ompv
cp mpv/mpv-2.dll wiliwili/libmpv-2.dll
tar -czvf ../${{ needs.version.outputs.DIST_EXE }}.tar.gz wiliwili
- name: Upload dist
uses: actions/upload-artifact@v3
with:
name: ${{ needs.version.outputs.DIST_EXE }}
path: "${{ needs.version.outputs.DIST_EXE }}.tar.gz"
build-win-uwp:
needs: [ version ]
runs-on: windows-2022
steps:
- name: Setup Windows 10 SDK
uses: GuillaumeFalourd/setup-windows10-sdk-action@v1.11
with:
sdk-version: 20348
- name: Install NSIS
shell: powershell
run: |
Invoke-Expression (Invoke-Webrequest 'https://xmake.io/psget.text' -UseBasicParsing).Content
xmake --version
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: pre-repo
shell: powershell
run: |
$env:path+=";C:\Users\$($env:username)\xmake"
xmake repo -a local https://github.com/zeromake/xrepo.git
mkdir -p dist
mkdir -p build/xrepo
cd build/xrepo
git clone https://github.com/xfangfang/borealis.git -b wiliwili --depth=1
cd ../../
- name: build
shell: powershell
env:
VERSION: ${{ needs.version.outputs.VERSION }}
run: |
$env:path+=";C:\Users\$($env:username)\xmake"
xmake f -c -y --sw=y --winrt=y --window=sdl --driver=d3d11
xmake build wiliwili
cp winrt/key.pfx build/
cp winrt/docs/key.pdf build/key.pdf
- uses: actions/upload-artifact@v3
with:
name: ${{ needs.version.outputs.DIST_UWP }}
path: |
build/wiliwili.msix
build/key.pfx
build/key.pdf
build-switch:
needs: [ version ]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
repository: ${{ github.repository }}
submodules: 'recursive'
fetch-depth: 0
- name: Build
id: compile
run: |
wget https://github.com/xfangfang/wiliwili/releases/download/v0.1.0/nsp_forwarder.nsp -P resources
docker run --rm -v $(pwd):/data devkitpro/devkita64:20230622 sh -c "/data/scripts/build_switch.sh"
cd cmake-build-switch
tar -czvf ../${{ needs.version.outputs.DIST_NRO }}.tar.gz wiliwili.nro
- name: Upload dist
uses: actions/upload-artifact@v3
with:
name: ${{ needs.version.outputs.DIST_NRO }}
path: "${{ needs.version.outputs.DIST_NRO }}.tar.gz"
build-macos:
needs: [ version ]
runs-on: macos-11
strategy:
matrix:
arch: [ IntelChip, AppleSilicon, Universal ]
# Don't fail the whole workflow if one architecture fails
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v3
with:
repository: ${{ github.repository }}
submodules: 'recursive'
fetch-depth: 0
- name: install deps
run: |
brew install create-dmg dylibbundler webp boost
brew tap xfangfang/wiliwili
brew install -v mpv-wiliwili
- name: SSH connection to Actions
uses: P3TERX/ssh2actions@v1.0.0
if: (github.event.inputs.ssh_darwin == 'true' && github.event.inputs.ssh_darwin != 'false') || contains(github.event.action, 'ssh_darwin')
env:
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
- name: Update gamepad mappings
id: gamepad
run: |
BRLS_GLFW="library/borealis/library/lib/extern/glfw/"
cmake -P ${BRLS_GLFW}/CMake/GenerateMappings.cmake ${BRLS_GLFW}/src/mappings.h.in ${BRLS_GLFW}/src/mappings.h
- name: Build
id: compile
run: |
cmake -B build -DPLATFORM_DESKTOP=ON -DCMAKE_BUILD_TYPE=Release -DMAC_${{ matrix.arch }}=ON -DMAC_DOWNLOAD_DYLIB=ON
make -C build wiliwili.app -j$(sysctl -n hw.ncpu)
- name: Name
id: name
run: |
echo "DMG=${{ needs.version.outputs.DIST_DMG_PREFIX }}-${{ matrix.arch }}-${{ needs.version.outputs.version }}" >> $GITHUB_OUTPUT
- name: Bundle
id: bundle
run: |
mkdir -p dist
mv build/wiliwili.app dist/
cp ./scripts/mac/readme.txt dist/readme.txt
create-dmg --window-pos 200 120 --window-size 800 400 \
--icon-size 100 --icon "wiliwili.app" 200 190 \
--icon "readme.txt" 400 100 --hide-extension "wiliwili.app" \
--app-drop-link 600 185 --volicon ./scripts/mac/dmg.icns \
--volname "wiliwili (${{ needs.version.outputs.version }})" ${{ steps.name.outputs.DMG }}.dmg "dist/"
- name: Upload dist
uses: actions/upload-artifact@v3
with:
name: ${{ steps.name.outputs.DMG }}
path: "${{ steps.name.outputs.DMG }}.dmg"
build-flatpak:
needs: [ version ]
runs-on: ubuntu-latest
container:
image: bilelmoussaoui/flatpak-github-actions:freedesktop-22.08
options: --privileged
strategy:
matrix:
arch: [ x86_64 ]
# arch: [ x86_64, aarch64 ]
# Don't fail the whole workflow if one architecture fails
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v3
with:
repository: ${{ github.repository }}
submodules: 'recursive'
fetch-depth: 0
- name: Install deps
run: |
dnf -y install docker cmake
BRLS_GLFW="library/borealis/library/lib/extern/glfw/"
cmake -P ${BRLS_GLFW}/CMake/GenerateMappings.cmake ${BRLS_GLFW}/src/mappings.h.in ${BRLS_GLFW}/src/mappings.h
- name: Set up QEMU
id: qemu
if: matrix.arch == 'aarch64'
uses: docker/setup-qemu-action@v2
with:
platforms: arm64
- uses: flatpak/flatpak-github-actions/flatpak-builder@v5
with:
bundle: wiliwili-Linux-${{ needs.version.outputs.version }}.flatpak
manifest-path: .flatpak-manifest.yml
cache-key: flatpak-builder-${{ github.sha }}
arch: ${{ matrix.arch }}