-
Notifications
You must be signed in to change notification settings - Fork 65
384 lines (336 loc) · 12.3 KB
/
builds.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
# SPDX-License-Identifier: Apache-2.0 OR MIT
#
# SPDX-FileCopyrightText: Copyright 2021 Micron Technology, Inc.
name: Builds
on:
release:
types: [created]
push:
branches:
- master
- "v[0-9]+.[0-9]+"
paths:
- "**.c"
- "**.h"
- "**.h.in"
- "**/meson.build"
- "cross/*.ini"
- "scripts/build/*"
- "subprojects/*.wrap"
- "suppressions/**.supp"
- "tests/**.py"
- "tests/**.sh"
- .github/workflows/builds.yaml
- docs/openapi.json
- meson_options.txt
- VERSION
pull_request:
types: [opened, synchronize, reopened]
paths:
- "**.c"
- "**.h"
- "**.h.in"
- "**/meson.build"
- "cross/*.ini"
- "scripts/build/*"
- "subprojects/*.wrap"
- "suppressions/**.supp"
- "tests/**.py"
- "tests/**.sh"
- .github/workflows/builds.yaml
- docs/openapi.json
- meson_options.txt
- VERSION
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true
permissions: {}
env:
MESON_TESTTHREADS: 1
jobs:
determine-tag:
runs-on: ubuntu-latest
continue-on-error: false
outputs:
tag: ${{ steps.determine-tag.outputs.tag }}
steps:
- name: Determine tag
id: determine-tag
run: |
if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then
echo "tag=$GITHUB_BASE_REF" >> "$GITHUB_OUTPUT"
else
echo "tag=$GITHUB_REF_NAME" >> "$GITHUB_OUTPUT"
fi
normal:
runs-on: ubuntu-latest
needs:
- determine-tag
container:
image: ghcr.io/hse-project/ci-images/${{ matrix.image }}:${{ needs.determine-tag.outputs.tag }}
strategy:
fail-fast: false
matrix:
image:
- almalinux-8
- almalinux-9
- cross-s390x
- fedora-37
- ubuntu-18.04
- ubuntu-20.04
- ubuntu-22.04
toolchain: [gcc, clang]
buildtype: [release, debug]
steps:
# Let's talk about GitHub Actions for a minute, and why this has to
# exist. GitHub Actions doesn't support `matrix` in jobs.<job>.if or
# jobs.<job>.env.<var>, so we are left with this step exporting the
# environment variable, and then forced to add or append to
# jobs.<job>.steps.<step>.if. It is disgusting, and I hate it. You might
# ask, "Why don't you exit the job early as successful?" Reader, you're
# so funny. GitHub Actions doesn't support this basic feature that all
# other CI systems use. I can't even cancel the job. Fun system :).
#
# https://github.com/actions/runner/issues/662
- name: To skip or not to skip
id: to-skip
shell: sh +e {0}
run: |
skip="false"
echo "${{ matrix.image }}" | grep -P --quiet "(almalinux-8|almalinux-9|ubuntu-20.04|ubuntu-22.04)"
if [ $? -eq 0 ] && [ "$GITHUB_EVENT_NAME" != "release" ]; then
skip="true"
fi
echo "skip=$skip" >> "$GITHUB_OUTPUT"
- name: Checkout HSE
if: ${{ steps.to-skip.outputs.skip == 'false' }}
uses: actions/checkout@v3
- name: Determine branches
id: determine-branches
if: ${{ steps.to-skip.outputs.skip == 'false' }}
shell: sh +e {0}
run: |
for p in hse-java hse-python; do
branch=master
if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then
git ls-remote --exit-code --heads \
"https://github.com/hse-project/$p.git" "$GITHUB_HEAD_REF" \
> /dev/null
if [ $? -eq 0 ]; then
branch="$GITHUB_HEAD_REF"
fi
elif [ "$GITHUB_EVENT_NAME" = "release" ]; then
branch=$(git rev-parse --abbrev-ref HEAD)
else
git ls-remote --exit-code --heads \
"https://github.com/hse-project/$p.git" "$GITHUB_REF" \
> /dev/null
if [ $? -eq 0 ]; then
branch="$GITHUB_REF_NAME"
fi
fi
echo "$p=$branch" >> "$GITHUB_OUTPUT"
done
- name: Checkout hse-java
if: ${{ steps.to-skip.outputs.skip == 'false' }}
uses: actions/checkout@v3
with:
repository: hse-project/hse-java
path: subprojects/hse-java
ref: ${{ steps.determine-branches.outputs.hse-java }}
- name: Checkout hse-python
if: ${{ steps.to-skip.outputs.skip == 'false' }}
uses: actions/checkout@v3
with:
repository: hse-project/hse-python
path: subprojects/hse-python
ref: ${{ steps.determine-branches.outputs.hse-python }}
- name: Export Maven local repository
id: maven-local-repository
if: ${{ steps.to-skip.outputs.skip == 'false' }}
run: |
local_repository=$(mvn --file subprojects/hse-java/pom.xml help:evaluate -Dexpression=settings.localRepository --quiet -DforceStdout)
echo "local-repository=$local_repository" >> "$GITHUB_OUTPUT"
- name: Cache Maven dependencies
id: maven-dependencies
if: ${{ steps.to-skip.outputs.skip == 'false' }}
uses: actions/cache@v3
with:
path: ${{ steps.maven-local-repository.outputs.local-repository }}
key: maven-dependencies-${{ hashFiles('subprojects/hse-java/pom.xml') }}
# Download all dependencies up front if cache wasn't hit. Will keep
# Maven from downloading dependencies during the test phase which could
# cause tests to timeout.
- name: Download Maven dependencies
if: ${{ steps.to-skip.outputs.skip == 'false' && steps.maven-dependencies.outputs.cache-hit != 'true' }}
run: |
mvn --file subprojects/hse-java/pom.xml dependency:go-offline
- name: Cache Meson packagecache
id: meson-packagecache
if: ${{ steps.to-skip.outputs.skip == 'false' }}
uses: actions/cache@v3
with:
path: subprojects/packagecache
key: meson-packagecache-${{ matrix.image }}-${{ hashFiles('subprojects/*.wrap') }}
# userspace-rcu leaks warnings as errors due to static inlines. Another
# mitigation is adding -U_LGPL_SOURCE which moves the functions out of
# line. Unfortunately you can no longer embed cds_list_head in structs.
# This seems like the easiest solution regarding WERROR.
- name: Export cross arguments
if: ${{ steps.to-skip.outputs.skip == 'false' && startsWith(matrix.image, 'cross') }}
run: |
image="${{ matrix.image }}"
echo "CROSS_ARGS=--cross-file cross/${image##*-}.ini --cross-file cross/common.ini" >> "$GITHUB_ENV"
echo "WERROR=" >> "$GITHUB_ENV"
- name: Export non-cross arguments
if: ${{ steps.to-skip.outputs.skip == 'false' && !startsWith(matrix.image, 'cross') }}
run: |
echo "WERROR=--werror" >> "$GITHUB_ENV"
# Download all dependencies up front if cache wasn't hit. Will keep
# Maven from downloading dependencies during the test phase which could
# cause tests to timeout.
- name: Download Maven Dependencies
if: ${{ steps.to-skip.outputs.skip == 'false' && steps.setup-java.outputs.cache-hit != 'true' }}
run: |
mvn --file subprojects/hse-java/pom.xml dependency:go-offline
- name: Setup gcc toolchain
if: ${{ steps.to-skip.outputs.skip == 'false' && matrix.toolchain == 'gcc' }}
run: |
echo "CC=gcc" >> "$GITHUB_ENV"
echo "CXX=g++" >> "$GITHUB_ENV"
- name: Setup clang toolchain
if: ${{ steps.to-skip.outputs.skip == 'false' && matrix.toolchain == 'clang' }}
run: |
echo "CC=clang" >> "$GITHUB_ENV"
echo "CXX=clang++" >> "$GITHUB_ENV"
# Ignore deprecation warnings on 20.04 due to:
# https://github.com/cython/cython/issues/3474
- name: Setup clang toolchain on Ubuntu 20.04
if: ${{ steps.to-skip.outputs.skip == 'false' && matrix.toolchain == 'clang' && matrix.image == 'ubuntu-20.04' }}
run: |
echo "CFLAGS=-Wno-deprecated ${CFLAGS}" >> "$GITHUB_ENV"
# Tools are disabled due to deprecated support in Meson for CMake
# versions this old.
- name: Setup
if: ${{ steps.to-skip.outputs.skip == 'false' }}
run: |
meson setup builddir --fatal-meson-warnings $WERROR $CROSS_ARGS \
--buildtype=${{ matrix.buildtype }} -Dtools=enabled \
-Ddocs=disabled -Dbindings=all
- name: Build
if: ${{ steps.to-skip.outputs.skip == 'false' }}
run: |
ninja -C builddir
- name: Test
if: ${{ steps.to-skip.outputs.skip == 'false' && !startsWith(matrix.image, 'cross') }}
run: |
meson test -C builddir --setup=ci --print-errorlogs --no-stdsplit
- uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: ${{ github.job }}-${{ matrix.image }}-${{ matrix.toolchain }}-${{ matrix.buildtype }}
path: |
builddir/meson-logs/
/var/log/messages
/var/log/syslog
asan-ubsan:
runs-on: ubuntu-latest
needs:
- determine-tag
container:
image: ghcr.io/hse-project/ci-images/fedora-37:${{ needs.determine-tag.outputs.tag }}
strategy:
fail-fast: false
matrix:
buildtype: [release, debug]
steps:
- name: Checkout HSE
uses: actions/checkout@v3
- name: Cache Meson packagecache
uses: actions/cache@v3
with:
path: subprojects/packagecache
key: meson-packagecache-${{ hashFiles('subprojects/*.wrap') }}
- name: Export toolchain
shell: sh {0}
run: |
res=$(expr $(date +%d) % 2)
if [ $res -eq 1 ]; then
echo CC=gcc >> "$GITHUB_ENV"
echo CXX=g++ >> "$GITHUB_ENV"
else
echo CC=clang >> "$GITHUB_ENV"
echo CXX=clang++ >> "$GITHUB_ENV"
fi
- name: Setup
run: |
MESON_ARGS=
if [ "$CC" = "clang" ]; then
# Without this, linking will fail with undefined symbols.
MESON_ARGS="-Db_lundef=false"
fi
meson setup builddir --fatal-meson-warnings --werror \
--buildtype=${{ matrix.buildtype }} -Db_sanitize=address,undefined \
$MESON_ARGS -Dtools=enabled -Ddocs=disabled -Dbindings=none
- name: Build
run: |
ninja -C builddir
- name: Test
run: |
meson test -C builddir --setup=ci --print-errorlogs --no-stdsplit
- uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: ${{ github.job }}-${{ matrix.buildtype }}
path: |
builddir/meson-logs/
/var/log/messages
/var/log/syslog
lto:
runs-on: ubuntu-latest
needs:
- determine-tag
container:
image: ghcr.io/hse-project/ci-images/fedora-37:${{ needs.determine-tag.outputs.tag }}
strategy:
fail-fast: false
matrix:
buildtype: [release, debug]
steps:
- name: Checkout HSE
uses: actions/checkout@v3
- name: Cache Meson packagecache
uses: actions/cache@v3
with:
path: subprojects/packagecache
key: meson-packagecache-${{ hashFiles('subprojects/*.wrap') }}
- name: Export toolchain
shell: sh {0}
run: |
res=$(expr $(date +%d) % 2)
if [ $res -eq 0 ]; then
echo CC=gcc >> "$GITHUB_ENV"
echo CXX=g++ >> "$GITHUB_ENV"
else
echo CC=clang >> "$GITHUB_ENV"
echo CXX=clang++ >> "$GITHUB_ENV"
fi
- name: Setup
run: |
meson setup builddir --fatal-meson-warnings --werror \
--buildtype=${{ matrix.buildtype }} -Db_lto=true -Dtools=enabled \
-Ddocs=disabled -Dbindings=none
- name: Build
run: |
ninja -C builddir
- name: Test
run: |
meson test -C builddir --setup=ci --print-errorlogs --no-stdsplit
- uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: ${{ github.job }}-${{ matrix.buildtype }}
path: |
builddir/meson-logs/
/var/log/messages
/var/log/syslog