-
-
Notifications
You must be signed in to change notification settings - Fork 3
220 lines (205 loc) · 9.12 KB
/
build.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
name: build & test
on:
push:
branches: [main, development]
pull_request:
branches: [main, development]
jobs:
build:
name: |
${{ matrix.config.prefix }}
${{ matrix.config.compiler_name }}-${{ matrix.config.compiler_version }}
${{ matrix.config.suffix }}
(C++${{ matrix.cxx_standard }}, ${{ matrix.build_mode }})
runs-on: ${{ matrix.config.os }}
container: ${{ matrix.config.container }}
strategy:
fail-fast: false
matrix:
build_mode: [Debug, Release]
cxx_standard: [20, 23]
config:
#clang-18
- {
prefix: "Linux",
suffix: "/libc++",
os: ubuntu-latest,
container: { image: "ghcr.io/dnkpp/clang:18" },
compiler_name: "clang",
compiler_version: 18,
libcxx: true,
asan: true
}
- {
prefix: "Linux",
os: ubuntu-latest,
container: { image: "ghcr.io/dnkpp/clang:18" },
compiler_name: "clang",
compiler_version: 18,
libcxx: false,
asan: true
}
#clang-17
- {
prefix: "Linux",
suffix: "/libc++",
os: ubuntu-latest,
container: { image: "ghcr.io/dnkpp/clang:17" },
compiler_name: "clang",
compiler_version: 17,
libcxx: true,
asan: true
}
- {
prefix: "Linux",
os: ubuntu-latest,
container: { image: "ghcr.io/dnkpp/clang:17" },
compiler_name: "clang",
compiler_version: 17,
libcxx: false,
asan: true
}
#gcc-14
- {
prefix: "Linux",
os: ubuntu-latest,
container: { image: "ghcr.io/dnkpp/gcc:14" },
compiler_name: "gcc",
compiler_version: 14,
libcxx: false,
asan: true
}
#gcc-13
- {
prefix: "Linux",
os: ubuntu-latest,
container: { image: "ghcr.io/dnkpp/gcc:13" },
compiler_name: "gcc",
compiler_version: 13,
libcxx: false,
asan: true
}
# msvc v143
- {
prefix: "Windows 2022",
os: windows-2022,
compiler_name: "msvc",
compiler_version: v143,
cmake_generator: Visual Studio 17 2022,
libcxx: false,
asan: false
}
# msvc ClangCl
- {
prefix: "Windows 2022",
os: windows-2022,
compiler_name: "msvc",
compiler_version: ClangCl,
cmake_generator: Visual Studio 17 2022,
libcxx: false,
asan: false
}
# AppleClang
- {
prefix: "macOS",
os: macos-latest,
compiler_name: "AppleClang",
compiler_version: "17.0.6",
compiler_url: "https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/clang+llvm-17.0.6-arm64-apple-darwin22.0.tar.xz",
package_name: "clang+llvm-17.0.6-arm64-apple-darwin22.0",
asan: true
}
- {
prefix: "macOS",
os: macos-latest,
compiler_name: "AppleClang",
compiler_version: "18.1.8",
compiler_url: "https://github.com/llvm/llvm-project/releases/download/llvmorg-18.1.8/clang+llvm-18.1.8-arm64-apple-macos11.tar.xz",
package_name: "clang+llvm-18.1.8-arm64-apple-macos11",
asan: true
}
steps:
- uses: actions/checkout@v4
- name: Setup macOS
if: startsWith(matrix.config.os, 'macos')
shell: bash
run: |
env brew install ninja
# download into current directory and follow http redirects (-L)
curl -sS -L -o clang.tar.xz ${{ matrix.config.compiler_url }}
# extract into subdirectory
tar -xf clang.tar.xz -C ..
CLANG_PATH=$PWD/../${{ matrix.config.package_name }}/bin
echo "CC=$(echo $CLANG_PATH/clang)" >> $GITHUB_ENV
echo "CXX=$(echo $CLANG_PATH/clang++)" >> $GITHUB_ENV
echo "CMAKE_CONFIG_EXTRA=$(echo $CMAKE_CONFIG_EXTRA -DCMAKE_BUILD_TYPE=${{ matrix.build_mode }})" >> $GITHUB_ENV
# see: https://github.com/Homebrew/homebrew-core/issues/178435#issuecomment-2250615995
- name: Workaround AppleClang 18 linker error on macOS
if: "${{ \
startsWith(matrix.config.os, 'macos') \
&& startsWith(matrix.config.compiler_version, '18.1.8') \
}}"
shell: bash
run: |
env brew install llvm
echo "LDFLAGS=$(echo $LDFLAGS -L\"$(brew --prefix llvm)/lib/c++\" -L\"$(brew --prefix llvm)/lib\" -lunwind)" >> $GITHUB_ENV
- name: Clang libc++ setup
if: ${{ matrix.config.compiler_name == 'clang' && matrix.config.libcxx == true }}
shell: bash
run: |
echo "CXXFLAGS=$(echo $CXXFLAGS -stdlib=libc++)" >> $GITHUB_ENV
echo "LDFLAGS=$(echo $LDFLAGS -lc++abi)" >> $GITHUB_ENV
- name: Setup linux
if: ${{ matrix.config.prefix == 'Linux' }}
shell: bash
run: |
echo "CMAKE_CONFIG_EXTRA=$(echo $CMAKE_CONFIG_EXTRA -DCMAKE_BUILD_TYPE=${{ matrix.build_mode }})" >> $GITHUB_ENV
- name: Setup msvc
if: ${{ matrix.config.compiler_name == 'msvc' }}
shell: bash
run: |
echo "CMAKE_CONFIG_EXTRA=$(echo $CMAKE_CONFIG_EXTRA -G\"${{ matrix.config.cmake_generator }}\" -T\"${{ matrix.config.compiler_version }}\" -Ax64)" >> $GITHUB_ENV
echo "CMAKE_BUILD_EXTRA=$(echo $CMAKE_BUILD_EXTRA --config ${{ matrix.build_mode }})" >> $GITHUB_ENV
- name: Enable Address and Undefined Sanitizer
if: ${{ matrix.config.asan == true }}
shell: bash
run: |
echo "CMAKE_CONFIG_EXTRA=$(echo $CMAKE_CONFIG_EXTRA -DSANITIZE_ADDRESS=YES -DSANITIZE_UNDEFINED=YES)" >> $GITHUB_ENV
# ASan has some serious trouble with libc++ exception mechanism
# see: https://github.com/llvm/llvm-project/issues/59432
- name: Disable alloc_dealloc_mismatch detection with libc++
if: ${{ matrix.config.asan == true && matrix.config.libcxx == true}}
shell: bash
run: |
echo "ASAN_OPTIONS=$(echo $ASAN_OPTIONS:alloc_dealloc_mismatch=0)" >> $GITHUB_ENV
- name: Configure
shell: bash
run: |
cmake \
-S . \
-B build \
-D CMAKE_VERBOSE_MAKEFILE=yes \
-D MIMICPP_FORCED_CXX_STANDARD="${{ matrix.cxx_standard }}" \
-D MIMICPP_ENABLE_ADAPTER_TESTS=YES \
${{ env.CMAKE_CONFIG_EXTRA }}
- name: Build
shell: bash
run: |
cmake --build build \
-j4 \
${{ env.CMAKE_BUILD_EXTRA }}
- name: Run tests
shell: bash
env:
CTEST_OUTPUT_ON_FAILURE: 1
run: ctest --test-dir build/test/unit-tests -C ${{ matrix.build_mode }} -j4
- name: Run adapter tests
shell: bash
env:
CTEST_OUTPUT_ON_FAILURE: 1
run: ctest --test-dir build/test/adapter-tests -C ${{ matrix.build_mode }} -j4
- name: Run examples
shell: bash
env:
CTEST_OUTPUT_ON_FAILURE: 1
run: ctest --test-dir build/examples -C ${{ matrix.build_mode }} -j4