forked from Mudlet/Mudlet
-
Notifications
You must be signed in to change notification settings - Fork 1
416 lines (363 loc) · 17.2 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
name: 🔨 Build Mudlet
on:
push:
branches: [master, development, release-*]
tags: [Mudlet-*]
pull_request:
workflow_dispatch:
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-11
buildname: 'macos / c++ tests'
triplet: x64-osx
compiler: clang_64
qt: '5.14.2'
deploy: 'deploy'
# - os: windows-2019
# buildname: 'windows'
# triplet: x64-mingw-dynamic
# # compiler: flag not used in windows pipeline
# qt: '5.14.2'
env:
BOOST_ROOT: ${{github.workspace}}/3rdparty/boost
BOOST_URL: https://sourceforge.net/projects/boost/files/boost/1.77.0/boost_1_77_0.tar.bz2/download
# APP_BUILD embeds the git sha which changes on every commit, throwing the cache off - ignore it
CCACHE_IGNOREOPTIONS: "-DAPP_BUILD=*"
steps:
- name: Checkout Mudlet source code
uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0
- name: (Windows) Install Qt
uses: jurplel/install-qt-action@v3
if: runner.os == 'Windows'
with:
version: ${{matrix.qt}}
dir: ${{runner.workspace}}
arch: win64_mingw73
cache: true
- name: (Linux/macOS) Install Qt
uses: jurplel/install-qt-action@v3
if: runner.os == 'Linux' || runner.os == 'macOS'
with:
version: ${{matrix.qt}}
dir: ${{runner.workspace}}
cache: true
- name: Restore Boost cache
uses: actions/cache@v3
id: cache-boost
with:
path: ${{env.BOOST_ROOT}}
key: boost
- name: Install Boost
if: steps.cache-boost.outputs.cache-hit != 'true'
run: |
if [ "$OS" == "Windows_NT" ]; then
# fix up paths to be forward slashes consistently
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
# workaround a poor interaction between github actions/cmake/vcpkg, see https://github.com/lukka/run-vcpkg/issues/88#issuecomment-885758902
- name: Use CMake 3.20.1
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"
run: |
# dependencies needed for vcpkg specifically
brew install automake autoconf pkg-config
- 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)}}-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
brew install libzzip libzip ccache luarocks expect mitchellh/gon/gon
echo "/usr/local/opt/ccache/libexec" >> $GITHUB_PATH
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_x64-osx/lib/
cp /Users/runner/work/Mudlet/Mudlet/3rdparty/vcpkg/installed/x64-osx/lib/libyajl.2.dylib /Users/runner/work/Mudlet/Mudlet/3rdparty/vcpkg/packages/yajl_x64-osx/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
# Use latest available XCode
echo "DEVELOPER_DIR=/Applications/Xcode_12.4.app/Contents/Developer" >> $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: (Windows) Install non-vcpkg dependencies
if: runner.os == 'Windows'
shell: powershell
run: |
# Install dependencies not available on machine
$env:WORKING_BASE_DIR = "${{runner.workspace}}\src"
$env:MINGW_BASE_DIR = "${{runner.workspace}}\mingw73_64"
echo "MINGW_BASE_DIR=$env:MINGW_BASE_DIR" >> $env:GITHUB_ENV
. ${{github.workspace}}\CI\appveyor.functions.ps1
# Libzip install complains when \bin is missing
New-Item -ItemType Directory -Path "$env:MINGW_BASE_DIR\bin"
SetQtBaseDir "$env:WORKING_BASE_DIR\verbose_output.log"
SetMingwBaseDir "$env:WORKING_BASE_DIR\verbose_output.log"
SetLuarocksPath "$env:WORKING_BASE_DIR\verbose_output.log"
$NoShPath = filterPathForSh
CheckAndInstallZlib
CheckAndInstallLibzip
- 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: (Linux/macOS) restore ccache
uses: pat-s/[email protected]
with:
path: ${{runner.workspace}}/ccache
key: ccache-${{matrix.os}}-${{matrix.compiler}}-${{matrix.qt}}-${{ github.sha }}
restore-keys: ccache-${{matrix.os}}-${{matrix.compiler}}-${{matrix.qt}}
if: matrix.os != 'windows-latest'
- name: (Linux) Set build info
if: runner.os == 'Linux'
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'
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
- name: (Linux/macOS) check ccache stats prior to build
if: runner.os == 'Linux' || runner.os == 'macOS'
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'
# enable for a debug build (1/2)
# buildWithCMakeArgs: --config RelWithDebInfo
cmakeAppendedArgs: >-
-G Ninja
-DCMAKE_PREFIX_PATH=${{env.MINGW_BASE_DIR}}
-DVCPKG_APPLOCAL_DEPS=OFF
env:
NINJA_STATUS: '[%f/%t %o/sec] '
- name: Upload GitHub Actions artifact of vcpkg build logs
if: failure()
uses: actions/upload-artifact@v3
with:
name: vcpkg-logs-${{ runner.os }}
path: ${{ github.workspace }}/vcpkg/buildtrees/**/*.log
- name: (Linux/macOS) check ccache stats post build
if: runner.os == 'Linux' || runner.os == 'macOS'
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: (Linux/macOS) restore Luarocks for packaging
uses: actions/cache@v3
with:
path: $HOME/.luarocks
key: ccache-${{matrix.os}}-${{matrix.compiler}}-${{hashFiles('.github/workflows/build-mudlet.yml')}}
restore-keys: ccache-${{matrix.os}}-${{matrix.compiler}}-
if: runner.os == 'Linux' || runner.os == 'macOS'
- name: (Linux/macOS) 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 -y
fi
env:
BUILD_FOLDER: ${{runner.workspace}}/b/ninja
RUNNER_OS: ${{runner.os}}
DEPLOY: ${{matrix.deploy}}
- name: (Linux/macOS) add ssh-agent for tag deployment
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: (Linux/macOS) package Mudlet
if: (runner.os == 'Linux' || runner.os == 'macOS') && matrix.deploy == 'deploy'
run: ${{github.workspace}}/CI/travis.after_success.sh
env:
BUILD_FOLDER: ${{runner.workspace}}/b/ninja
RUNNER_OS: ${{runner.os}}
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}}
AC_USERNAME: ${{secrets.APPLE_USERNAME}}
AC_PASSWORD: ${{secrets.APPLE_PASSWORD}}
- name: Upload packaged Mudlet
uses: actions/upload-artifact@v3
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: Prep binary for running tests
if: matrix.run_tests == 'true'
run: cp ${{runner.workspace}}/b/ninja/src/mudlet ${{github.workspace}}/src
shell: bash
- name: Run Lua tests
if: matrix.run_tests == 'true'
timeout-minutes: 5
uses: GabrielBB/[email protected]
with:
run: ${{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: Passed Lua tests
if: matrix.run_tests == 'true'
run: |
if [ -e /tmp/busted-tests-failed ]
then
echo "Lua tests failed - see the action above for detailed output."
exit 1
fi
- name: (windows) Show relevant setup logs
if: failure() && runner.os == 'Windows'
run: |
$env:WORKING_BASE_DIR = "${{runner.workspace}}\src"
if (Test-Path -Path "$env:WORKING_BASE_DIR\stderr.log") {
echo "Standard error log from non-vcpkg dependencies: "
cat $env:WORKING_BASE_DIR\stderr.log
}
if (Test-Path -Path "$env:WORKING_BASE_DIR\stdout.log") {
echo "Standard output log from non-vcpkg dependencies: "
cat $env:WORKING_BASE_DIR\stdout.log
}
if (Test-Path -Path "${{runner.workspace}}/b/ninja/CMakeFiles/CMakeOutput.log") {
echo "CMakeOutput.log: "
cat "${{runner.workspace}}/b/ninja/CMakeFiles/CMakeOutput.log"
}