-
Notifications
You must be signed in to change notification settings - Fork 101
198 lines (163 loc) · 6.39 KB
/
CI-unixish.yml
File metadata and controls
198 lines (163 loc) · 6.39 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
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
name: CI-unixish
on: [push, pull_request]
permissions:
contents: read
jobs:
build:
strategy:
matrix:
os: [ubuntu-22.04, ubuntu-22.04-arm, ubuntu-24.04, ubuntu-24.04-arm, macos-14, macos-15, macos-15-intel, macos-26, macos-26-intel]
compiler: [clang++]
include:
- os: ubuntu-22.04
compiler: g++
- os: ubuntu-22.04-arm
compiler: g++
- os: ubuntu-24.04
compiler: g++
- os: ubuntu-24.04-arm
compiler: g++
fail-fast: false
runs-on: ${{ matrix.os }}
env:
CXX: ${{ matrix.compiler }}
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
# the man-db trigger causes package installations to stall for several minutes at times. so just drop the package.
# see https://github.com/actions/runner/issues/4030
- name: Remove man-db package on ubuntu
if: matrix.os == 'ubuntu-24.04'
run: |
sudo apt-get update
sudo apt-get remove man-db
- name: Install missing software on ubuntu
if: matrix.os == 'ubuntu-24.04'
run: |
sudo apt-get update
sudo apt-get install valgrind
# llvm contains llvm-profdata
- name: Install missing software on ubuntu (clang++)
if: contains(matrix.os, 'ubuntu') && matrix.compiler == 'clang++'
run: |
sudo apt-get update
sudo apt-get install libc++-dev llvm
# coreutils contains "nproc"
- name: Install missing software on macos
if: contains(matrix.os, 'macos')
run: |
brew install coreutils
- name: Install missing Python packages
run: |
python3 -m pip config set global.break-system-packages true
python3 -m pip install pytest
- name: make simplecpp
run: make -j$(nproc) CXXOPTS="-Werror"
- name: make test
run: make -j$(nproc) test CXXOPTS="-Werror"
- name: selfcheck
run: |
make -j$(nproc) selfcheck
- name: make (c++14)
run: |
make clean
make -j$(nproc) CXXOPTS="-Werror -std=c++14"
- name: make (c++17)
run: |
make clean
make -j$(nproc) CXXOPTS="-Werror -std=c++17"
- name: make (c++20)
run: |
make clean
make -j$(nproc) CXXOPTS="-Werror -std=c++20"
- name: make (c++23)
run: |
make clean
# ubuntu-22.04 and macos-14 do not support c++23 yet
make -j$(nproc) CXXOPTS="-Werror -std=c++2b"
- name: Run CMake
run: |
cmake -S . -B cmake.output -Werror=dev --warn-uninitialized -DCMAKE_COMPILE_WARNING_AS_ERROR=On
- name: CMake simplecpp
run: |
cmake --build cmake.output --target simplecpp -- -j $(nproc)
- name: CMake testrunner
run: |
cmake --build cmake.output --target testrunner -- -j $(nproc)
./cmake.output/testrunner
# Re-run tests from within the build directory to validate that
# SIMPLECPP_TEST_SOURCE_DIR is correctly defined and resolved
(cd cmake.output && ./testrunner)
- name: Run valgrind
if: matrix.os == 'ubuntu-24.04'
run: |
make clean
make -j$(nproc) CXXOPTS="-O1"
valgrind --leak-check=full --num-callers=50 --show-reachable=yes --track-origins=yes --gen-suppressions=all --error-exitcode=42 ./testrunner
# TODO: run Python tests with valgrind
VALGRIND_TOOL=memcheck ./selfcheck.sh
- name: Run with libstdc++ debug mode
if: matrix.os == 'ubuntu-24.04' && matrix.compiler == 'g++'
run: |
make clean
make -j$(nproc) test selfcheck CXXOPTS="-Werror -g3 -D_GLIBCXX_DEBUG"
- name: Run with libc++ hardening mode
if: matrix.os == 'ubuntu-24.04' && matrix.compiler == 'clang++'
run: |
make clean
make -j$(nproc) test selfcheck CXXOPTS="-Werror -stdlib=libc++ -g3 -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG" LDOPTS="-lc++"
- name: Run AddressSanitizer
if: matrix.os == 'ubuntu-24.04' || matrix.os == 'macos-26'
run: |
make clean
make -j$(nproc) test selfcheck CXXOPTS="-Werror -O2 -g3 -fsanitize=address" LDOPTS="-fsanitize=address"
env:
ASAN_OPTIONS: detect_stack_use_after_return=1
- name: Run UndefinedBehaviorSanitizer
if: matrix.os == 'ubuntu-24.04' || matrix.os == 'macos-26'
run: |
make clean
make -j$(nproc) test selfcheck CXXOPTS="-Werror -O2 -g3 -fsanitize=undefined -fno-sanitize=signed-integer-overflow" LDOPTS="-fsanitize=undefined -fno-sanitize=signed-integer-overflow"
env:
UBSAN_OPTIONS: print_stacktrace=1:halt_on_error=1:report_error_type=1
# TODO: requires instrumented libc++
- name: Run MemorySanitizer
if: false && matrix.os == 'ubuntu-24.04' && matrix.compiler == 'clang++'
run: |
make clean
make -j$(nproc) test selfcheck CXXOPTS="-Werror -O2 -g3 -stdlib=libc++ -fsanitize=memory" LDOPTS="-lc++ -fsanitize=memory"
- name: Run callgrind
if: matrix.os == 'ubuntu-24.04'
run: |
wget https://github.com/danmar/simplecpp/archive/refs/tags/1.5.1.tar.gz
tar xvf 1.5.1.tar.gz
rm -f 1.5.1.tar.gz
make clean
make -j$(nproc) CXXOPTS="-O2 -g3" simplecpp
VALGRIND_TOOL=callgrind SIMPLECPP_PATH=simplecpp-1.5.1 ./selfcheck.sh >callgrind.log || (cat callgrind.log && false)
cat callgrind.log
# PGO - start
make clean
make -j$(nproc) CXXOPTS="-O2 -g3 -fprofile-generate" LDOPTS="-fprofile-generate" simplecpp
SIMPLECPP_PATH=simplecpp-1.5.1 ./selfcheck.sh >/dev/null
if compgen -G "default_*.profraw" > /dev/null; then
llvm-profdata merge -output=default.profdata default_*.profraw
fi
make clean
make -j$(nproc) CXXOPTS="-O2 -g3 -fprofile-use" LDOPTS="-fprofile-use" simplecpp
VALGRIND_TOOL=callgrind SIMPLECPP_PATH=simplecpp-1.5.1 ./selfcheck.sh >callgrind_pgo.log || (cat callgrind_pgo.log && false)
cat callgrind_pgo.log
# PGO - end
for f in callgrind.out.*;
do
callgrind_annotate --auto=no $f > $f.annotated.log
head -50 $f.annotated.log
done
rm -rf simplecpp-1.5.1
- uses: actions/upload-artifact@v4
if: matrix.os == 'ubuntu-24.04'
with:
name: Callgrind Output - ${{ matrix.compiler }}
path: |
./callgrind.*