-
-
Notifications
You must be signed in to change notification settings - Fork 47
390 lines (352 loc) · 13.4 KB
/
Copy pathbuild.yml
File metadata and controls
390 lines (352 loc) · 13.4 KB
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
name: build
on:
push:
tags:
- 'v*'
branches:
- master
pull_request:
branches:
- master
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
build-linux:
runs-on: ${{ matrix.config.os }}
name: 'Build (${{ matrix.config.os }}, ${{ matrix.config.cc }}, ${{ matrix.config.cxx }})'
strategy:
fail-fast: false
matrix:
config:
- { os: ubuntu-22.04, cc: "gcc", cxx: "g++", opts: "-DENABLE_RELEASE:BOOL=ON -DENABLE_FFMPEG:BOOL=ON -DENABLE_OPENGL_CG:BOOL=ON" }
- { os: ubuntu-22.04, cc: "clang", cxx: "clang++", opts: "-DENABLE_RELEASE:BOOL=ON -DENABLE_FFMPEG:BOOL=ON -DENABLE_OPENGL_CG:BOOL=ON" }
steps:
- name: 'Checkout'
uses: actions/checkout@v4
- name: 'Install dependencies'
run: |
sudo apt-get update -qq
sudo apt-get install -y \
git \
cmake \
ninja-build \
libtool \
build-essential \
pkg-config \
mesa-common-dev \
freeglut3-dev \
nvidia-cg-toolkit \
libx11-dev \
libxrandr-dev \
libxcb-cursor-dev \
libasound2-dev \
libudev-dev \
libglvnd-dev \
libavformat-dev \
libavcodec-dev \
libswresample-dev \
libswscale-dev \
libavutil-dev \
libqt6svg6-dev \
qt6-base-dev \
qt6-base-dev-tools \
qt6-tools-dev \
qt6-tools-dev-tools \
qt6-l10n-tools \
qt6-image-formats-plugins
- name: 'Build with ${{ matrix.config.cc }}/${{ matrix.config.cxx }}'
env:
CC: ${{ matrix.config.cc }}
CXX: ${{ matrix.config.cxx }}
run: |
cmake -B build -G Ninja ${{ matrix.config.opts }}
cmake --build build -j2
build-windows:
runs-on: windows-latest
name: 'Build (${{ matrix.msystem }}, ${{ matrix.qt5ver }}, ${{ matrix.cc }}, ${{ matrix.cxx }})'
strategy:
fail-fast: false
matrix:
include:
- { msystem: mingw64, cc: "gcc", cxx: "g++", env: x86_64, bit: 64, qt5ver: 5.15.8, url1: www.dropbox.com/s/e8ejq25mdg1cuub, url2: www.dropbox.com/s/d632cjezybz6a74, opts: '-DENABLE_WIN_STATIC_QT5:BOOL=ON' }
- { msystem: mingw32, cc: "gcc", cxx: "g++", env: i686, bit: 32, qt5ver: 5.6.3, url1: www.dropbox.com/s/k25y87k94cldb62, url2: www.dropbox.com/s/ye00129nyacdl05, opts: '-DENABLE_WIN_STATIC_QT560:BOOL=ON' }
env:
CC: ${{ matrix.config.cc }}
CXX: ${{ matrix.config.cxx }}
CFLAGS: '-O3 -mmmx -msse -msse2 -msse3 -mfpmath=sse'
CXXFLAGS: '-O3 -mmmx -msse -msse2 -msse3 -mfpmath=sse'
oglopts: '-DENABLE_RELEASE:BOOL=ON -DENABLE_FFMPEG:BOOL=ON -DENABLE_OPENGL_CG:BOOL=ON'
d3dopts: '-DENABLE_RELEASE:BOOL=ON -DENABLE_FFMPEG:BOOL=ON -DENABLE_OPENGL:BOOL=OFF'
steps:
- name: 'Checkout'
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 'Set WIP env'
if: github.ref == 'refs/heads/master'
run: |
chcp 65001 #set code page to utf-8
echo ("git_info=-DENABLE_GIT_INFO:BOOL=ON") >> $env:GITHUB_ENV
- name: 'Set release env'
if: startsWith(github.ref, 'refs/tags/v')
run: |
chcp 65001 #set code page to utf-8
echo ("git_info=-DENABLE_GIT_INFO:BOOL=OFF") >> $env:GITHUB_ENV
- name: 'Setup ${{ matrix.env }} environment'
uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.msystem }}
release: false
update: true
install: >-
base-devel
git
wget
p7zip
unzip
libtool
mingw-w64-${{ matrix.env }}-cmake
mingw-w64-${{ matrix.env }}-toolchain
mingw-w64-${{ matrix.env }}-rav1e
mingw-w64-${{ matrix.env }}-libmfx
mingw-w64-${{ matrix.env }}-ffmpeg
- name: 'Environment configuration'
shell: msys2 {0}
run: |
mkdir -p artifacts/dll
mkdir -p artifacts/tmp
mkdir -p artifacts/d3d9
mkdir -p artifacts/opengl
mkdir -p build/d3d9
mkdir -p build/opengl
- name: 'Download qt5 and dlls'
shell: msys2 {0}
working-directory: artifacts/tmp
run: |
wget --no-check-cert -O qt5_${{ matrix.qt5ver }}_${{ matrix.env }}.7z 'https://${{ matrix.url1 }}/qt5_${{ matrix.qt5ver }}_${{ matrix.env }}.7z?dl=1' 1>/dev/null 2>&1
wget --no-check-cert -O puNES_${{ matrix.env }}_dlls.zip 'https://${{ matrix.url2 }}/puNES_${{ matrix.env }}_dlls.zip?dl=1' 1>/dev/null 2>&1
- name: 'Extract qt5 and dlls'
working-directory: artifacts/tmp
run: |
7z x qt5_${{ matrix.qt5ver }}_${{ matrix.env }}.7z -oC:\msys64\${{ matrix.msystem }} > NUL
7z x puNES_${{ matrix.env }}_dlls.zip -o${{ github.workspace }}\artifacts\dll > NUL
- name: 'Build d3d9 version'
shell: msys2 {0}
working-directory: build\d3d9
run: |
Qt5_DIR='/${{ matrix.msystem }}/lib/qt5/cmake/Qt5' cmake -S ../../ -G Ninja ${{ env.d3dopts }} ${{ env.git_info }} ${{ matrix.opts }}
cmake --build . -j3
strip src/punes.exe
- name: 'Build opengl version'
shell: msys2 {0}
working-directory: build\opengl
run: |
Qt5_DIR='/${{ matrix.msystem }}/lib/qt5/cmake/Qt5' cmake -S ../../ -G Ninja ${{ env.oglopts }} ${{ env.git_info }} ${{ matrix.opts }}
cmake --build . -j3
strip src/punes.exe
- name: 'Prepare artifacts'
shell: msys2 {0}
working-directory: artifacts
run: |
cp dll/*.* d3d9/.
rm d3d9/cgGL.dll
cp ../misc/dip.cfg d3d9/.
cp ../misc/nes20db.xml d3d9/.
cp ../build/d3d9/src/punes.exe d3d9/.
cp dll/*.* opengl/.
rm opengl/cgD3D9.dll
cp ../misc/dip.cfg opengl/.
cp ../misc/nes20db.xml opengl/.
cp ../build/opengl/src/punes.exe opengl/.
- name: 'Upload d3d9 artifact'
uses: actions/upload-artifact@v4
with:
name: punes${{ matrix.bit }}.wip.d3d9
path: artifacts\d3d9\*.*
- name: 'Upload opengl artifact'
uses: actions/upload-artifact@v4
with:
name: punes${{ matrix.bit }}.wip.opengl
path: artifacts\opengl\*.*
build-appimage:
runs-on: ${{ matrix.config.os }}
name: 'AppImage ${{ matrix.config.env }} (${{ matrix.config.os }}, ${{ matrix.config.cc }}, ${{ matrix.config.cxx }})'
strategy:
fail-fast: false
matrix:
config:
- { os: ubuntu-22.04, cc: "gcc", cxx: "g++", env: x86_64, qtver: "6.9.1", opts: "-DENABLE_RELEASE:BOOL=ON -DENABLE_FFMPEG:BOOL=ON -DENABLE_OPENGL_CG:BOOL=ON -DDISABLE_PORTABLE_MODE:BOOL=ON" }
steps:
- name: 'Checkout'
uses: actions/checkout@v4
- name: 'Install dependencies'
run: |
sudo apt-get update -qq
sudo apt-get install -y \
git \
cmake \
ninja-build \
libtool \
build-essential \
pkg-config \
libgl1-mesa-dri \
libxkbcommon0 \
libxkbcommon-x11-0 \
libwayland-client0 \
libwayland-cursor0 \
libwayland-egl1 \
libxcb1 \
libxcb-xinput0 \
libxcb-xkb1 \
libxcb-render0 \
libxcb-shm0 \
libxcb-randr0 \
libxcb-sync1 \
libxcb-icccm4 \
libxcb-keysyms1 \
libxcb-image0 \
libxcb-shape0 \
libfontconfig1 \
libfreetype6 \
libdbus-1-3 \
libicu70 \
libharfbuzz0b \
libdouble-conversion3 \
libbrotli1 \
zlib1g \
mesa-common-dev \
freeglut3-dev \
nvidia-cg-toolkit \
libx11-dev \
libxrandr-dev \
libxcb-cursor-dev \
libasound2-dev \
libudev-dev \
libglvnd-dev \
libavformat-dev \
libavcodec-dev \
libswresample-dev \
libswscale-dev \
libavutil-dev
- name: 'Install Qt ${{ matrix.config.qtver }}'
run: |
sudo apt-get install -y python3-pip
# pip install -U pip --break-system-packages (per la 24.04)
# $HOME/.local/bin/pip install aqtinstall --break-system-packages (per la 24.04)
pip install -U pip
$HOME/.local/bin/pip install aqtinstall
$HOME/.local/bin/aqt \
install-qt linux desktop ${{ matrix.config.qtver }} \
-m qtimageformats
- name: 'Set WIP env'
if: github.ref == 'refs/heads/master'
run: echo "git_info=-DENABLE_GIT_INFO:BOOL=ON" >> "$GITHUB_ENV"
- name: 'Set release env'
if: startsWith(github.ref, 'refs/tags/v')
run: echo "git_info=-DENABLE_GIT_INFO:BOOL=OFF" >> "$GITHUB_ENV"
- name: 'Build project with ${{ matrix.config.cc }}/${{ matrix.config.cxx }}'
env:
CC: ${{ matrix.config.cc }}
CXX: ${{ matrix.config.cxx }}
CFLAGS: '-O3 -mmmx -msse -msse2 -msse3 -mfpmath=sse'
CXXFLAGS: '-O3 -mmmx -msse -msse2 -msse3 -mfpmath=sse'
EXTQTDIR: '${{ github.workspace }}/${{ matrix.config.qtver }}/gcc_64'
run: |
cmake \
-B build \
-G Ninja \
-DCMAKE_PREFIX_PATH="${EXTQTDIR}" ${{ matrix.config.opts }} ${{ env.git_info }}
cmake --build build -j2
- name: 'Install linuxdeploy'
run: |
wget -c "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage"
chmod a+x linuxdeploy-x86_64.AppImage
- name: 'Install linuxdeploy-plugin-qt'
run: |
wget -c "https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage"
chmod a+x linuxdeploy-plugin-qt-x86_64.AppImage
- name: 'Create AppDir'
run: |
mkdir -p AppDir
cmake --install build --prefix AppDir/usr
- name: 'Deploy AppImage'
env:
EXTQTDIR: '${{ github.workspace }}/${{ matrix.config.qtver }}/gcc_64'
run: |
unset QTDIR
unset QT_PLUGIN_PATH
unset LD_LIBRARY_PATH
echo "EXTQTDIR is $EXTQTDIR"
export QMAKE="${EXTQTDIR}/bin/qmake"
export LD_LIBRARY_PATH="${EXTQTDIR}/lib"
export EXTRA_PLATFORM_PLUGINS="libqwayland-egl.so;libqwayland-generic.so"
./linuxdeploy-x86_64.AppImage \
--appdir AppDir \
-d AppDir/usr/share/applications/io.github.punesemu.puNES.desktop \
-i AppDir/usr/share/icons/hicolor/256x256/apps/io.github.punesemu.puNES.png \
--plugin qt
rm -f AppDir/usr/lib/libmpg123.so.0
cp -avf "${EXTQTDIR}/plugins/"wayland* AppDir/usr/plugins/.
./linuxdeploy-x86_64.AppImage \
--appdir AppDir \
--exclude-library "*mpg123*" \
--output appimage
- name: 'Setup tmate session (only for debug)'
if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3
with:
limit-access-to-actor: true
- name: 'Upload artifact'
uses: actions/upload-artifact@v4
with:
name: puNES-${{ matrix.config.env }}.AppImage
path: puNES*.AppImage
release:
runs-on: ubuntu-latest
needs: [build-windows, build-appimage]
if: startsWith(github.ref, 'refs/tags/v')
name: 'Prepare Release'
steps:
- name: 'Checkout'
uses: actions/checkout@v4
- name: 'Download artifacts'
uses: actions/download-artifact@v4
with:
path: artifacts
- run: ls -R artifacts
- name: 'Set version and generate changelog'
run: |
ver=${{ github.ref_name }}
ver=${ver#v}
echo "version=$ver" >> "$GITHUB_ENV"
body=$'<h1>Changelog</h1>\n\n'
body=$body$(sed -n '/Changelog:/,/^\s*$/p' ChangeLog | sed '1,2d')
echo "$body" > ${{ github.workspace }}-ChangeLog.md
- name: 'Create assets'
shell: bash
run: |
echo "create puNES-${{ env.version }}-x86_64.AppImage"
mv artifacts/puNES-x86_64.AppImage/puNES-x86_64.AppImage artifacts/puNES-${{ env.version }}-x86_64.AppImage
for bit in 32 64 ; do
arch=$( [ "$bit" == "32" ] && echo "i686" || echo "x86_64" )
for i in d3d9 opengl ; do
folder=punes${bit}.wip.${i}
out="punes-${{ env.version }}-${arch}-win-${i}.zip"
mv artifacts/${folder}/punes.exe artifacts/${folder}/punes${bit}.exe
echo "create ${out}"
zip -9j artifacts/${out} artifacts/${folder}/*
done
done
- name: 'Prepare GitHub release'
uses: softprops/action-gh-release@v1
with:
body_path: ${{ github.workspace }}-ChangeLog.md
draft: true
fail_on_unmatched_files: true
files: |
artifacts/puNES-${{ env.version }}-x86_64.AppImage
artifacts/punes-${{ env.version }}-i686-win-d3d9.zip
artifacts/punes-${{ env.version }}-i686-win-opengl.zip
artifacts/punes-${{ env.version }}-x86_64-win-d3d9.zip
artifacts/punes-${{ env.version }}-x86_64-win-opengl.zip