-
Notifications
You must be signed in to change notification settings - Fork 202
472 lines (426 loc) · 16.4 KB
/
ci.yaml
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
461
462
463
464
465
466
467
468
469
470
471
472
name: CI
on:
push:
branches:
- "main"
- "topic/*"
tags:
- "v1_11_*"
pull_request:
branches:
- "main"
- "topic/*"
jobs:
prep:
runs-on: ubuntu-latest
outputs:
WORKRAVE_BUILD_DATETIME: ${{ steps.out.outputs.WORKRAVE_BUILD_DATETIME }}
WORKRAVE_BUILD_DATE: ${{ steps.out.outputs.WORKRAVE_BUILD_DATE }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: "recursive"
- id: out
run: |
export WORKRAVE_ENV=github-ubuntu
source ./tools/ci/config.sh
echo "WORKRAVE_BUILD_DATETIME=${WORKRAVE_BUILD_DATETIME}" >> $GITHUB_OUTPUT
echo "WORKRAVE_BUILD_DATE=${WORKRAVE_BUILD_DATE}" >> $GITHUB_OUTPUT
- name: Create catalog root
run: |
export WORKRAVE_ENV=github-ubuntu
${{ github.workspace }}/tools/ci/catalog.sh
env:
WORKRAVE_JOB_INDEX: 9999
WORKRAVE_BUILD_DATETIME: ${{ needs.prep.outputs.WORKRAVE_BUILD_DATETIME }}
WORKRAVE_BUILD_DATE: ${{ needs.prep.outputs.WORKRAVE_BUILD_DATE }}
- name: Upload artifacts to GitHub
uses: actions/upload-artifact@v3
with:
name: artifacts
path: _deploy
build-windows-vcpkg:
name: windows vcpkg
env:
VCPKG_ROOT: C:/vcpkg
VCPKG_BINARY_SOURCES: "clear;nuget,GitHub,readwrite"
GH_NUGET_REGISTRY: https://nuget.pkg.github.com/rcaelers/index.json
runs-on: windows-latest
steps:
- name: prepare vcpkg
id: prep-vcpkg
shell: pwsh
run: |
${{ env.VCPKG_ROOT }}\bootstrap-vcpkg.bat
- name: setup NuGet credentials
shell: bash
run: >
$(${{ env.VCPKG_ROOT }}/vcpkg fetch nuget | tail -n 1)
sources add
-source "${{ env.GH_NUGET_REGISTRY }}"
-storepasswordincleartext
-name "GitHub"
-username "rcaelers"
-password "${{ secrets.GITHUB_TOKEN }}"
- name: setup NuGet API key
shell: bash
run: >
$(${{ env.VCPKG_ROOT }}/vcpkg fetch nuget | tail -n 1)
setapikey "${{ secrets.GITHUB_TOKEN }}"
-source "${{ env.GH_NUGET_REGISTRY }}"
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: "recursive"
- name: configure
shell: bash
run: |
env
pip install Ninja2
cmake -G "Visual Studio 17 2022" -A x64 -B '${{ github.workspace }}/_build' \
-DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake \
-DVCPKG_TARGET_TRIPLET=x64-windows \
-DCMAKE_BUILD_TYPE=Release \
-DWITH_UI=Gtk+3 \
-DWITH_CRASHPAD=OFF \
-DWITH_AUTO_UPDATE=ON \
-DWITH_TRACING=ON
- name: build
shell: bash
run: |
cmake --build '${{github.workspace}}/_build' --config Release
cmake --install '${{github.workspace}}/_build' --config Release
build-windows:
runs-on: windows-2019
if: ${{ false }}
strategy:
matrix:
configuration: [Debug, Release]
platform: [x86, x64]
steps:
- name: Keep line ending
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@v3
- name: Add msbuild to PATH
uses: microsoft/[email protected]
- name: Build
run: msbuild ui/applets/windows/src/Applet.sln -t:Rebuild -p:Configuration=${{ matrix.configuration }} -p:Platform=${{ matrix.platform }}
- name: Upload artifacts to GitHub
uses: actions/upload-artifact@v3
with:
name: applet
path: |
ui/applets/windows/src/x64/Release/workrave-applet64.dll
ui/applets/windows/src/Release/workrave-applet.dll
ui/applets/windows/src/x64/Debug/workrave-applet64.dll
ui/applets/windows/src/Debug/workrave-applet.dll
build-msys2:
runs-on: windows-latest
needs: prep
strategy:
matrix:
config:
- configuration: Release
ui: Gtk+3
enable: TESTS, CRASHPAD, AUTO_UPDATE
upload: true
- configuration: Debug
enable: TESTS, TRACING, CRASHPAD, AUTO_UPDATE
ui: Gtk+3
upload: true
- configuration: Release
ui: Qt
enable: TESTS, CRASHPAD, AUTO_UPDATE
- configuration: Debug
enable: TESTS, TRACING, CRASHPAD, AUTO_UPDATE
ui: Qt
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: "recursive"
- uses: msys2/setup-msys2@v2
with:
update: true
msystem: clang64
install: >-
git
mingw-w64-clang-i686-clang
mingw-w64-clang-i686-cmake
mingw-w64-clang-i686-boost
mingw-w64-clang-i686-lld
mingw-w64-clang-i686-spdlog
mingw-w64-clang-i686-ninja
mingw-w64-clang-x86_64-adwaita-icon-theme
mingw-w64-clang-x86_64-boost
mingw-w64-clang-x86_64-clang
mingw-w64-clang-x86_64-cmake
mingw-w64-clang-x86_64-gcc-compat
mingw-w64-clang-x86_64-gtkmm3
mingw-w64-clang-x86_64-lld
mingw-w64-clang-x86_64-ninja
mingw-w64-clang-x86_64-openssl
mingw-w64-clang-x86_64-python
mingw-w64-clang-x86_64-python-pip
mingw-w64-clang-x86_64-spdlog
mingw-w64-clang-x86_64-jq
mingw-w64-clang-x86_64-uasm
mingw-w64-clang-x86_64-rust
mingw-w64-clang-x86_64-qt6-base
mingw-w64-clang-x86_64-qt6-svg
mingw-w64-clang-x86_64-qt6-tools
tar
xz
zip
- name: Build 64 bit
shell: msys2 {0}
run: |
python -m pip install --upgrade pip
pip install wheel
pip install Jinja2
./tools/ci/build.sh
env:
WORKRAVE_ENV: github-windows-msys2
WORKRAVE_JOB_INDEX: l${{ strategy.job-index }}
CONF_UI: ${{ matrix.config.ui }}
CONF_CONFIGURATION: ${{ matrix.config.configuration }}
CONF_ENABLE: ${{ matrix.config.enable }}
WORKRAVE_BUILD_DATETIME: ${{ needs.prep.outputs.WORKRAVE_BUILD_DATETIME }}
WORKRAVE_BUILD_DATE: ${{ needs.prep.outputs.WORKRAVE_BUILD_DATE }}
- name: Upload artifacts to GitHub
uses: actions/upload-artifact@v3
if: ${{ matrix.config.upload }}
with:
name: artifacts
path: _deploy
build-cmake:
runs-on: ${{ matrix.config.os }}
needs: prep
defaults:
run:
shell: bash
strategy:
fail-fast: false
max-parallel: 20
matrix:
config:
- image: ubuntu-focal
os: ubuntu-22.04
compiler: gcc
ui: Gtk+3
enable: INDICATOR,GNOME_CLASSIC_PANEL,GSTREAMER,PULSE,TESTS
disable: COVERAGE,TRACING
- image: ubuntu-jammy
os: ubuntu-22.04
compiler: gcc
ui: Gtk+3
enable: INDICATOR,GNOME_CLASSIC_PANEL,GSTREAMER,PULSE,TESTS
disable: COVERAGE,TRACING
appimage: true
upload: true
- image: ubuntu-mantic
os: ubuntu-22.04
compiler: gcc
ui: Gtk+3
enable: INDICATOR,GNOME45,GNOME_CLASSIC_PANEL,GSTREAMER,PULSE,TESTS
disable: COVERAGE,TRACING
- image: ubuntu-noble
os: ubuntu-22.04
compiler: gcc
ui: Gtk+3
enable: INDICATOR,GNOME45,GNOME_CLASSIC_PANEL,GSTREAMER,PULSE,TESTS
disable: COVERAGE,TRACING
# - image: mingw-fedora-rawhide
# os: ubuntu-22.04
# compiler: clang
# ui: Gtk+3
# configuration: Release
# enable:
# disable: INDICATOR,GSTREAMER,PULSE,GNOME_CLASSIC_PANEL,TESTS,COVERAGE,TRACING
# upload: false
# - image: mingw-fedora-rawhide
# os: ubuntu-22.04
# compiler: clang
# ui: Gtk+3
# configuration: Debug
# enable: TRACING
# disable: INDICATOR,GSTREAMER,PULSE,GNOME_CLASSIC_PANEL,TESTS,COVERAGE
# upload: false
- os: macos-latest
compiler: clang
ui: Qt
enable: TESTS,COVERAGE,TRACING
disable: INDICATOR,GSTREAMER,PULSE,GNOME_CLASSIC_PANEL
# - image: windows-msys2
# os: windows-latest
# ui: Gtk+3
# disable: INDICATOR,GSTREAMER,PULSE,GNOME_CLASSIC_PANEL
# enable: TESTS,CRASHPAD,AUTO_UPDATE
# configuration: Release
# upload: true
# - image: windows-msys2
# os: windows-latest
# ui: Gtk+3
# disable: INDICATOR,GSTREAMER,PULSE,GNOME_CLASSIC_PANEL
# enable: TESTS,TRACING,CRASHPAD,AUTO_UPDATE
# configuration: Debug
# upload: true
steps:
- name: Prepare
run: |
if [[ $GITHUB_REF == refs/tags/* ]]; then
echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
elif [[ $GITHUB_REF == refs/heads/next ]]; then
echo "version=latest" >> $GITHUB_OUTPUT
elif [[ $GITHUB_REF == refs/heads/* ]]; then
echo "version=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT
else
echo "version=dev" >> $GITHUB_OUTPUT
fi
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Prepare docker
id: image_digest
if: runner.os == 'Windows'
run: |
mkdir -p ~/_docker-cache
echo "digest=$(docker manifest inspect ghcr.io/rcaelers/workrave-build:${{ matrix.config.image }} -v | jq -r '.Descriptor.digest' | cut -d: -f2)" >> $GITHUB_OUTPUT
shell: bash
- name: Prepare docker image cache
id: docker-cache
if: runner.os == 'Windows'
uses: actions/cache@v3
with:
path: ~/_docker-cache
key: docker-cache-${{ steps.image_digest.outputs.digest }}
- name: Download image if cache is outdated
if: steps.docker-cache.outputs.cache-hit != 'true' && runner.os == 'Windows'
run: |
docker pull ghcr.io/rcaelers/workrave-build:${{ matrix.config.image }}
docker save -o ~/_docker-cache/${{ matrix.config.image }}.tar ghcr.io/rcaelers/workrave-build:${{ matrix.config.image }}
- name: Use cache if current
if: steps.docker-cache.outputs.cache-hit == 'true' && runner.os == 'Windows'
run: docker load -i ~/_docker-cache/${{ matrix.config.image }}.tar
- name: Setup build env
if: matrix.config.os == 'macos-latest'
run: |
brew install gettext qt python3 boost ninja spdlog pkg-config || true
brew link gettext --force
brew link --overwrite [email protected]
brew outdated cmake || brew upgrade cmake
pip3 install --break-system-packages --user Jinja2 # required for dbus support, system (distro) wide include paths are ignored
- name: Build
run: |
if [[ $DOCKER_IMAGE ]]; then
if [[ $DOCKER_IMAGE =~ "windows-" ]]; then
IFS=$'\n'
export WORKRAVE_ENV=docker-windows-msys2
docker run --rm -v $GITHUB_WORKSPACE:c:\\workspace\\source \
`printenv | grep -E '^(CONF_.*|GITHUB_.*|DOCKER_IMAGE|WORKRAVE_.*)=' | sed -e 's/^/-e/g' ` \
ghcr.io/rcaelers/workrave-build:${DOCKER_IMAGE} \
sh -c "/c/workspace/source/tools/ci/build.sh"
elif [[ $DOCKER_IMAGE =~ "mingw" || $WORKRAVE_ENV =~ "-msys2" ]]; then
IFS=$'\n'
export WORKRAVE_ENV=docker-linux
docker run --security-opt seccomp=unconfined --rm \
${{ matrix.config.appimage && '--cap-add SYS_ADMIN --device /dev/fuse --security-opt apparmor:unconfined' || '' }} \
-v $GITHUB_WORKSPACE:/workspace/source \
`printenv | grep -E '^(CONF_.*|GITHUB_.*|DOCKER_IMAGE|WORKRAVE_.*)=' | sed -e 's/^/-e/g' ` \
ghcr.io/rcaelers/workrave-build:${DOCKER_IMAGE} \
sh -c "/workspace/source/tools/ci/build.sh"
else
IFS=$'\n'
export WORKRAVE_ENV=docker-linux
docker run --security-opt seccomp=unconfined --rm \
${{ matrix.config.appimage && '--cap-add SYS_ADMIN --device /dev/fuse --security-opt apparmor:unconfined' || '' }} \
-v $GITHUB_WORKSPACE:/workspace/source \
`printenv | grep -E '^(CONF_.*|GITHUB_.*|DOCKER_IMAGE|WORKRAVE_.*)=' | sed -e 's/^/-e/g' ` \
ghcr.io/rcaelers/workrave-build:${DOCKER_IMAGE} \
sh -c "/workspace/source/tools/ci/build.sh"
fi;
else
export WORKRAVE_ENV=github-ubuntu
$GITHUB_WORKSPACE/tools/ci/build.sh
fi
env:
WORKRAVE_JOB_INDEX: ${{ strategy.job-index }}
CONF_COMPILER: ${{ matrix.config.compiler }}
CONF_UI: ${{ matrix.config.ui }}
CONF_ENABLE: ${{ matrix.config.enable }}
CONF_DISABLE: ${{ matrix.config.disable }}
CONF_CONFIGURATION: ${{ matrix.config.configuration }}
CONF_APPIMAGE: ${{ matrix.config.appimage }}
DOCKER_IMAGE: ${{ matrix.config.image }}
WORKRAVE_BUILD_DATETIME: ${{ needs.prep.outputs.WORKRAVE_BUILD_DATETIME }}
WORKRAVE_BUILD_DATE: ${{ needs.prep.outputs.WORKRAVE_BUILD_DATE }}
- name: Upload artifacts to GitHub
uses: actions/upload-artifact@v3
if: ${{ matrix.config.upload }}
with:
name: artifacts
path: _deploy
deploy:
runs-on: ubuntu-22.04
needs: [prep, build-cmake, build-msys2]
if: github.event_name == 'push' && ( github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') )
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/download-artifact@v3
with:
name: artifacts
path: artifacts
- name: Sign
run: |
cd $GITHUB_WORKSPACE
echo '${{ secrets.ED25519_KEY }}' > ${SECRETS_DIR}/ed25519key.pem
$GITHUB_WORKSPACE/tools/ci/sign.sh
rm -f ed25519key.pem
env:
ED25519_KEY: ${{ secrets.ED25519_KEY }}
WORKSPACE: ${{ github.workspace }}
SECRETS_DIR: ${{ github.workspace }}
ARTIFACTS: ${{ github.workspace }}/artifacts/
WORKRAVE_BUILD_DATETIME: ${{ needs.prep.outputs.WORKRAVE_BUILD_DATETIME }}
WORKRAVE_BUILD_DATE: ${{ needs.prep.outputs.WORKRAVE_BUILD_DATE }}
- name: Upload artifacts to MinIO
run: |
aws configure set aws_access_key_id travis
aws configure set aws_secret_access_key $SNAPSHOTS_SECRET_ACCESS_KEY
aws configure set default.region us-east-1
aws configure set default.s3.signature_version s3v4
aws configure set s3.endpoint_url https://snapshots.workrave.org/
aws s3 --endpoint-url https://snapshots.workrave.org/ cp --recursive artifacts s3://snapshots/v1.11
env:
WORKSPACE: ${{ github.workspace }}
SNAPSHOTS_SECRET_ACCESS_KEY: ${{ secrets.SNAPSHOTS_SECRET_ACCESS_KEY }}
- name: Create artifact catalog / appcast
run: |
cd $GITHUB_WORKSPACE/tools/citool
npm i
npm run build
node $GITHUB_WORKSPACE/tools/citool/dist/citool.js catalog
node $GITHUB_WORKSPACE/tools/citool/dist/citool.js appcast
env:
WORKSPACE: ${{ github.workspace }}
SNAPSHOTS_SECRET_ACCESS_KEY: ${{ secrets.SNAPSHOTS_SECRET_ACCESS_KEY }}
WORKRAVE_BUILD_DATETIME: ${{ needs.prep.outputs.WORKRAVE_BUILD_DATETIME }}
WORKRAVE_BUILD_DATE: ${{ needs.prep.outputs.WORKRAVE_BUILD_DATE }}
website:
runs-on: ubuntu-22.04
if: github.event_name == 'push'
needs: [deploy]
steps:
- name: Trigger workrave.org rebuild
run: |
curl \
-X POST \
-H "Authorization: token ${{ secrets.TOKEN }}" \
-H 'Accept: application/vnd.github.everest-preview+json' \
-d '{"event_type":"rebuild"}' \
https://api.github.com/repos/rcaelers/workrave-website/dispatches