forked from oomek/attractplus
-
Notifications
You must be signed in to change notification settings - Fork 0
336 lines (302 loc) · 13.5 KB
/
build.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
name: Linux Build
on: [push, pull_request]
env:
PKG_CONFIG_PATH_x86_64_w64_mingw32_static: /usr/lib/mxe/usr/x86_64-w64-mingw32.static/lib/pkgconfig/
jobs:
buildAMx86:
name: ${{ matrix.platform.name }} ${{ matrix.config.name }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
platform:
- { name: Linux x64 KMS, targetos: linux-x86, amflags: USE_DRM=1 }
- { name: Linux x64 X11, targetos: linux-x86 }
config:
- { name: shared, amflags: STATIC=0 }
- { name: static, amflags: STATIC=1 }
os: [ ubuntu-24.04, ubuntu-22.04, ubuntu-20.04 ]
exclude:
- platform: { targetos: linux-x86 }
config: { name: shared }
steps:
- name: AM+ - Checkout
uses: actions/checkout@v4
with:
path: am
- name: Prepare
id: vars
run: |
which nproc && nbproc=$(nproc) || nbproc=$(getconf _NPROCESSORS_ONLN)
echo "nbproc=${nbproc}" >> $GITHUB_OUTPUT
fe_version=
[[ ${GITHUB_REF} =~ ^refs/tags/* ]] && fe_version="${GITHUB_REF#refs/*/}"
echo "fe_version=${fe_version}" >> $GITHUB_OUTPUT
- name: Install Linux Dependencies
run: |
sudo apt update
sudo apt install build-essential cmake pkgconf libxrandr-dev libxcursor-dev libudev-dev libopenal-dev libflac-dev libvorbis-dev libgl1-mesa-dev libavformat-dev libfontconfig1-dev libfreetype6-dev libswscale-dev libswresample-dev libarchive-dev libjpeg-dev libglu1-mesa-dev libegl1-mesa-dev libgbm-dev libdrm-dev libcurl4-gnutls-dev libboost-system-dev libboost-filesystem-dev
- name: Build AM+
run: |
make -C am -j${{ steps.vars.outputs.nbproc }} VERBOSE=1 FE_VERSION=${{ steps.vars.outputs.fe_version }} ${{matrix.platform.amflags}} ${{matrix.config.amflags}} ${{env.cross_toolchain}}
- name: Prepare artifacts
run: |
mkdir -p "${GITHUB_WORKSPACE}"/artifacts
for e in "${GITHUB_WORKSPACE}"/am/*.exe ; do
echo "Gathering dll infos for $e ..."
which mingw-ldd || continue
for dll in $(mingw-ldd "$e" --dll-lookup-dirs /usr/lib/mxe/usr/x86_64-w64-mingw32.shared/bin/ "${GITHUB_WORKSPACE}"/sfml/install/lib/ | grep -v 'not found$' | tr -d ' ' | cut -d '>' -f 2) ; do
cp "$dll" "${GITHUB_WORKSPACE}"/artifacts/
done
done
find "${GITHUB_WORKSPACE}"/am/obj/sfml/install/lib/ -name "*.dll" -o -name "*.so" -o -name "*.dylib" -exec cp -v {} "${GITHUB_WORKSPACE}"/artifacts/ \;
cp am/attract* "${GITHUB_WORKSPACE}"/artifacts/
cp -R am/config/* "${GITHUB_WORKSPACE}"/artifacts/
7z a "attractplus-${{matrix.platform.name}}-${{matrix.config.name}}-${{matrix.os}}.7z" ./artifacts/*
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{matrix.platform.name}}-${{matrix.config.name}}-${{matrix.os}}
path: attractplus-*.7z
PackageAMx86:
#if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
name: ${{ matrix.platform.name }} ${{ matrix.config.name }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs: BuildAMx86
strategy:
matrix:
platform:
- { name: Linux x64 KMS, targetos: linux-x86, amflags: USE_DRM=1 }
#- { name: Linux x64 X11, targetos: linux-x86 }
config:
- { name: shared, amflags: STATIC=0 }
- { name: static, amflags: STATIC=1 }
os: [ ubuntu-24.04, ubuntu-22.04, ubuntu-20.04 ]
exclude:
- platform: { targetos: linux-x86 }
config: { name: shared }
steps:
- name: AM+ - Checkout
uses: actions/checkout@v4
with:
path: am
- name: Prepare
id: vars
run: |
which nproc && nbproc=$(nproc) || nbproc=$(getconf _NPROCESSORS_ONLN)
echo "nbproc=${nbproc}" >> $GITHUB_OUTPUT
fe_version=
[[ ${GITHUB_REF} =~ ^refs/tags/* ]] && fe_version="${GITHUB_REF#refs/*/}"
echo "fe_version=${fe_version}" >> $GITHUB_OUTPUT
- name: Install Linux Dependencies
run: |
sudo apt update
sudo apt install build-essential fakeroot dpkg-dev cmake pkgconf libxrandr-dev libxcursor-dev libudev-dev libopenal-dev libflac-dev libvorbis-dev libgl1-mesa-dev libavformat-dev libfontconfig1-dev libfreetype6-dev libswscale-dev libswresample-dev libarchive-dev libjpeg-dev libglu1-mesa-dev libegl1-mesa-dev libgbm-dev libdrm-dev libcurl4-gnutls-dev libboost-system-dev libboost-filesystem-dev libxinerama-dev
- name: Package AM+
uses: jtdor/build-deb-action@v1
env:
DEB_BUILD_OPTIONS: noautodbgsym
with:
buildpackage-opts: --build=binary --no-sign
source-dir: am
- name: Package AM+
run: |
cd am
# dpkg-buildpackage -rfakeroot -b -us -uc
# cd ..
mv attract_plus_${{ steps.vars.outputs.fe_version }}_amd64.deb attract_plus_${{ steps.vars.outputs.fe_version }}_${{ matrix.os }}_amd64.deb
buildMacOS:
name: MacOS build
runs-on: macos-latest
steps:
- name: AM+ - Checkout
uses: actions/checkout@v4
with:
path: am
- name: Prepare
id: vars
run: |
which nproc && nbproc=$(nproc) || nbproc=$(getconf _NPROCESSORS_ONLN)
echo "nbproc=${nbproc}" >> $GITHUB_OUTPUT
fe_version=
[[ ${GITHUB_REF} =~ ^refs/tags/* ]] && fe_version="${GITHUB_REF#refs/*/}"
echo "fe_version=${fe_version}" >> $GITHUB_OUTPUT
- name: Install MacOS brew
run: |
brew update
brew upgrade
brew install pkgconfig ffmpeg libarchive libvorbis flac jpeg-turbo boost sfml
#~ - name: MacOS switch to GCC
#~ if: runner.os == 'macOS'
#~ run: |
#~ echo "CC=/usr/local/bin/gcc-10" >> $GITHUB_ENV
#~ echo "CXX=/usr/local/bin/g++-10" >> $GITHUB_ENV
#~ echo "AR=/usr/local/bin/ar-10" >> $GITHUB_ENV
- name: Build AM+
run: |
make -C am -j${{ steps.vars.outputs.nbproc }} VERBOSE=1 FE_VERSION=${{ steps.vars.outputs.fe_version }} prefix=.. USE_SYSTEM_SFML=1 STATIC=0
- name: Prepare artifacts
run: |
git -C am/ fetch --unshallow
mkdir -p "${GITHUB_WORKSPACE}"/artifacts
bash am/util/osx/appbuilder.sh
7z a "attractplus-MacOS.7z" ./artifacts/*
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: MacOS
path: attractplus-*.7z
buildAMarm:
name: ${{ matrix.platform.name }} ${{ matrix.config.name }} on ${{ matrix.os }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
platform:
- { name: armv7, arch: arm32v7, pf: arm/v7, shell: bash, amflags: USE_DRM=1 USE_MMAL=1}
- { name: aarch64, arch: arm64v8, pf: aarch64, shell: bash, amflags: USE_DRM=1}
config:
- { name: shared, amflags: STATIC=0 }
- { name: static, amflags: STATIC=1 }
os: [ buster, bullseye, bookworm ]
#os: [ buster ]
exclude:
- config: { name: shared }
steps:
- name: AM+ - Checkout
uses: actions/checkout@v4
with:
path: am
- name: Prepare
id: vars
run: |
fe_version=
[[ ${GITHUB_REF} =~ ^refs/tags/* ]] && fe_version="${GITHUB_REF#refs/*/}"
echo "fe_version=${fe_version}" >> $GITHUB_OUTPUT
- name: Build AM+
uses: uraimo/run-on-arch-action@v2
with:
arch: ${{ matrix.platform.name }}
distro: ${{ matrix.os }}
#base_image: "--platform=linux/${{ matrix.platform.name }} ${{ matrix.platform.arch }}/debian:${{ matrix.os }}"
#base_image: "--platform=linux/${{ matrix.platform.pf }}"
githubToken: ${{ github.token }}
dockerRunArgs: |
--volume "${GITHUB_WORKSPACE}/am:/am"
install: |
apt-get update -y -q
apt-get install -y -q build-essential cmake pkgconf libxrandr-dev libxcursor-dev libudev-dev libopenal-dev libflac-dev libvorbis-dev libgl1-mesa-dev libavformat-dev libfontconfig1-dev libfreetype6-dev libswscale-dev libswresample-dev libarchive-dev libjpeg-dev libglu1-mesa-dev libgbm-dev libdrm-dev libegl1-mesa-dev libcurl4-gnutls-dev libboost-filesystem-dev libboost-system-dev
run: |
make -C am -j$(nproc) VERBOSE=1 FE_VERSION=${{ steps.vars.outputs.fe_version }} ${{matrix.platform.amflags}} ${{matrix.config.amflags}}
- name: Prepare artifacts
run: |
mkdir -p "${GITHUB_WORKSPACE}"/artifacts
find "${GITHUB_WORKSPACE}"/am/obj/sfml/install/lib/ -name "*.dll" -o -name "*.so" -o -name "*.dylib" -exec cp -v {} "${GITHUB_WORKSPACE}"/artifacts/ \;
cp am/attract* "${GITHUB_WORKSPACE}"/artifacts/
cp -R am/config/* "${GITHUB_WORKSPACE}"/artifacts/
7z a "attractplus-${{matrix.platform.name}}-${{matrix.os}}.7z" ./artifacts/*
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{matrix.platform.name}}-${{matrix.os}}
path: attractplus-*.7z
buildAMWindows:
name: Windows MXE build
runs-on: ubuntu-20.04
steps:
- name: AM+ - Checkout
uses: actions/checkout@v4
with:
path: am
- name: Prepare
id: vars
run: |
which nproc && nbproc=$(nproc) || nbproc=$(getconf _NPROCESSORS_ONLN)
echo "nbproc=${nbproc}" >> $GITHUB_OUTPUT
fe_version=
[[ ${GITHUB_REF} =~ ^refs/tags/* ]] && fe_version="${GITHUB_REF#refs/*/}"
echo "fe_version=${fe_version}" >> $GITHUB_OUTPUT
- name: Install Linux MXE for Windows cross-building
run: |
sudo apt-get install \
software-properties-common \
lsb-release
sudo apt-key adv \
--keyserver keyserver.ubuntu.com \
--recv-keys 86B72ED9 && \
sudo add-apt-repository \
"deb [arch=amd64] https://pkg.mxe.cc/repos/apt `lsb_release -sc` main" && \
sudo apt-get update
sudo apt-get install \
mxe-x86-64-w64-mingw32.static-cc \
mxe-x86-64-w64-mingw32.static-openal \
mxe-x86-64-w64-mingw32.static-flac \
mxe-x86-64-w64-mingw32.static-vorbis \
mxe-x86-64-w64-mingw32.static-freetype \
mxe-x86-64-w64-mingw32.static-freetype-bootstrap \
mxe-x86-64-w64-mingw32.static-libarchive \
mxe-x86-64-w64-mingw32.static-curl \
mxe-x86-64-w64-mingw32.static-openjpeg \
mxe-x86-64-w64-mingw32.static-boost
sudo apt-get install ./am/extlibs/mxe/mxe-x86-64-w64-mingw32.static-gcc_11.2.0-focal.deb
sudo apt-get install ./am/extlibs/mxe/mxe-x86-64-w64-mingw32.static-brotli_1.1.0.deb
sudo apt-get install ./am/extlibs/mxe/mxe-x86-64-w64-mingw32.static-ffmpeg_7.0.2.deb
sudo ln -s /usr/lib/mxe/usr/bin/x86_64-w64-mingw32.static-gcc /usr/lib/mxe/usr/bin/x86_64-w64-mingw32.static-cc
sudo pip install mingw-ldd
echo "/usr/lib/mxe/usr/bin" >> $GITHUB_PATH
echo "cross_prefix=x86_64-w64-mingw32.static-" >> $GITHUB_ENV
echo "cross_toolchain=TOOLCHAIN=x86_64-w64-mingw32.static" >> $GITHUB_ENV
- name: Build AM+
run: |
make -C am -j$(nproc) VERBOSE=1 FE_VERSION=${{ steps.vars.outputs.fe_version }} CROSS=1 FE_WINDOWS_COMPILE=1 STATIC=1 TOOLCHAIN=x86_64-w64-mingw32.static
- name: Build AM+ attract-console.exe (Windows only)
run: |
make -C am smallclean CROSS=1 FE_WINDOWS_COMPILE=1 STATIC=1 TOOLCHAIN=x86_64-w64-mingw32.static
make -C am -j${{ steps.vars.outputs.nbproc }} VERBOSE=1 FE_VERSION=${{ steps.vars.outputs.fe_version }} CROSS=1 FE_WINDOWS_COMPILE=1 STATIC=1 TOOLCHAIN=x86_64-w64-mingw32.static WINDOWS_CONSOLE=1
- name: Prepare artifacts
run: |
mkdir -p "${GITHUB_WORKSPACE}"/artifacts
for e in "${GITHUB_WORKSPACE}"/am/*.exe ; do
echo "Gathering dll infos for $e ..."
which mingw-ldd || continue
for dll in $(mingw-ldd "$e" --dll-lookup-dirs /usr/lib/mxe/usr/x86_64-w64-mingw32.shared/bin/ "${GITHUB_WORKSPACE}"/sfml/install/lib/ | grep -v 'not found$' | tr -d ' ' | cut -d '>' -f 2) ; do
cp "$dll" "${GITHUB_WORKSPACE}"/artifacts/
done
done
find "${GITHUB_WORKSPACE}"/am/obj/sfml/install/lib/ -name "*.dll" -o -name "*.so" -o -name "*.dylib" -exec cp -v {} "${GITHUB_WORKSPACE}"/artifacts/ \;
cp am/attract* "${GITHUB_WORKSPACE}"/artifacts/
cp -R am/config/* "${GITHUB_WORKSPACE}"/artifacts/
7z a "attractplus-Windows.7z" ./artifacts/*
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: Windows
path: attractplus-*.7z
Release:
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
name: Release to github
needs: [PackageAMx86, buildAMarm, buildMacOS, buildAMWindows]
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Prepare artifacts
id: prepare_artifacts
run: |
tag="${GITHUB_REF#refs/*/}"
echo "current_tag=${tag}" >> $GITHUB_OUTPUT
mkdir -p "${GITHUB_WORKSPACE}"/artifacts_for_release
find "${GITHUB_WORKSPACE}"/artifacts/ -name "*.7z" | while read f ; do
p="$(basename "$f")"
cp -v "$f" "${GITHUB_WORKSPACE}/artifacts_for_release/attractplus-${GITHUB_REF#refs/*/}-${p#attract-}"
done
- name: Create Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: Attract Mode Plus ${{ steps.prepare_artifacts.outputs.current_tag }}
draft: true
prerelease: false
files: artifacts_for_release/attractplus-*.7z