forked from Mudlet/Mudlet
-
Notifications
You must be signed in to change notification settings - Fork 1
460 lines (405 loc) · 18.8 KB
/
build-mudlet.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
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
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
name: 🔨 Build Mudlet
on:
push:
branches: [master, development, release-*]
tags: [Mudlet-*]
pull_request:
workflow_dispatch:
inputs:
scheduled:
description: 'Imitate a scheduled build'
required: false
default: 'false'
schedule:
- cron: '0 2 * * *'
jobs:
compile-mudlet:
name: ${{matrix.buildname}}
runs-on: ${{matrix.os}}
if: ${{ github.repository_owner == 'Mudlet' }}
strategy:
fail-fast: false
matrix:
include:
# oldest OS supported for maximum compatibility of built AppImage
- os: ubuntu-20.04
buildname: 'ubuntu / gcc / lua tests'
triplet: x64-linux
compiler: gcc_64
gcc_compiler_version: 8
qt: '5.14.2'
deploy: 'deploy'
run_tests: 'true'
- os: ubuntu-latest
buildname: 'ubuntu / clang'
triplet: x64-linux
compiler: clang_64
# We still need a gcc for some sub-stages - and it ain't always the same one:
gcc_compiler_version: 9
qt: '5.14.2'
- os: macos-13
buildname: 'macos (x86_64) / c++, lua tests'
triplet: x64-osx
compiler: clang_64
qt: '5.14.2'
deploy: 'deploy'
run_tests: 'true'
- os: macos-14
buildname: 'macos (arm64) / c++, lua tests'
triplet: arm64-osx
compiler: clang_64
qt: '5.15.13'
deploy: 'deploy'
run_tests: 'true'
env:
BOOST_ROOT: ${{github.workspace}}/3rdparty/boost
BOOST_URL: https://sourceforge.net/projects/boost/files/boost/1.83.0/boost_1_83_0.tar.bz2/download
VCPKG_ROOT: ${{github.workspace}}/3rdparty/vcpkg
steps:
- name: Checkout Mudlet source code
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: Install Qt
# need to install qt via homebrew for qt5 on arm64-osx
if: ${{ !(matrix.triplet == 'arm64-osx' && startsWith(matrix.qt, '5')) }}
uses: jurplel/install-qt-action@v4
with:
version: ${{matrix.qt}}
dir: ${{runner.workspace}}
cache: true
modules: ${{ startsWith(matrix.qt, '6') && 'qt5compat qtmultimedia' || '' }}
- name: Restore Boost cache
id: restore-boost
uses: actions/cache/restore@v4
with:
path: ${{env.BOOST_ROOT}}
key: boost
- name: Install Boost
if: steps.restore-boost.outputs.cache-hit != 'true'
run: |
if [ "$OS" == "Windows_NT" ]; then
BOOST_ROOT=$(echo $BOOST_ROOT | sed 's/\\/\//g')
fi
mkdir -p $BOOST_ROOT
curl --progress-bar --location --output $BOOST_ROOT/download.tar.bz2 $BOOST_URL
7z -o$BOOST_ROOT x $BOOST_ROOT/download.tar.bz2 -y -bd
7z -o$BOOST_ROOT x $BOOST_ROOT/download.tar -y -bd
cd $BOOST_ROOT && cp -r boost_*/* .
rm -rf boost_*/* download.tar.bz2 download.tar
shell: bash
- name: Save Boost cache
if: steps.restore-boost.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: ${{env.BOOST_ROOT}}
key: ${{ steps.restore-boost.outputs.cache-primary-key }}
- name: Use CMake 3.30.3
uses: lukka/[email protected]
- name: (macOS) Install non-vcpkg dependencies (1/2)
if: runner.os == 'macOS'
env:
HOMEBREW_NO_ANALYTICS: "ON"
HOMEBREW_NO_AUTO_UPDATE: "ON"
HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK: "ON"
HOMEBREW_NO_INSTALL_CLEANUP: "ON"
QT_VERSION: ${{ matrix.qt }}
run: |
# dependencies needed for vcpkg specifically.
BREWS=("automake" "autoconf" "pkg-config")
# for qt5 on arm64, also install libtool and qt@5
if [[ "$(uname -m)" = "arm64" && "$QT_VERSION" == 5* ]]; then
BREWS+=("libtool" "qt@5")
fi
# Loop through each brew package
for brew in "${BREWS[@]}"; do
if ! brew list --formula "${brew}" &>/dev/null; then
echo "Installing ${brew}..."
brew install "$brew"
else
echo "${brew} is already installed."
fi
done
# Set these here so that vcpkg can use them.
# Use latest available XCode
echo "DEVELOPER_DIR=$(xcode-select --print-path)" >> $GITHUB_ENV
echo "SDKROOT=$(xcrun --sdk macosx --show-sdk-path)" >> $GITHUB_ENV
- name: (Linux) Install non-vcpkg dependencies (1/2)
if: runner.os == 'Linux'
run: |
# gettext is needed for vcpkg
sudo apt-get install gettext -y
- name: Restore from cache and run vcpkg
uses: lukka/run-vcpkg@v7
env:
vcpkgResponseFile: ${{github.workspace}}/3rdparty/our-vcpkg-dependencies/vcpkg-${{matrix.triplet}}-dependencies
with:
vcpkgArguments: '@${{env.vcpkgResponseFile}}'
vcpkgDirectory: '${{github.workspace}}/3rdparty/vcpkg'
appendedCacheKey: ${{hashFiles(env.vcpkgResponseFile)}}-${{matrix.triplet}}-cachekey
- name: (macOS) Install non-vcpkg dependencies (2/2)
if: runner.os == 'macOS'
env:
HOMEBREW_NO_ANALYTICS: "ON"
HOMEBREW_NO_AUTO_UPDATE: "ON"
HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK: "ON"
HOMEBREW_NO_INSTALL_CLEANUP: "ON"
run: |
# these aren't available or don't work well in vcpkg
BREWS=("libzzip" "libzip" "ccache" "luarocks" "expect")
# Loop through each brew package
for brew in "${BREWS[@]}"; do
if ! brew list --formula "{brew}" &>/dev/null; then
echo "Installing ${brew}..."
brew install "$brew"
else
echo "${brew} is already installed."
fi
done
echo "CCACHE_DIR=${{runner.workspace}}/ccache" >> $GITHUB_ENV
# Install lua-yajl early to generate translation statistics
export PATH="${{env.VCPKG_ROOT}}/installed/${{matrix.triplet}}/tools/lua:$PATH"
# workaround https://github.com/lloyd/yajl/issues/209
# Rock locations search is hardcoded to -L/usr/local/lib and not adjustable
export LIBRARY_PATH="${{env.VCPKG_ROOT}}/installed/${{matrix.triplet}}/lib:$LIBRARY_PATH"
# LUA_INCDIR needs to be passed as well due to https://github.com/luarocks/luarocks/issues/1239
luarocks --lua-dir "${{env.VCPKG_ROOT}}/installed/${{matrix.triplet}}/tools/lua" --lua-version "5.1" LUA_INCDIR="${{env.VCPKG_ROOT}}/installed/${{matrix.triplet}}/include" install YAJL_INCDIR="${{env.VCPKG_ROOT}}/installed/${{matrix.triplet}}/include" YAJL_LIBDIR="${{env.VCPKG_ROOT}}/installed/${{matrix.triplet}}/lib" LUA_INCDIR="${{env.VCPKG_ROOT}}/installed/${{matrix.triplet}}/include" --local lua-yajl
# for some reason it gets installed in a place where lua-yajl can't find it after, fix that
mkdir -p /Users/runner/work/Mudlet/Mudlet/3rdparty/vcpkg/packages/yajl_${{matrix.triplet}}/lib/
cp "${{env.VCPKG_ROOT}}/installed/${{matrix.triplet}}/lib/libyajl.2.dylib" "${{env.VCPKG_ROOT}}/packages/yajl_${{matrix.triplet}}/lib/libyajl.2.dylib"
# Allow stats generation script to see location of lua-yajl
eval "$(luarocks path --local --lua-version "5.1")"
echo "LUA_PATH=$LUA_PATH" >> $GITHUB_ENV
echo "LUA_CPATH=$LUA_CPATH" >> $GITHUB_ENV
- name: (macOS) Add additional paths for Qt5 on arm64 (1/1)
if: ${{ matrix.triplet == 'arm64-osx' && startsWith(matrix.qt, '5') }}
run: |
echo "LDFLAGS=-L$(brew --prefix qt@5)/lib" >> $GITHUB_ENV
echo "CPPFLAGS=-I$(brew --prefix qt@5)/include" >> $GITHUB_ENV
echo "PKG_CONFIG_PATH=$(brew --prefix qt@5)/lib/pkgconfig" >> $GITHUB_ENV
echo "QT_PREFIX=$(brew --prefix qt@5)" >> $GITHUB_ENV
# both of these needed for the packager / installer on Github
echo "PATH=$(brew --prefix qt@5)/bin:$PATH" >> $GITHUB_ENV
echo "QT_DIR=$(brew --prefix qt@5)" >> $GITHUB_ENV
# though we vcpkg installs Lua for us, the way it arranges directories is not compatible with Luarocks,
# so install it in a format that works
- name: (Linux) Install Lua
uses: leafo/gh-actions-lua@v10
if: runner.os == 'Linux'
with:
luaVersion: "5.1.5"
buildCache: false
- name: (Linux) Install latest Luarocks
uses: leafo/gh-actions-luarocks@v4
if: runner.os == 'Linux'
- name: (Linux) Install non-vcpkg dependencies (2/2)
if: runner.os == 'Linux'
run: |
sudo apt-get update
# Install from vcpkg everything we can for cross-platform consistency
# If not available, use other methods
# imagemagick is for the desktop screenshot
sudo apt-get install ccache pkg-config pcregrep expect libzip-dev libglu1-mesa-dev libpulse-dev g++-${{matrix.gcc_compiler_version}} \
libxkbcommon-x11-0 imagemagick -y
# switch to GCC that supports C++17 while retaining support for older OS's
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{matrix.gcc_compiler_version}} ${{matrix.gcc_compiler_version}}
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-${{matrix.gcc_compiler_version}} ${{matrix.gcc_compiler_version}}
sudo update-alternatives --set gcc /usr/bin/gcc-${{matrix.gcc_compiler_version}}
sudo update-alternatives --set g++ /usr/bin/g++-${{matrix.gcc_compiler_version}}
echo "CCACHE_DIR=${{runner.workspace}}/ccache" >> $GITHUB_ENV
# Install lua-yajl early to generate translation statistics
export PATH="${{env.VCPKG_ROOT}}/installed/${{matrix.triplet}}/tools/lua:$PATH"
# workaround https://github.com/lloyd/yajl/issues/209
mv ${{env.VCPKG_ROOT}}/installed/${{matrix.triplet}}/lib/libyajl_s.a ${{env.VCPKG_ROOT}}/installed/${{matrix.triplet}}/lib/libyajl.a
mv ${{env.VCPKG_ROOT}}/installed/${{matrix.triplet}}/debug/lib/libyajl_s.a ${{env.VCPKG_ROOT}}/installed/${{matrix.triplet}}/debug/lib/libyajl.a
# Rock locations search is hardcoded to -L/usr/local/lib and not adjustable
export LIBRARY_PATH="${{env.VCPKG_ROOT}}/installed/${{matrix.triplet}}/lib:$LIBRARY_PATH"
# LUA_INCDIR needs to be passed as well due to https://github.com/luarocks/luarocks/issues/1239
luarocks install YAJL_INCDIR="${{env.VCPKG_ROOT}}/installed/${{matrix.triplet}}/include" YAJL_LIBDIR="${{env.VCPKG_ROOT}}/installed/${{matrix.triplet}}/lib" LUA_INCDIR="${{env.VCPKG_ROOT}}/installed/${{matrix.triplet}}/include" --local lua-yajl
# Allow stats generation script to see location of lua-yajl
eval "$(luarocks path --local --lua-version "5.1")"
echo "LUA_PATH=$LUA_PATH" >> $GITHUB_ENV
echo "LUA_CPATH=$LUA_CPATH" >> $GITHUB_ENV
- name: (Linux Clang) change compiler & disable optional components
if: runner.os == 'Linux' && matrix.compiler == 'clang_64'
run: |
echo "CXX=clang++" >> $GITHUB_ENV
echo "CC=clang" >> $GITHUB_ENV
echo "WITH_UPDATER=no" >> $GITHUB_ENV
echo "WITH_3DMAPPER=no" >> $GITHUB_ENV
echo "WITH_FONTS=no" >> $GITHUB_ENV
- name: Restore ccache
id: restore-ccache
uses: actions/cache/restore@v4
with:
path: ${{runner.workspace}}/ccache
key: ccache-${{matrix.os}}-${{matrix.compiler}}-${{matrix.qt}}-${{ github.sha }}
restore-keys: ccache-${{matrix.os}}-${{matrix.compiler}}-${{matrix.qt}}
- name: (Linux) Set build info
if: runner.os == 'Linux'
env:
GITHUB_EVENT_INPUTS_SCHEDULED: ${{inputs.scheduled}}
run: |
sudo apt-get -y install pcregrep
${{github.workspace}}/CI/travis.validate_deployment.sh
${{github.workspace}}/CI/travis.set-build-info.sh
- name: (macOS) Set build info
if: runner.os == 'macOS'
env:
GITHUB_EVENT_INPUTS_SCHEDULED: ${{inputs.scheduled}}
run: |
brew install pcre
${{github.workspace}}/CI/travis.validate_deployment.sh
${{github.workspace}}/CI/travis.set-build-info.sh
# remove it as it breaks packaging down the line: https://github.com/Mudlet/Mudlet/issues/6668
brew uninstall pcre
# ccache can't reliably detect that the compiler is clang on macOS, so just say so explicitly.
echo "CXX=clang++" >> $GITHUB_ENV
echo "CC=clang" >> $GITHUB_ENV
- name: check ccache stats prior to build
run: ccache --zero-stats --show-stats
- name: Build Mudlet
uses: lukka/run-cmake@v3
with:
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
cmakeListsTxtPath: '${{github.workspace}}/CMakeLists.txt'
useVcpkgToolchainFile: true
buildDirectory: '${{runner.workspace}}/b/ninja'
cmakeAppendedArgs: >-
-G Ninja
-DCMAKE_PREFIX_PATH=${{ env.QT_PREFIX != '' && env.QT_PREFIX || env.MINGW_BASE_DIR }}
-DVCPKG_APPLOCAL_DEPS=OFF
env:
NINJA_STATUS: '[%f/%t %o/sec] '
- name: Save ccache
if: always() && steps.restore-ccache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: ${{runner.workspace}}/ccache
key: ${{ steps.restore-ccache.outputs.cache-primary-key }}
- name: Upload GitHub Actions artifact of vcpkg build logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: vcpkg-logs-${{ runner.os }}
path: ${{ github.workspace }}/vcpkg/buildtrees/**/*.log
- name: check ccache stats post build
run: ccache --show-stats
- name: (macOS) Run C++ tests
if: runner.os == 'macOS'
working-directory: '${{runner.workspace}}/b/ninja'
run: ctest --output-on-failure
- name: install dependencies for packaging/tests
if: matrix.deploy == 'deploy' || matrix.run_tests == 'true'
run: |
export PATH="${{env.VCPKG_ROOT}}/installed/${{matrix.triplet}}/tools/lua:$PATH"
shopt -s expand_aliases
if [ "${RUNNER_OS}" = "macOS" ]; then
alias run-luarocks="luarocks --lua-dir "${{env.VCPKG_ROOT}}/installed/${{matrix.triplet}}/tools/lua" --lua-version "5.1" LUA_INCDIR="${{env.VCPKG_ROOT}}/installed/${{matrix.triplet}}/include""
else
alias run-luarocks="luarocks"
fi
run-luarocks install --local LuaFileSystem
run-luarocks install --local luautf8
run-luarocks install --local lua-zip
run-luarocks install SQLITE_INCDIR="${{env.VCPKG_ROOT}}/installed/${{matrix.triplet}}/include" --local LuaSQL-SQLite3
run-luarocks install PCRE_INCDIR="${{env.VCPKG_ROOT}}/installed/${{matrix.triplet}}/include" --local lrexlib-pcre
# CI changelog generation dependencies
run-luarocks install --local argparse
run-luarocks install --local lunajson
# Lua-based tests
run-luarocks install --local busted
# necessary for Qt multimedia and modern Qt
if [ "${RUNNER_OS}" = "Linux" ]; then
sudo apt-get install libgstreamer-plugins-base1.0-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-render-util0 libxcb-xinerama0 xvfb -y
fi
env:
BUILD_FOLDER: ${{runner.workspace}}/b/ninja
RUNNER_OS: ${{runner.os}}
DEPLOY: ${{matrix.deploy}}
- name: add ssh-agent for release uploads
if: (runner.os == 'Linux' || runner.os == 'macOS') && matrix.deploy == 'deploy' && startsWith(github.ref, 'refs/tags/Mudlet-')
uses: webfactory/[email protected]
with:
ssh-private-key: ${{secrets.UPLOAD_PRIVATEKEY}}
- name: package Mudlet
if: (runner.os == 'Linux' || runner.os == 'macOS') && matrix.deploy == 'deploy'
run: |
export ARCH=$(uname -m)
echo "ARCH=$ARCH" >> $GITHUB_ENV
if [ "$RUNNER_OS" = "macOS" ] && [ "$ARCH" = "arm64" ]; then
# dblsqd only supports 'arm' as an architecture and not 'arm64'
export ARCH_DBLSQD=arm
echo "ARCH_DBLSQD=arm" >> $GITHUB_ENV
else
export ARCH_DBLSQD=$ARCH
echo "ARCH_DBLSQD=$ARCH" >> $GITHUB_ENV
fi
${{github.workspace}}/CI/travis.after_success.sh
env:
BUILD_FOLDER: ${{runner.workspace}}/b/ninja
RUNNER_OS: ${{runner.os}}
X_WP_DOWNLOAD_TOKEN: ${{secrets.X_WP_DOWNLOAD_TOKEN}}
DEPLOY: ${{matrix.deploy}}
DBLSQD_USER: ${{secrets.DBLSQD_USER}}
DBLSQD_PASS: ${{secrets.DBLSQD_PASS}}
DEPLOY_KEY_PASS: ${{secrets.DEPLOY_KEY_PASS}}
MACOS_SIGNING_PASS: ${{secrets.MACOS_SIGNING_PASS}}
APPLE_USERNAME: ${{secrets.APPLE_USERNAME}}
APPLE_PASSWORD: ${{secrets.APPLE_PASSWORD}}
APPLE_TEAM_ID: ${{secrets.APPLE_TEAM_ID}}
TRIPLET: ${{matrix.triplet}}
- name: Upload packaged Mudlet
uses: actions/upload-artifact@v4
if: env.UPLOAD_FILENAME
with:
name: ${{env.UPLOAD_FILENAME}}
path: ${{env.FOLDER_TO_UPLOAD}}
- name: Submit to make.mudlet.org
if: env.UPLOAD_FILENAME
run: curl -X POST "https://make.mudlet.org/snapshots/gha_queue.php?artifact_name=${{env.UPLOAD_FILENAME}}&unzip=1"
shell: bash
# we need to be in the right place for LuaGlobals.lua to load
- name: (Linux) Prep binary for running tests
if: matrix.run_tests == 'true' && runner.os =='Linux'
run: cp ${{runner.workspace}}/b/ninja/src/mudlet ${{github.workspace}}/src
shell: bash
- name: (macOS) Prep binary for running tests
if: matrix.run_tests == 'true' && runner.os == 'macOS'
run: |
if [ -d "${{runner.workspace}}/b/ninja/${{env.UPLOAD_FILENAME}}.app" ]; then
cp -r ${{runner.workspace}}/b/ninja/${{env.UPLOAD_FILENAME}}.app ~/Desktop/Mudlet.app
elif [ -d "${{runner.workspace}}/b/ninja/Mudlet PTB.app" ]; then
cp -r "${{runner.workspace}}/b/ninja/Mudlet PTB.app" ~/Desktop/Mudlet.app
else
cp -r ${{runner.workspace}}/b/ninja/src/mudlet.app ~/Desktop/Mudlet.app
fi
cd ~/Desktop
sudo codesign --remove-signature ~/Desktop/Mudlet.app
shell: bash
- name: (Linux) Run Lua tests
if: matrix.run_tests == 'true' && runner.os == 'Linux'
timeout-minutes: 5
run: xvfb-run --auto-servernum ${{github.workspace}}/src/mudlet --profile "Mudlet self-test" --mirror
env:
AUTORUN_BUSTED_TESTS: 'true'
TESTS_DIRECTORY: ${{github.workspace}}/src/mudlet-lua/tests
QUIT_MUDLET_AFTER_TESTS: 'true'
- name: (macOS) Run Lua tests
if: matrix.run_tests == 'true' && runner.os == 'macOS'
timeout-minutes: 5
shell: bash
run: ~/Desktop/Mudlet.app/Contents/MacOS/mudlet --profile "Mudlet self-test" --mirror
env:
AUTORUN_BUSTED_TESTS: 'true'
TESTS_DIRECTORY: ${{github.workspace}}/src/mudlet-lua/tests
QUIT_MUDLET_AFTER_TESTS: 'true'
- name: Passed Lua tests
if: matrix.run_tests == 'true'
run: |
if [ -e /tmp/busted-tests-failed ]
then
echo "Lua tests failed - see the action called 'Run Lua tests' above for detailed output."
exit 1
fi