-
Notifications
You must be signed in to change notification settings - Fork 0
385 lines (337 loc) · 13.8 KB
/
main.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
# This is a basic workflow to help you get started with Actions
name: CI
concurrency:
group: CI
cancel-in-progress: false
# Controls when the workflow will run
on:
push:
tags:
- 'v*'
branches:
- main
pull_request:
branches:
- main
types:
- opened
- edited
- synchronize
- reopened
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build:
strategy:
fail-fast: false
matrix:
flavor: [ubuntu, mac, windows]
compiler: [gcc, clang, msvc]
include:
# define operating systems
- flavor: ubuntu
os: ubuntu-24.04
- flavor: mac
os: macos-14
- flavor: windows
os: windows-latest
# CC
- compiler: msvc
is-experimental: false
- compiler: gcc
CC: gcc-14
CXX: g++-14
is-experimental: false
- compiler: clang
CC: clang
CXX: clang++
CC_LD: lld
CXX_LD: lld
is-experimental: true
# Mac stuff
- DEVELOPER_DIR: /Applications/Xcode_15.2.app/Contents/Developer
flavor: mac
exclude:
- flavor: windows
compiler: gcc
- flavor: windows
compiler: clang
- flavor: mac
compiler: clang
- flavor: mac
compiler: msvc
- flavor: ubuntu
compiler: msvc
permissions:
actions: read
contents: read
security-events: write
checks: write
env:
CC: ${{ matrix.CC }}
CXX: ${{ matrix.CXX }}
DEVELOPER_DIR: ${{ matrix.DEVELOPER_DIR }}
DEBEMAIL: ${{ vars.DEBEMAIL }}
DEBFULLNAME: ${{ vars.DEBFULLNAME }}
continue-on-error: ${{ matrix.is-experimental }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- if: ${{ matrix.compiler == 'clang' && matrix.flavor == 'ubuntu' }}
name: Install clang ubuntu
run: |
sudo apt-get install clang libc++-dev libc++abi-dev libstdc++-14-dev libhowardhinnant-date-dev
- if: ${{ matrix.compiler == 'gcc' && matrix.flavor == 'ubuntu' }}
name: Install gcc ubuntu
run: |
sudo apt-get install g++-14 libstdc++-14-dev
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 14
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 14
sudo update-alternatives --set gcc /usr/bin/gcc-14
sudo update-alternatives --set g++ /usr/bin/g++-14
- if: ${{ matrix.flavor == 'ubuntu' }}
name: Install deps ubuntu
run: |
sudo add-apt-repository -n ppa:talisein/ctre
sudo add-apt-repository -n ppa:talisein/libboost-ext-ut
sudo add-apt-repository -n ppa:talisein/outcome
sudo apt-get update
sudo apt-get install ninja-build liboutcome-dev libboost-ext-ut-dev libctre-dev libmagicenum-dev jq findutils meson
# python -m pip install meson
- if: ${{ matrix.flavor == 'mac' }}
name: Install deps mac
run: |
brew install meson ninja
- if: ${{ matrix.flavor == 'mac' && matrix.compiler == 'gcc' }}
name: Install gcc mac
run: |
brew search gcc@
brew install gcc@14
- if: ${{ matrix.flavor == 'windows' }}
name: Install Meson/Ninja Windows
run: |
python -m pip install meson
- if: ${{ matrix.flavor == 'windows' }}
uses: ilammy/msvc-dev-cmd@v1
- if: ${{ matrix.flavor == 'ubuntu' && matrix.compiler == 'gcc' && !startsWith(github.ref, 'refs/tags/v') }}
name: Initialize CodeQL
uses: github/codeql-action/init@v3
- name: Cache subprojects
id: meson-cache
uses: actions/cache@v4
with:
path: subprojects/packagecache
key: meson-build-cache-${{ runner.os }}-${{ github.run_id }}
enableCrossOsArchive: true
restore-keys: |
meson-build-cache-${{ runner.os }}-
meson-build-cache-
meson-build-cache
- if: ${{ (steps.meson-cache.outputs.cache-hit == 'true') && (matrix.flavor != 'windows') }}
name: List cache
run: ls subprojects/packagecache
continue-on-error: true
- if: ${{ (steps.meson-cache.outputs.cache-hit == 'true') && (matrix.flavor == 'windows') }}
name: List cache
run: dir subprojects/packagecache
continue-on-error: true
- if: ${{ matrix.flavor == 'ubuntu' && !startsWith(github.ref, 'refs/tags/v') }}
name: Configure Ubuntu 24 (Debug)
run: |
meson setup --warnlevel 3 --buildtype debug --default-library static --force-fallback-for libjpeg,libpng build
- if: ${{ matrix.flavor == 'ubuntu' && startsWith(github.ref, 'refs/tags/v') }}
name: Configure Ubuntu 24 (Release)
run: |
meson setup --warnlevel 3 --buildtype release --default-library static --force-fallback-for libjpeg,libpng build
- if: ${{ matrix.flavor == 'mac' && matrix.compiler == 'gcc' }}
name: Configure MacOS 14 GCC
run: |
meson setup --warnlevel 3 --buildtype release --default-library static -Dcpp_link_args="-static-libstdc++ -static-libgcc" --force-fallback-for libjpeg,libpng -Dcpp-httplib:cpp-httplib_openssl=disabled build
- if: ${{ matrix.flavor == 'mac' && matrix.compiler == 'clang' }}
name: Configure MacOS 14 clang
run: |
meson setup --warnlevel 3 --buildtype release --default-library static --force-fallback-for libjpeg,libpng -Dcpp-httplib:cpp-httplib_openssl=disabled build
- if: ${{ matrix.flavor == 'windows' }}
name: Configure Windows Latest
run: |
meson setup --warnlevel 3 --buildtype release -Dcpp_std=vc++latest --default-library static -Dcpp_eh=a -Dlibxml2:warning_level=0 -Dminiz:warning_level=0 -Dlibjpeg-turbo:warning_level=0 -Dcpp-httplib:cpp-httplib_openssl=disabled -Dcpp-httplib:cpp_std=vc++latest -Dlibxmlpp:build-tests=false -Dlibxml2:python=disabled -Dlibxml2:iconv=disabled --force-fallback-for libpng build
- name: Compile
run: ninja -C build
- if: ${{ matrix.flavor == 'ubuntu' }}
name: ldd ubuntu
run: |
meson introspect --targets build | jq '.[] | select(.type == "executable" and .subproject == null) | .filename[]' | xargs ldd
continue-on-error: true
- if: ${{ matrix.flavor == 'mac' }}
name: ldd macos
run: otool -L build/src/dregarnuhr
continue-on-error: true
- if: ${{ matrix.flavor == 'windows' }}
name: ldd windows
run: dumpbin /DEPENDENTS build/src/dregarnuhr.exe
continue-on-error: true
- name: Test
id: unittests
run: meson test -C build --print-errorlogs
- name: Test Reporter
uses: dorny/[email protected]
if: ${{ always() }}
continue-on-error: true
with:
name: Unit tests ${{ matrix.os }} ${{ matrix.compiler }}
path: 'build/meson-logs/testlog.junit.xml,build/*junit.xml'
reporter: java-junit
fail-on-error: false
- if: ${{ steps.unittests.conclusion == 'failure' && failure() }}
name: Test backtrace
run: |
sudo apt-get install gdb
gdb --batch -ex "run" -ex "bt full" -ex "quit" --args build/src/utils_test
gdb --batch -ex "run" -ex "bt full" -ex "quit" --args build/src/volumes_test
- name: Save logs
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: meson-log ${{ matrix.os }} ${{ matrix.compiler }}
path: |
build/meson-logs/meson-log.txt
build/meson-logs/testlog.txt
if-no-files-found: ignore
retention-days: 5
- if: ${{ matrix.flavor == 'ubuntu' && matrix.compiler == 'gcc' && !startsWith(github.ref, 'refs/tags/v') }}
name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
# Generate tarball for PPA
- if: ${{ matrix.flavor == 'ubuntu' && matrix.compiler == 'gcc' && startsWith(github.ref, 'refs/tags/v') }}
name: Get debuild dependencies
run: |
sudo add-apt-repository -n ppa:talisein/libxml++5.0
sudo add-apt-repository -n ppa:talisein/miniz
sudo apt-get update
sudo apt-get install cmake libcpp-httplib-dev libxml++5.0-dev libminiz3-dev debmake debhelper devscripts equivs distro-info-data distro-info dpkg-dev git-buildpackage
- if: ${{ matrix.flavor == 'ubuntu' && matrix.compiler == 'gcc' && startsWith(github.ref, 'refs/tags/v') }}
name: Generate PPA tarball
run: |
git config user.email "$DEBEMAIL"
git config user.name "$DEBFULLNAME"
gbp dch --ignore-branch -c -R --spawn-editor=never
meson dist -C build --no-tests --formats gztar
cd build/meson-dist
tar -xf dregarnuhr*.tar.gz
- if: ${{ matrix.flavor == 'ubuntu' && matrix.compiler == 'gcc' && startsWith(github.ref, 'refs/tags/v') }}
name: Publish PPA Snapshot
continue-on-error: true
env:
LD_PRELOAD:
GPG_PRIVATE_KEY: ${{ secrets.PPA_PGP_SECRET_KEY }}
DEB_GPG_PASSPHRASE: ${{ secrets.PPA_PGP_PASSPHRASE }}
DEB_SIGN_KEYID: ${{ secrets.PPA_PGP_KEY_ID }}
REPOSITORY: ppa:talisein/dregarnuhr
run: |
cd build/meson-dist/dregarnuhr*/
echo "$GPG_PRIVATE_KEY" | gpg --batch --pinentry-mode loopback --passphrase "$GPG_PASSPHRASE" --import
debmake
debuild -S -p"gpg --batch --no-tty --status-fd 1 --with-colons --passphrase "$DEB_GPG_PASSPHRASE" --pinentry-mode loopback" --force-sign -sa
dput $REPOSITORY ../*.changes
# Capture the binary
- if: ${{ matrix.flavor != 'windows' && (success() || failure()) }}
name: Binary Ubuntu/Mac
uses: actions/upload-artifact@v4
with:
name: dregarnuhr-${{ matrix.os }}-${{ matrix.compiler }}
path: build/src/dregarnuhr
- if: ${{ matrix.flavor == 'windows' && (success() || failure()) }}
name: Binary Windows
uses: actions/upload-artifact@v4
with:
name: dregarnuhr-${{ matrix.os }}
path: build/src/dregarnuhr.exe
check-run-linux:
needs: build
runs-on: ubuntu-24.04
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
- run: |
chmod u+x dregarnuhr-ubuntu-24.04-gcc/dregarnuhr
dregarnuhr-ubuntu-24.04-gcc/dregarnuhr --check --verbose
check-run-macos-14:
needs: build
runs-on: macos-14
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
- run: |
chmod u+x dregarnuhr-macos-14-gcc/dregarnuhr
dregarnuhr-macos-14-gcc/dregarnuhr --check --verbose
# check-run-macos-14-clang:
# needs: build
# runs-on: macos-14
# steps:
# - name: Download Artifacts
# uses: actions/download-artifact@v4
#
# - run: |
# chmod u+x dregarnuhr-macos-14-clang/dregarnuhr
# dregarnuhr-macos-14-clang/dregarnuhr --check --verbose
check-run-win:
needs: build
runs-on: windows-latest
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
- run: dregarnuhr-windows-latest/dregarnuhr.exe --check --verbose
release:
if: startsWith(github.ref, 'refs/tags/v')
needs: [check-run-linux, check-run-macos-14, check-run-win]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: true
- name: Download Artifacts
uses: actions/download-artifact@v4
- id: myref
env:
REF: ${{ github.event.ref }}
run: echo "::set-output name=MYREF::`echo $REF | cut -b 11-`"
- run: chmod u+x dregarnuhr-ubuntu-24.04-gcc/dregarnuhr
- run: tar -C ./dregarnuhr-ubuntu-24.04-gcc -cJvf "dregarnuhr-linux-${{ steps.myref.outputs.MYREF }}.tar.xz" dregarnuhr
- run: chmod u+x dregarnuhr-macos-12-gcc/dregarnuhr
- run: tar -C ./dregarnuhr-macos-12-gcc -czvf "dregarnuhr-mac-${{ steps.myref.outputs.MYREF }}.tar.gz" dregarnuhr
- run: zip -j "./dregarnuhr-windows-${{ steps.myref.outputs.MYREF }}.zip" dregarnuhr-windows-latest/dregarnuhr.exe
- run: ls
- name: Release Linux Artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dregarnuhr-linux-${{ steps.myref.outputs.MYREF }}.tar.xz
asset_name: dregarnuhr-ubuntu24.04-${{ steps.myref.outputs.MYREF }}.tar.xz
asset_content_type: application/x-xz
- name: Release Mac Artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dregarnuhr-mac-${{ steps.myref.outputs.MYREF }}.tar.gz
asset_name: dregarnuhr-mac-${{ steps.myref.outputs.MYREF }}.tar.gz
asset_content_type: application/gzip
- name: Release Windows Artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dregarnuhr-windows-${{ steps.myref.outputs.MYREF }}.zip
asset_name: dregarnuhr-windows-${{ steps.myref.outputs.MYREF }}.zip
asset_content_type: application/zip