-
Notifications
You must be signed in to change notification settings - Fork 8
169 lines (165 loc) · 5.45 KB
/
meson.yml
File metadata and controls
169 lines (165 loc) · 5.45 KB
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
name: Meson Test
on:
push:
branches: [main]
paths:
- ".github/workflows/meson.yml"
- "VERSION"
- "meson.build"
- "meson_options.txt"
- "src/**"
- "tests/**"
pull_request:
branches: [main]
paths:
- ".github/workflows/meson.yml"
- "VERSION"
- "meson.build"
- "meson_options.txt"
- "src/**"
- "tests/**"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
cfg:
- {
id: ubuntu-gcc,
platform: ubuntu,
cc: gcc,
cpp: g++,
setup_options: "-Db_sanitize=address,undefined -Dunity=on -Dunity_size=12",
}
- {
id: ubuntu-clang,
platform: ubuntu,
cc: clang,
cpp: clang++,
setup_options: "-Dunity=on -Dunity_size=12",
}
- {
id: rockylinux-gcc,
platform: rockylinux,
cc: gcc,
cpp: g++,
setup_options: "-Dunity=on -Dunity_size=12",
}
- {
id: rockylinux-clang,
platform: rockylinux,
cc: clang,
cpp: clang++,
setup_options: "-Db_sanitize=address,undefined -Db_lundef=false -Dunity=on -Dunity_size=12",
}
steps:
- uses: actions/checkout@v2
# GitHub runners have updated the Ubuntu Linux Kernel to use strong ASLR,
# but LLVM is not configured for this change, and thus the address
# sanitizer breaks.
#
# The next image is supposed to fix this, so if the Ubuntu image has been
# updated, this work around is no longer required.
- name: get runner image version
id: runner-image-version
run: |
echo "image-version=$(echo $ImageVersion)" >> "$GITHUB_OUTPUT"
working-directory: .
- name: modify number of bits to use for ASLR entropy
if: ${{ steps.runner-image-version.outputs.ImageVersion }} == '20240310.1.0'
run: |
sudo sysctl -a | grep vm.mmap.rnd
sudo sysctl -w vm.mmap_rnd_bits=28
working-directory: .
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: false
load: true
tags: ${{ matrix.cfg.id }}
file: tests/docker/${{ matrix.cfg.platform }}.Dockerfile
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Restore Compiler Cache
id: ccache-restore
uses: actions/cache/restore@v4
with:
path: ${{ github.workspace }}/ccache
# This ensures that every run saves cache even on cache hit
key: ${{ matrix.cfg.id }}-ccache-${{ github.run_id }}
restore-keys: |
${{ matrix.cfg.id }}-ccache
- name: Start Docker container
run: |
mkdir -p ${{ github.workspace }}/ccache
docker run -d --name ${{ matrix.cfg.id }} \
--mount=type=bind,source=${{ github.workspace }}/ccache,target=/ccache \
--mount=type=bind,source=${{ github.workspace }},target=/workdir \
${{ matrix.cfg.id }} sleep infinity
- name: Build cps-config
run: |
docker exec \
-e CC="ccache ${{ matrix.cfg.cc }}" -e CXX="ccache ${{ matrix.cfg.cpp }}" \
-e CCACHE_DIR="/ccache" \
${{ matrix.cfg.id }} \
bash -c "meson setup /workdir/builddir /workdir ${{ matrix.cfg.setup_options }} \
&& ninja -C /workdir/builddir"
- name: Run Tests
run: |
docker exec ${{ matrix.cfg.id }} ninja -C /workdir/builddir test
- name: Stop Docker Container
run: |
docker stop ${{ matrix.cfg.id }}
- name: Save Cache
id: ccache-save
uses: actions/cache/save@v4
with:
path: ${{ github.workspace }}/ccache
key: ${{ matrix.cfg.id }}-ccache-${{ github.run_id }}
macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: Brew Install
run: brew install pkg-config ninja cli11 googletest nlohmann-json fmt cmake meson tl-expected bison flex
- name: Build cps-config
run: |
PATH=/opt/homebrew/opt/bison/bin:/opt/homebrew/opt/flex/bin:$PATH \
meson setup builddir -Dunity=on -Dunity_size=12
ninja -C builddir
- name: Run tests
run: meson test -C builddir
windows:
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
steps:
- uses: msys2/setup-msys2@v2
with:
update: true
install: >-
flex
bison
mingw-w64-x86_64-meson
mingw-w64-x86_64-python-pip
mingw-w64-x86_64-toolchain
mingw-w64-x86_64-openssl
mingw-w64-x86_64-python-certifi
- uses: actions/checkout@v3
- name: Install system certs for python
run: |
pip install pip-system-certs
echo "REQUESTS_CA_BUNDLE=$(python -m certifi)" >> $GITHUB_ENV
echo "SSL_CERT_FILE=$(python -m certifi)" >> $GITHUB_ENV
- name: Build cps-config
run: |
meson setup builddir -Dunity=on -Dunity_size=12
ninja -C builddir
- name: Run tests
run: meson test -C builddir