Debian Codegraph @

.github/workflows/meson-tests.yml

raw
1 #
2 # Meson Test Suite
3 #
4 # This workflow builds the project via meson, configures a suitable test
5 # environment, and then runs the test-suite defined in meson.
6 #
7 # We run the test-suite multiple times in parallel, each run with a different
8 # setup, ranging from release builds to non-standard configuration flags. We
9 # do not test the fully expanded matrix, but instead test a pre-defined set
10 # of setups, to reduce burden on the CI systems.
11 #
12
13 name: "Meson Test Suite"
14
15 on:
16 pull_request:
17 push:
18 branches-ignore: ["pr/**"]
19 tags: ["**"]
20 workflow_dispatch:
21
22 defaults:
23 run:
24 shell: "bash"
25
26 jobs:
27 unittest:
28 name: "Unittest - ${{ matrix.id }} - ${{ matrix.name }}"
29
30 strategy:
31 fail-fast: false
32 matrix:
33 include:
34 # Test a release build as recommended by upstream. This picks clang as
35 # compiler with debug-optimized as build-target. We do not run valgrind
36 # since it clashes with sd-bus used by the launcher. This test also
37 # builds documentation and related resources.
38 - id: "release"
39 name: "RELEASE @ CLANG-X86_64 @ +TEST -VALGRIND @ -APPARMOR +AUDIT +DOCS +LAUNCHER -SELINUX"
40
41 # Explicitly set all options here to document them.
42 buildtype: "debugoptimized"
43 cc: "clang"
44 cflags: "-Werror"
45 image: "ghcr.io/readaheadeu/rae-ci-archlinux:latest"
46 rustflags: ""
47 setupargs: "-Daudit=true -Ddocs=true -Dlauncher=true"
48 test: "yes"
49 valgrind: "no"
50 warnlevel: "2"
51
52 # A release build with `--cross-file lib32` to test on 32-bit.
53 - id: "32bit"
54 name: "RELEASE @ CLANG-I686 @ +TEST -VALGRIND @ -APPARMOR -AUDIT -DOCS +LAUNCHER -SELINUX"
55
56 buildtype: "debugoptimized"
57 cc: "clang"
58 cflags: "-Werror"
59 image: "ghcr.io/readaheadeu/rae-ci-archlinux:latest"
60 rustflags: "--target i686-unknown-linux-gnu"
61 setupargs: "-Dlauncher=true --cross-file lib32"
62 test: "yes"
63 warnlevel: "2"
64
65 # A release build running through valgrind. We disable all features
66 # that currently do not support valgrind runs (in particular sd-bus in
67 # the launcher).
68 - id: "valgrind"
69 name: "RELEASE @ CLANG-X86_64 @ +TEST +VALGRIND @ -APPARMOR +AUDIT -DOCS -LAUNCHER -SELINUX"
70
71 buildtype: "debugoptimized"
72 cc: "clang"
73 cflags: "-Werror"
74 image: "ghcr.io/readaheadeu/rae-ci-archlinux:latest"
75 setupargs: "-Daudit=true -Dlauncher=false"
76 test: "yes"
77 valgrind: "yes"
78 warnlevel: "2"
79
80 # A reduced build with `-O0` to verify we do not rely on dead-code
81 # elimination.
82 - id: "O0-PLAIN"
83 name: "PLAIN @ GCC-X86_64 @ +TEST -VALGRIND @ -APPARMOR +AUDIT -DOCS +LAUNCHER -SELINUX"
84
85 buildtype: "plain"
86 cc: "gcc"
87 cflags: "-O0 -Werror"
88 image: "ghcr.io/readaheadeu/rae-ci-archlinux:latest"
89 setupargs: "-Daudit=true -Dlauncher=true"
90 test: "yes"
91 warnlevel: "2"
92
93 # An aggressive -O3 -DNDEBUG build that verfies that we properly
94 # follow strict aliasing rules and do not rely on debug builds.
95 - id: "O3-NDEBUG"
96 name: "OPTIMIZED @ GCC-X86_64 @ +TEST -VALGRIND @ -APPARMOR +AUDIT -DOCS +LAUNCHER -SELINUX"
97
98 buildtype: "release"
99 cc: "gcc"
100 cflags: "-O3 -Werror -DNDEBUG"
101 image: "ghcr.io/readaheadeu/rae-ci-archlinux:latest"
102 setupargs: "-Daudit=true -Dlauncher=true"
103 test: "yes"
104 warnlevel: "2"
105
106 # Disable all options to compile-test their fallbacks. Run the test
107 # suite to run basic fallback verification.
108 - id: "fallback"
109 name: "OPTIMIZED @ CLANG-X86_64 @ +TEST -VALGRIND @ -APPARMOR -AUDIT -DOCS -LAUNCHER -SELINUX"
110
111 buildtype: "debugoptimized"
112 cc: "clang"
113 cflags: "-Werror"
114 image: "ghcr.io/readaheadeu/rae-ci-archlinux:latest"
115 setupargs: "-Dlauncher=false"
116 test: "yes"
117 warnlevel: "2"
118
119 # Run on Ubuntu to test the AppArmor integration.
120 - id: "ubuntu"
121 name: "RELEASE @ CLANG-X86_64 @ +TEST -VALGRIND @ +APPARMOR +AUDIT -DOCS +LAUNCHER -SELINUX"
122
123 buildtype: "debugoptimized"
124 cc: "clang"
125 cflags: "-Werror"
126 image: "ghcr.io/bus1/dbrk-ci-ubuntu:latest"
127 setupargs: "-Dapparmor=true -Daudit=true -Dlauncher=true"
128 test: "yes"
129 warnlevel: "2"
130
131 container:
132 image: ${{ matrix.image }}
133 options: --user root
134
135 env:
136 CC: ${{ matrix.cc }}
137 CFLAGS: ${{ matrix.cflags }}
138
139 runs-on: "ubuntu-latest"
140
141 steps:
142 - name: "Fetch Sources"
143 uses: actions/checkout@v4
144
145 - name: "Setup Meson"
146 run: |
147 meson setup \
148 --buildtype "${{ matrix.buildtype }}" \
149 --warnlevel "${{ matrix.warnlevel }}" \
150 ${{ matrix.setupargs }} \
151 "./build" \
152 "."
153
154 - name: "Compile Project"
155 run: |
156 meson compile \
157 -C "./build"
158
159 - name: "Run Tests"
160 if: matrix.test == 'yes'
161 run: |
162 meson test \
163 -C "./build" \
164 --print-errorlogs
165
166 - name: "Run Valgrind"
167 if: matrix.valgrind == 'yes'
168 run: |
169 args=(
170 "--gen-suppressions=all"
171 "--trace-children=yes"
172 "--leak-check=full"
173 "--error-exitcode=1"
174 )
175 meson test \
176 -C "./build" \
177 --print-errorlogs \
178 --timeout-multiplier=16 \
179 --wrapper="valgrind ${args[*]}"