-
Notifications
You must be signed in to change notification settings - Fork 204
327 lines (288 loc) · 11.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
name: CI
on:
push:
branches:
- branch_v1_10
tags:
- 'v1_10_*'
pull_request:
branches:
- branch_v1_10
jobs:
build-windows:
runs-on: windows-2019
strategy:
matrix:
configuration: [ Debug, Release ]
platform: [ x86, x64 ]
steps:
- uses: actions/checkout@v2
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.0.2
- name: Build
run: msbuild frontend/applets/win32/src/Applet.sln -t:Rebuild -p:Configuration=${{ matrix.configuration }} -p:Platform=${{ matrix.platform }}
- name: Upload artifacts to GitHub
uses: actions/upload-artifact@v2
with:
name: applet
path: |
frontend/applets/win32/src/x64/Release/workrave-applet64.dll
frontend/applets/win32/src/Release/workrave-applet.dll
frontend/applets/win32/src/x64/Debug/workrave-applet64.dll
frontend/applets/win32/src/Debug/workrave-applet.dll
build-mingw:
runs-on: ubuntu-20.04
needs: [ build-windows ]
strategy:
matrix:
config:
- image: mingw-gtk2
configuration: Release
compiler: gcc
upload: true
- image: mingw-gtk2
configuration: Debug
compiler: gcc
upload: true
- image: mingw-gtk
configuration: Release
compiler: gcc
upload: false
- image: mingw-gtk
configuration: Debug
compiler: gcc
upload: false
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Download applet artifacts from GitHub
uses: actions/download-artifact@v2
with:
name: applet
path: _vsbuild
- name: Build
run: |
if [[ $DOCKER_IMAGE ]]; then
IFS=$'\n'
docker run --rm \
-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/build/ci/build.sh"
fi
env:
WORKRAVE_TAG: ${{ env.GITHUB_TAG }}
WORKRAVE_ENV: github-docker
WORKRAVE_JOB_INDEX: m${{ strategy.job-index }}
CONF_COMPILER: ${{ matrix.config.compiler }}
CONF_GTK_VER: ${{ matrix.config.gtk_version }}
CONF_ENABLE: ${{ matrix.config.enable }}
CONF_DISABLE: ${{ matrix.config.disable }}
CONF_DISTCHECK: ${{ matrix.config.distcheck }}
CONF_CONFIGURATION: ${{ matrix.config.configuration }}
DOCKER_IMAGE: ${{ matrix.config.image }}
- name: Upload artifacts to GitHub
uses: actions/upload-artifact@v2
if: ${{ matrix.config.upload }}
with:
name: artifacts
path: _deploy
build-linux:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
max-parallel: 20
matrix:
config:
- image: ubuntu-focal
compiler: gcc
gtk_version: 3
distcheck: yes
upload: true
enable: gnome3,gsettings,xml,pulse,indicator,xfce,mate,dbus,distribution,experimental,gconf,gstreamer,exercises
- image: ubuntu-focal
compiler: gcc
gtk_version: 3
enable: gnome3,pulse,dbus,experimental,gstreamer,exercises,xml
disable: gsettings,gconf,indicator,xfce,mate,debug,distribution,tests,tracing
- image: ubuntu-jammy
compiler: gcc
gtk_version: 3
enable: gnome3,gsettings,xml,pulse,indicator,xfce,mate,dbus,distribution,experimental,gconf,gstreamer,exercises
- image: ubuntu-lunar
compiler: gcc
gtk_version: 3
enable: gnome3,gsettings,xml,pulse,indicator,xfce,mate,dbus,distribution,experimental,gconf,gstreamer,exercises
- image: ubuntu-mantic
compiler: gcc
gtk_version: 3
enable: gnome3,gsettings,xml,pulse,indicator,xfce,mate,dbus,distribution,experimental,gconf,gstreamer,exercises
- image: debian-testing
compiler: gcc
gtk_version: 3
enable: gnome3,gsettings,xml,pulse,indicator,xfce,mate,dbus,distribution,experimental,gconf,gstreamer,exercises
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Build
run: |
if [[ $DOCKER_IMAGE ]]; then
IFS=$'\n'
docker run --rm \
-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/build/ci/build.sh" || $FAILURE_ACTION
fi
env:
WORKRAVE_TAG: ${{ env.GITHUB_TAG }}
WORKRAVE_ENV: github-docker
WORKRAVE_JOB_INDEX: l${{ strategy.job-index }}
CONF_COMPILER: ${{ matrix.config.compiler }}
CONF_GTK_VER: ${{ matrix.config.gtk_version }}
CONF_ENABLE: ${{ matrix.config.enable }}
CONF_DISABLE: ${{ matrix.config.disable }}
CONF_DISTCHECK: ${{ matrix.config.distcheck }}
CONF_CONFIGURATION: ${{ matrix.config.configuration }}
DOCKER_IMAGE: ${{ matrix.config.image }}
FAILURE_ACTION: ${{ matrix.config.experimental == true }}
- name: Upload artifacts to GitHub
uses: actions/upload-artifact@v2
if: ${{ matrix.config.upload }}
with:
name: artifacts
path: _deploy
deploy:
runs-on: ubuntu-20.04
needs: [ build-linux, build-mingw ]
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/download-artifact@v2
with:
name: artifacts
path: _deploy
- 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 _deploy s3://snapshots/v1.10
env:
WORKSPACE: ${{ github.workspace }}
SNAPSHOTS_SECRET_ACCESS_KEY: ${{ secrets.SNAPSHOTS_SECRET_ACCESS_KEY }}
- name: Create artifact catalog
run: |
cd $GITHUB_WORKSPACE/build/catalog
npm i
node --experimental-modules main.js
env:
WORKSPACE: ${{ github.workspace }}
SNAPSHOTS_SECRET_ACCESS_KEY: ${{ secrets.SNAPSHOTS_SECRET_ACCESS_KEY }}
release:
runs-on: ubuntu-20.04
needs: [ build-linux, build-mingw ]
if: startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, '-rc')
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Download artifacts
uses: actions/download-artifact@v2
with:
name: artifacts
path: artifacts
- name: Prepare
id: prepare
run: |
TAG=${GITHUB_REF#refs/*/}
VERSION=$(echo $TAG | sed -e 's/_/./g' -e 's/-.*//g')
echo "TAG=${TAG}" >> $GITHUB_ENV
echo "VERSION=${VERSION}" >> $GITHUB_ENV
CATALOGS=$( find ${{ github.workspace }}/artifacts/ -name "job-catalog*" )
PORTABLE=$(jq -r '.builds[].artifacts[] | select(.kind == "portable" and .platform == "windows" and .configuration=="release") | .filename' ${CATALOGS})
PORTABLE=$(find ${{ github.workspace }}/artifacts/ -name $PORTABLE)
echo ::set-output name=portable_file::${PORTABLE}
echo ::set-output name=portable_name::workrave-win32-${VERSION}-portable.zip
INSTALLER=$(jq -r '.builds[].artifacts[] | select(.kind == "installer" and .platform == "windows" and .configuration=="release") | .filename' ${CATALOGS})
INSTALLER=$(find ${{ github.workspace }}/artifacts/ -name $INSTALLER)
echo ::set-output name=installer_file::${INSTALLER}
echo ::set-output name=installer_name::workrave-win32-${VERSION}.exe
SOURCE=$(jq -r '.builds[].artifacts[] | select(.kind == "source" and .platform == "all" and .configuration=="none") | .filename' ${CATALOGS})
SOURCE=$(find ${{ github.workspace }}/artifacts/ -name $SOURCE)
echo ::set-output name=source_file::${SOURCE}
echo ::set-output name=source_name::workrave-${VERSION}.tar.gz
- name: Generate news
run: |
cd ${{ github.workspace }}/build/newsgen
npm i
cd ${{ github.workspace }}
node ${{ github.workspace }}/build/newsgen/main.js \
--input "${{ github.workspace }}/changes.yaml" \
--template github \
--single \
--release $(echo $VERSION | sed -e 's/^v//g') \
--output "github-release-news"
- 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 ${{ env.VERSION }}
body_path: ${{ github.workspace }}/github-release-news
draft: true
prerelease: false
- name: Upload portable
if: steps.prepare.outputs.portable_file
id: upload-portable
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.prepare.outputs.portable_file }}
asset_name: ${{ steps.prepare.outputs.portable_name }}
asset_content_type: application/zip
- name: Upload installer
if: steps.prepare.outputs.installer_file
id: upload-installer
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.prepare.outputs.installer_file }}
asset_name: ${{ steps.prepare.outputs.installer_name }}
asset_content_type: application/octet-stream
- name: Upload source
if: steps.prepare.outputs.source_file
id: upload-source
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.prepare.outputs.source_file }}
asset_name: ${{ steps.prepare.outputs.source_name }}
asset_content_type: application/gzip
website:
runs-on: ubuntu-20.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