forked from n64decomp/perfect_dark
-
Notifications
You must be signed in to change notification settings - Fork 76
330 lines (316 loc) · 12.3 KB
/
c-cpp.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
name: C/C++ CI
on:
push:
branches: [ "port" ]
pull_request:
branches: [ "port" ]
workflow_dispatch:
jobs:
build-i686-windows:
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
steps:
- name: Install MSYS2
uses: msys2/setup-msys2@v2
with:
msystem: MINGW32
update: true
install: >-
git
make
mingw-w64-i686-toolchain
mingw-w64-i686-SDL2
mingw-w64-i686-zlib
mingw-w64-i686-cmake
- name: Checkout repository
uses: actions/checkout@v4
- name: Build pd.i686.exe
run: cmake -G"Unix Makefiles" -Bbuild . && cmake --build build -j
- name: Build pd.pal.i686.exe
run: cmake -G"Unix Makefiles" -Bbuild_pal -DROMID=pal-final . && cmake --build build_pal -j
- name: Build pd.jpn.i686.exe
run: cmake -G"Unix Makefiles" -Bbuild_jpn -DROMID=jpn-final . && cmake --build build_jpn -j
- name: Prepare artifact for packaging
run: |
mkdir -p bin/data
cp build/pd.i686.exe bin/
cp build_pal/pd.pal.i686.exe bin/
cp build_jpn/pd.jpn.i686.exe bin/
cp /mingw32/bin/{SDL2.dll,zlib1.dll,libgcc_s_dw2-1.dll,libwinpthread-1.dll} bin/
touch bin/data/put_your_rom_here.txt
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: pd-i686-windows
path: bin/
retention-days: 0
build-i686-linux:
runs-on: ubuntu-latest
steps:
- name: Install dependencies
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install git gcc g++ gcc-multilib g++-multilib make libsdl2-dev zlib1g-dev libsdl2-dev:i386 zlib1g-dev:i386 cmake
- name: Checkout repository
uses: actions/checkout@v4
- name: Build pd.i686
run: cmake -G"Unix Makefiles" -Bbuild -DCMAKE_C_FLAGS=-m32 -DCMAKE_CXX_FLAGS=-m32 . && cmake --build build -j
- name: Build pd.pal.i686
run: cmake -G"Unix Makefiles" -Bbuild_pal -DCMAKE_C_FLAGS=-m32 -DCMAKE_CXX_FLAGS=-m32 -DROMID=pal-final . && cmake --build build_pal -j
- name: Build pd.jpn.i686
run: cmake -G"Unix Makefiles" -Bbuild_jpn -DCMAKE_C_FLAGS=-m32 -DCMAKE_CXX_FLAGS=-m32 -DROMID=jpn-final . && cmake --build build_jpn -j
- name: Prepare artifact for packaging
run: |
mkdir -p bin/data
cp build/pd.i686 bin/
cp build_pal/pd.pal.i686 bin/
cp build_jpn/pd.jpn.i686 bin/
touch bin/data/put_your_rom_here.txt
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: pd-i686-linux
path: bin/
retention-days: 0
build-x86_64-windows:
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
steps:
- name: Install MSYS2
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
install: >-
git
make
mingw-w64-x86_64-toolchain
mingw-w64-x86_64-python
mingw-w64-x86_64-SDL2
mingw-w64-x86_64-zlib
mingw-w64-x86_64-cmake
- name: Checkout repository
uses: actions/checkout@v4
- name: Build pd.x86_64.exe
run: cmake -G"Unix Makefiles" -Bbuild . && cmake --build build -j
- name: Build pd.pal.x86_64.exe
run: cmake -G"Unix Makefiles" -Bbuild_pal -DROMID=pal-final . && cmake --build build_pal -j
- name: Build pd.jpn.x86_64.exe
run: cmake -G"Unix Makefiles" -Bbuild_jpn -DROMID=jpn-final . && cmake --build build_jpn -j
- name: Prepare artifact for packaging
run: |
mkdir -p bin/data
cp build/pd.x86_64.exe bin/
cp build_pal/pd.pal.x86_64.exe bin/
cp build_jpn/pd.jpn.x86_64.exe bin/
cp /mingw64/bin/{SDL2.dll,zlib1.dll,libwinpthread-1.dll,libgcc_s_seh-1.dll} bin/
touch bin/data/put_your_rom_here.txt
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: pd-x86_64-windows
path: bin/
retention-days: 0
build-x86_64-linux:
runs-on: ubuntu-latest
steps:
- name: Install dependencies
run: |
sudo dpkg --add-architecture amd64
sudo apt-get update
sudo apt-get install git gcc g++ gcc-multilib g++-multilib make libsdl2-dev zlib1g-dev libsdl2-2.0-0 cmake
- name: Checkout repository
uses: actions/checkout@v4
- name: Build pd.x86_64
run: cmake -G"Unix Makefiles" -Bbuild . && cmake --build build -j
- name: Build pd.pal.x86_64
run: cmake -G"Unix Makefiles" -Bbuild_pal -DROMID=pal-final . && cmake --build build_pal -j
- name: Build pd.jpn.x86_64
run: cmake -G"Unix Makefiles" -Bbuild_jpn -DROMID=jpn-final . && cmake --build build_jpn -j
- name: Prepare artifact for packaging
run: |
mkdir -p bin/data
cp build/pd.x86_64 bin/
cp build_pal/pd.pal.x86_64 bin/
cp build_jpn/pd.jpn.x86_64 bin/
touch bin/data/put_your_rom_here.txt
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: pd-x86_64-linux
path: bin/
retention-days: 0
build-x86_64-osx:
runs-on: macos-14
steps:
- name: Install dependencies
run: |
brew install zlib
wget http://libsdl.org/release/SDL2-2.30.9.dmg -O SDL2.dmg
hdiutil mount SDL2.dmg
sudo cp -vr /Volumes/SDL2/SDL2.framework /Library/Frameworks
- name: Checkout repository
uses: actions/checkout@v4
- name: Build pd.x86_64
run: |
cmake -G"Unix Makefiles" -Bbuild -DCMAKE_OSX_ARCHITECTURES=x86_64 .
cmake --build build --target pd -j4 --clean-first
- name: Build pd.pal.x86_64
run: |
cmake -G"Unix Makefiles" -Bbuild_pal -DCMAKE_OSX_ARCHITECTURES=x86_64 -DROMID=pal-final .
cmake --build build_pal --target pd -j4 --clean-first
- name: Build pd.jpn.x86_64
run: |
cmake -G"Unix Makefiles" -Bbuild_jpn -DCMAKE_OSX_ARCHITECTURES=x86_64 -DROMID=jpn-final .
cmake --build build_jpn --target pd -j4 --clean-first
- name: Prepare artifact for packaging
run: |
mkdir -p bin/data
cp build/pd.x86_64 bin/
cp build_pal/pd.pal.x86_64 bin/
cp build_jpn/pd.jpn.x86_64 bin/
cp -vr /Library/Frameworks/SDL2.framework bin/
touch bin/data/put_your_rom_here.txt
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: pd-x86_64-osx
path: bin/
retention-days: 0
build-arm64-osx:
runs-on: macos-14
steps:
- name: Install dependencies
run: |
brew install zlib
wget http://libsdl.org/release/SDL2-2.30.9.dmg -O SDL2.dmg
hdiutil mount SDL2.dmg
sudo cp -vr /Volumes/SDL2/SDL2.framework /Library/Frameworks
- name: Checkout repository
uses: actions/checkout@v4
- name: Build pd.arm64
run: |
cmake -G"Unix Makefiles" -Bbuild -DCMAKE_OSX_ARCHITECTURES=arm64 .
cmake --build build --target pd -j4 --clean-first
- name: Build pd.pal.arm64
run: |
cmake -G"Unix Makefiles" -Bbuild_pal -DCMAKE_OSX_ARCHITECTURES=arm64 -DROMID=pal-final .
cmake --build build_pal --target pd -j4 --clean-first
- name: Build pd.jpn.arm64
run: |
cmake -G"Unix Makefiles" -Bbuild_jpn -DCMAKE_OSX_ARCHITECTURES=arm64 -DROMID=jpn-final .
cmake --build build_jpn --target pd -j4 --clean-first
- name: Prepare artifact for packaging
run: |
mkdir -p bin/data
cp build/pd.arm64 bin/
cp build_pal/pd.pal.arm64 bin/
cp build_jpn/pd.jpn.arm64 bin/
cp -vr /Library/Frameworks/SDL2.framework bin/
touch bin/data/put_your_rom_here.txt
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: pd-arm64-osx
path: bin/
retention-days: 0
build-arm64-nswitch:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/port'
steps:
- name: Install host dependencies
run: |
sudo apt-get update
sudo apt-get install git make cmake curl
- name: Install devkitA64 docker image
run: sudo docker pull devkitpro/devkita64:latest
- name: Checkout repository
uses: actions/checkout@v4
- name: Build pd.arm64.nro
run: sudo docker run --name pd --rm -v `pwd`:`pwd` -w `pwd` devkitpro/devkita64:latest bash ./tools/buildscripts/nswitch_docker.sh build
- name: Build pd.pal.arm64.nro
run: sudo docker run --name pd --rm -v `pwd`:`pwd` -w `pwd` devkitpro/devkita64:latest bash ./tools/buildscripts/nswitch_docker.sh build_pal -DROMID=pal-final
- name: Build pd.jpn.arm64.nro
run: sudo docker run --name pd --rm -v `pwd`:`pwd` -w `pwd` devkitpro/devkita64:latest bash ./tools/buildscripts/nswitch_docker.sh build_jpn -DROMID=jpn-final
- name: Prepare artifact for packaging
run: |
mkdir -p bin/perfectdark/data
mkdir -p bin/perfectdark_pal/data
mkdir -p bin/perfectdark_jpn/data
cp build/pd.arm64.nro bin/perfectdark/
cp build_pal/pd.pal.arm64.nro bin/perfectdark_pal/
cp build_jpn/pd.jpn.arm64.nro bin/perfectdark_jpn/
touch bin/perfectdark/data/put_your_rom_here.txt
touch bin/perfectdark_pal/data/put_your_rom_here.txt
touch bin/perfectdark_jpn/data/put_your_rom_here.txt
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: pd-arm64-nswitch
path: bin/
retention-days: 0
build-flatpak-bundle:
name: "Build flatpak bundle"
runs-on: ubuntu-latest
needs: [build-i686-linux, build-x86_64-linux]
container:
image: bilelmoussaoui/flatpak-github-actions:freedesktop-23.08
options: --privileged
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: pd-i686-linux
path: dist/linux/bin/
- uses: flatpak/flatpak-github-actions/flatpak-builder@v6
with:
bundle: io.github.fgsfdsfgs.perfect_dark.flatpak
manifest-path: dist/linux/io.github.fgsfdsfgs.perfect_dark.yaml
cache-key: flatpak-builder-${{ github.sha }}
upload-artifact: true
# - name: Build Flatpak bundle
# run: |
# cd dist/linux/
# flatpak-builder build --force-clean io.github.fgsfdsfgs.perfect_dark.yaml
# flatpak build-export export build
# flatpak build-bundle export io.github.fgsfdsfgs.perfect_dark.flatpak io.github.fgsfdsfgs.perfect_dark
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: io.github.fgsfdsfgs.perfect_dark.flatpak
path: io.github.fgsfdsfgs.perfect_dark.flatpak
retention-days: 0
publish-latest-build:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/port'
needs: [build-i686-windows, build-i686-linux, build-x86_64-windows, build-x86_64-linux, build-arm64-nswitch, build-x86_64-osx, build-arm64-osx, build-flatpak-bundle]
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: ci-artifacts
- name: Publish latest dev-build
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
mkdir ci-release
pushd ci-artifacts
tar czf ../ci-release/pd-i686-linux.tar.gz pd-i686-linux
tar czf ../ci-release/pd-x86_64-linux.tar.gz pd-x86_64-linux
tar cJf ../ci-release/pd-x86_64-osx.tar.xz pd-x86_64-osx
tar cJf ../ci-release/pd-arm64-osx.tar.xz pd-arm64-osx
zip -r ../ci-release/pd-i686-windows.zip pd-i686-windows
zip -r ../ci-release/pd-x86_64-windows.zip pd-x86_64-windows
zip -r ../ci-release/pd-arm64-nswitch.zip pd-arm64-nswitch
mv io.github.fgsfdsfgs.perfect_dark.flatpak/io.github.fgsfdsfgs.perfect_dark.flatpak ../ci-release/
popd
git tag --force ci-dev-build port
git push --force origin ci-dev-build
gh release upload --clobber ci-dev-build ci-release/*