-
Notifications
You must be signed in to change notification settings - Fork 0
451 lines (396 loc) · 13 KB
/
ci.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
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
# SPDX-License-Identifier: GPL-2.0
#
# Copyright (c) 2021 Canonical Ltd.
# Copyright (c) 2023 Linaro Ltd.
# Author: Krzysztof Kozlowski <[email protected]>
# Loosely based on https://github.com/linux-test-project/ltp
#
name: "Builds"
on:
pull_request:
push:
schedule:
# Run at 1:01 AM, every Tuesday
- cron: '1 1 * * 2'
workflow_dispatch:
jobs:
job:
name: Build
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
strategy:
fail-fast: false
matrix:
arch: [x86-64]
compiler: [gcc, clang]
container:
- alpine:latest
- archlinux:latest
- debian:testing
- debian:stable
- debian:bookworm
- debian:bullseye
- debian:buster
# Fails on configure on GCC and clang (process restrictions?)
# - fedora:rawhide
- fedora:latest
- fedora:39
- fedora:38
- fedora:37
- fedora:36
- fedora:35
- fedora:34
- ubuntu:lunar
- ubuntu:kinetic
- ubuntu:jammy
- ubuntu:focal
- ubuntu:bionic
- ubuntu:xenial
cross_compile: [""]
mode: [maintainer, no-maintainer]
variant: [""]
include:
# Debian 32-bit builds
- container: "debian:testing"
arch: i386
compiler: gcc -m32
cross_compile: i686-linux-gnu
mode: maintainer
variant: i386
- container: "debian:testing"
arch: i386
compiler: gcc -m32
cross_compile: i686-linux-gnu
mode: no-maintainer
variant: i386
- container: "debian:stable"
arch: i386
compiler: gcc -m32
cross_compile: i686-linux-gnu
mode: maintainer
variant: i386
- container: "debian:stable"
arch: i386
compiler: gcc -m32
cross_compile: i686-linux-gnu
mode: no-maintainer
variant: i386
- container: "debian:bookworm"
arch: i386
compiler: gcc -m32
cross_compile: i686-linux-gnu
mode: maintainer
variant: i386
- container: "debian:bookworm"
arch: i386
compiler: gcc -m32
cross_compile: i686-linux-gnu
mode: no-maintainer
variant: i386
- container: "debian:bullseye"
arch: i386
compiler: gcc -m32
cross_compile: i686-linux-gnu
mode: maintainer
variant: i386
- container: "debian:bullseye"
arch: i386
compiler: gcc -m32
cross_compile: i686-linux-gnu
mode: no-maintainer
variant: i386
- container: "debian:buster"
arch: i386
compiler: gcc -m32
cross_compile: i686-linux-gnu
mode: maintainer
variant: i386
- container: "debian:buster"
arch: i386
compiler: gcc -m32
cross_compile: i686-linux-gnu
mode: no-maintainer
variant: i386
# Debian cross compilation builds
- container: "debian:testing"
arch: armel
compiler: arm-linux-gnueabi-gcc
cross_compile: arm-linux-gnueabi
mode: maintainer
variant: cross-compile
- container: "debian:testing"
arch: arm64
compiler: aarch64-linux-gnu-gcc
cross_compile: aarch64-linux-gnu
mode: maintainer
variant: cross-compile
- container: "debian:testing"
arch: ppc64el
compiler: powerpc64le-linux-gnu-gcc
cross_compile: powerpc64le-linux-gnu
mode: maintainer
variant: cross-compile
- container: "debian:testing"
arch: s390x
compiler: s390x-linux-gnu-gcc
cross_compile: s390x-linux-gnu
mode: maintainer
variant: cross-compile
- container: "debian:stable"
arch: armel
compiler: arm-linux-gnueabi-gcc
cross_compile: arm-linux-gnueabi
mode: maintainer
variant: cross-compile
- container: "debian:stable"
arch: arm64
compiler: aarch64-linux-gnu-gcc
cross_compile: aarch64-linux-gnu
mode: maintainer
variant: cross-compile
- container: "debian:stable"
arch: ppc64el
compiler: powerpc64le-linux-gnu-gcc
cross_compile: powerpc64le-linux-gnu
mode: maintainer
variant: cross-compile
- container: "debian:stable"
arch: s390x
compiler: s390x-linux-gnu-gcc
cross_compile: s390x-linux-gnu
mode: maintainer
variant: cross-compile
- container: "debian:bookworm"
arch: armel
compiler: arm-linux-gnueabi-gcc
cross_compile: arm-linux-gnueabi
mode: maintainer
variant: cross-compile
- container: "debian:bookworm"
arch: arm64
compiler: aarch64-linux-gnu-gcc
cross_compile: aarch64-linux-gnu
mode: maintainer
variant: cross-compile
- container: "debian:bookworm"
arch: ppc64el
compiler: powerpc64le-linux-gnu-gcc
cross_compile: powerpc64le-linux-gnu
mode: maintainer
variant: cross-compile
- container: "debian:bookworm"
arch: s390x
compiler: s390x-linux-gnu-gcc
cross_compile: s390x-linux-gnu
mode: maintainer
variant: cross-compile
- container: "debian:bullseye"
arch: armel
compiler: arm-linux-gnueabi-gcc
cross_compile: arm-linux-gnueabi
mode: maintainer
variant: cross-compile
- container: "debian:bullseye"
arch: arm64
compiler: aarch64-linux-gnu-gcc
cross_compile: aarch64-linux-gnu
mode: maintainer
variant: cross-compile
- container: "debian:bullseye"
arch: ppc64el
compiler: powerpc64le-linux-gnu-gcc
cross_compile: powerpc64le-linux-gnu
mode: maintainer
variant: cross-compile
- container: "debian:bullseye"
arch: s390x
compiler: s390x-linux-gnu-gcc
cross_compile: s390x-linux-gnu
mode: maintainer
variant: cross-compile
# Only arm64 builds on Buster (missing dependencies?)
- container: "debian:buster"
arch: arm64
compiler: aarch64-linux-gnu-gcc
cross_compile: aarch64-linux-gnu
mode: maintainer
variant: cross-compile
# Debian GCC sanitizer builds
- container: "debian:testing"
arch: x86-64
compiler: gcc
mode: maintainer
variant: sanitizers
- container: "debian:stable"
arch: x86-64
compiler: gcc
mode: maintainer
variant: sanitizers
- container: "debian:bookworm"
arch: x86-64
compiler: gcc
mode: maintainer
variant: sanitizers
- container: "debian:bullseye"
arch: x86-64
compiler: gcc
mode: maintainer
variant: sanitizers
- container: "debian:buster"
arch: x86-64
compiler: gcc
mode: maintainer
variant: sanitizers
# Ubuntu 32-bit builds
- container: "ubuntu:jammy"
arch: i386
compiler: gcc -m32
cross_compile: i686-linux-gnu
mode: maintainer
variant: i386
- container: "ubuntu:jammy"
arch: i386
compiler: gcc -m32
cross_compile: i686-linux-gnu
mode: no-maintainer
variant: i386
- container: "ubuntu:focal"
arch: i386
compiler: gcc -m32
cross_compile: i686-linux-gnu
mode: maintainer
variant: i386
- container: "ubuntu:focal"
arch: i386
compiler: gcc -m32
cross_compile: i686-linux-gnu
mode: no-maintainer
variant: i386
# Ubuntu GCC sanitizer builds
- container: "ubuntu:jammy"
arch: x86-64
compiler: gcc
mode: maintainer
variant: sanitizers
- container: "ubuntu:focal"
arch: x86-64
compiler: gcc
mode: maintainer
variant: sanitizers
container:
image: ${{ matrix.container }}
env:
ARCH: ${{ matrix.arch }}
CC: ${{ matrix.compiler }}
CROSS_COMPILE: ${{ matrix.cross_compile }}
MODE: ${{ matrix.mode }}
VARIANT: ${{ matrix.variant }}
steps:
- name: Show OS
run: cat /etc/os-release
- name: Show env (matrix settings)
run: |
echo "ARCH: $ARCH"
echo "CC: $CC"
echo "CROSS_COMPILE: $CROSS_COMPILE"
echo "MODE: $MODE"
echo "VARIANT: $VARIANT"
- name: Git checkout
uses: actions/checkout@v3
- name: Install additional packages
run: |
INSTALL=${{ matrix.container }}
INSTALL="${INSTALL%%:*}"
INSTALL="${INSTALL%%/*}"
./ci/$INSTALL.sh
if [ "$VARIANT" ]; then ./ci/$INSTALL.$VARIANT.sh; fi
- name: Compiler version
run: $CC --version
- name: Display environment and Linux version
run: |
test -f /etc/issue && cat /etc/issue
echo "############################################"
lsb_release -a || true
echo "############################################"
cat /usr/include/linux/version.h
echo "############################################"
uname -a
echo "############################################"
cat /proc/cmdline
echo "############################################"
printenv
- name: Display nfc.h differences between local and Linux kernel headers
run: diff -uBb /usr/include/linux/nfc.h include/nfc_copy.h || true
- name: Configure
id: configure
run: |
echo "Bootstraping in mode: $MODE"
CONFIGURE_ARGS=""
if [ "$VARIANT" = "sanitizers" ]; then
CONFIGURE_ARGS="--enable-asan --enable-lsan --enable-ubsan --enable-pie"
fi
CONFIGURE_CROSS=""
if [ "$CROSS_COMPILE" ]; then
CONFIGURE_CROSS="--host=${CROSS_COMPILE}"
fi
if [ "$MODE" = "maintainer" ]; then
./bootstrap-configure \
--disable-silent-rules \
$CONFIGURE_ARGS
else
CONFIGURE_ARGS="$CONFIGURE_ARGS $CONFIGURE_CROSS"
./bootstrap && \
./configure \
--disable-systemd \
--disable-silent-rules \
--prefix=/usr \
--enable-ese \
--sysconfdir=/etc \
--enable-tools \
$CONFIGURE_ARGS
fi
- name: Get configure logs
run: cat config.log
if: ${{ always() && ((steps.configure.outcome == 'failure') ||
(steps.configure.outcome == 'success')) }}
- name: Compile
run: make -j$(nproc)
- name: Run unit tests
id: unit_tests
run: |
make check
if: ${{ (matrix.arch == 'x86-64') || (matrix.arch == 'i386') }}
- name: Get unit tests logs
run: cat test-suite.log
if: ${{ always() && ((steps.unit_tests.outcome == 'failure') ||
(steps.unit_tests.outcome == 'success')) }}
- name: Check final binary
run: |
file src/neard
ARCH_CHECK="$ARCH"
case "$ARCH" in
armel) ARCH_CHECK="ARM, EABI";;
arm64) ARCH_CHECK="aarch64";;
i386) ARCH_CHECK="Intel 80386";;
ppc64el) ARCH_CHECK="64-bit PowerPC";;
s390x) ARCH_CHECK="IBM S/390";;
*) ARCH_CHECK="x86-64";;
esac
echo "Checking for built matching architecture: $ARCH_CHECK"
file src/neard | grep "$ARCH_CHECK"
if [ "$VARIANT" = "sanitizers" ]; then
echo "Checking for linking against sanitizer libraries"
ldd src/neard | grep libasan.so
# liblsan won't appear if asan is used
ldd src/neard | grep libubsan.so
fi
- name: Install
run: make install
- name: Distribution check
run: make distcheck
# distcheck runs unit tests so no point for cross compile
# TODO: figure out how to re-configure during distcheck with --host for i386 (DISTCHECK_CONFIGURE_FLAGS)
if: ${{ (matrix.arch == 'x86-64')}}