Skip to content

Commit d0b609c

Browse files
committed
ci: add meson tests
1 parent e2c8d8f commit d0b609c

File tree

1 file changed

+168
-0
lines changed

1 file changed

+168
-0
lines changed

.github/workflows/meson.yml

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
name: Meson
2+
3+
on:
4+
pull_request:
5+
push:
6+
7+
jobs:
8+
meson-build-and-tests:
9+
runs-on: ${{ matrix.platform }}
10+
name: ${{ matrix.platform }}, ${{ matrix.mode.name }} ${{ matrix.flavor }}
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
flavor:
15+
- debug
16+
- release
17+
mode:
18+
- name: default
19+
extra_envs: {}
20+
21+
# Alternative compiler setups
22+
- name: gcc
23+
extra_envs:
24+
CC: gcc
25+
CXX: g++
26+
- name: clang
27+
extra_envs:
28+
CC: clang
29+
CXX: clang++
30+
31+
- name: sanitize
32+
args: >-
33+
"-Db_sanitize=address,undefined"
34+
extra_envs: {}
35+
36+
# This is for MSVC, which only supports AddressSanitizer.
37+
# https://learn.microsoft.com/en-us/cpp/sanitizers/
38+
- name: sanitize+asanonly
39+
args: -Db_sanitize=address
40+
extra_envs:
41+
ASAN_OPTIONS: report_globals=0:halt_on_error=1:abort_on_error=1:print_summary=1
42+
43+
- name: clang+sanitize
44+
args: >-
45+
"-Db_sanitize=address,undefined"
46+
extra_envs:
47+
CC: clang
48+
CXX: clang++
49+
- name: clang+msan
50+
args: -Db_sanitize=memory
51+
extra_envs:
52+
CC: clang
53+
CXX: clang++
54+
55+
# default clang on GitHub hosted runners is from MSYS2.
56+
# Use Visual Studio supplied clang-cl instead.
57+
- name: clang-cl+sanitize
58+
args: >-
59+
"-Db_sanitize=address,undefined"
60+
extra_envs:
61+
CC: clang-cl
62+
CXX: clang-cl
63+
- name: clang-cl+msan
64+
args: -Db_sanitize=memory
65+
extra_envs:
66+
CC: clang-cl
67+
CXX: clang-cl
68+
platform:
69+
- ubuntu-22.04
70+
- windows-2022
71+
- macos-latest
72+
73+
exclude:
74+
# clang-cl only makes sense on windows.
75+
- platform: ubuntu-22.04
76+
mode:
77+
name: clang-cl+sanitize
78+
- platform: macos-latest
79+
mode:
80+
name: clang-cl+sanitize
81+
- platform: ubuntu-22.04
82+
mode:
83+
name: clang-cl+msan
84+
- platform: macos-latest
85+
mode:
86+
name: clang-cl+msan
87+
88+
# Use clang-cl instead of MSYS2 clang.
89+
#
90+
# we already tested clang+sanitize on linux,
91+
# if this doesn't work, it should be an issue for MSYS2 team to consider.
92+
- platform: windows-2022
93+
mode:
94+
name: clang
95+
- platform: windows-2022
96+
mode:
97+
name: clang+sanitize
98+
- platform: windows-2022
99+
mode:
100+
name: clang+msan
101+
102+
# MSVC-only sanitizers
103+
- platform: ubuntu-22.04
104+
mode:
105+
name: sanitize+asanonly
106+
- platform: macos-latest
107+
mode:
108+
name: sanitize+asanonly
109+
- platform: windows-2022
110+
mode:
111+
name: sanitize
112+
113+
# clang is the default on macos
114+
# also gcc is an alias to clang
115+
- platform: macos-latest
116+
mode:
117+
name: clang
118+
- platform: macos-latest
119+
mode:
120+
name: gcc
121+
122+
# gcc is the default on linux
123+
- platform: ubuntu-22.04
124+
mode:
125+
name: gcc
126+
127+
# only run sanitizer tests on linux
128+
#
129+
# gcc/clang's codegen shouldn't massively change across platforms,
130+
# and linux supports most of the sanitizers.
131+
- platform: macos-latest
132+
mode:
133+
name: clang+sanitize
134+
- platform: macos-latest
135+
mode:
136+
# macos does not support msan
137+
name: clang+msan
138+
- platform: macos-latest
139+
mode:
140+
name: sanitize
141+
steps:
142+
- name: Setup meson
143+
run: |
144+
pipx install meson ninja
145+
- name: Checkout
146+
uses: actions/checkout@v4
147+
- name: Activate MSVC and Configure
148+
if: ${{ matrix.platform == 'windows-2022' }}
149+
env: ${{ matrix.mode.extra_envs }}
150+
run: |
151+
meson setup build-${{ matrix.flavor }} --buildtype=${{ matrix.flavor }} ${{ matrix.mode.args }} --vsenv
152+
- name: Configuring
153+
if: ${{ matrix.platform != 'windows-2022' }}
154+
env: ${{ matrix.mode.extra_envs }}
155+
run: |
156+
meson setup build-${{ matrix.flavor }} --buildtype=${{ matrix.flavor }} ${{ matrix.mode.args }}
157+
- name: Building
158+
run: |
159+
meson compile -C build-${{ matrix.flavor }}
160+
- name: Running tests
161+
env: ${{ matrix.mode.extra_envs }}
162+
run: |
163+
meson test -C build-${{ matrix.flavor }} --timeout-multiplier 0
164+
- uses: actions/upload-artifact@v4
165+
if: failure()
166+
with:
167+
name: ${{ matrix.platform }}-${{ matrix.mode.name }}-${{ matrix.flavor }}-logs
168+
path: build-${{ matrix.flavor }}/meson-logs

0 commit comments

Comments
 (0)