-
Notifications
You must be signed in to change notification settings - Fork 4
380 lines (352 loc) · 13.6 KB
/
test-warning.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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
name: Run Tests With Warnings
on:
pull_request:
branches:
- '**'
jobs:
test-native:
runs-on: ${{ matrix.os }}-latest
env:
PATOMIC_CI_ID: ${{ matrix.architecture }}-${{ matrix.os }}-${{ matrix.compiler }}-${{ matrix.build-shared }}
strategy:
matrix:
# verbose labels make things easier to read in GitHub Actions
# platform gets converted to os, preset, compiler, architecture
platform:
- windows-gcc-x86_64
- windows-msvc-x86_32
- windows-msvc-x86_64
- macos-clang-x86_64
- linux-clang-x86_64
- linux-gcc-x86_64
# build-shared gets converted to cmake option
build-shared:
- static
- shared
# convert verbose labels to usable values (which don't appear in action name)
# also just other variables that we don't want appearing in action name
include:
# use Release for everything
- cmake-build-type: Release
# build-shared -> cmake-build-shared
- build-shared: static
cmake-build-shared: OFF
- build-shared: shared
cmake-build-shared: ON
# platform -> os, preset, compiler, architecture
- platform: windows-gcc-x86_64
os: windows
preset: patomic-ci-native-unix-gcc-warning
compiler: gcc
architecture: x86_64
- platform: windows-msvc-x86_32
os: windows
preset: patomic-ci-native-windows-msvc-warning -A Win32
compiler: msvc
architecture: x86_32
- platform: windows-msvc-x86_64
os: windows
preset: patomic-ci-native-windows-msvc-warning -A x64
compiler: msvc
architecture: x86_64
- platform: macos-clang-x86_64
os: macos
preset: patomic-ci-native-unix-clang-warning
compiler: clang
architecture: x86_64
- platform: linux-clang-x86_64
os: ubuntu
preset: patomic-ci-native-unix-clang-warning
compiler: clang
architecture: x86_64
- platform: linux-gcc-x86_64
os: ubuntu
preset: patomic-ci-native-unix-gcc-warning
compiler: gcc
architecture: x86_64
steps:
- name: Checkout patomic
uses: actions/checkout@v4
with:
path: patomic
- name: Try Using Local Action
uses: ./patomic/.github/actions/test-build-run
with:
test_type: ansi
preset: ${{ matrix.preset }}
architecture: ${{ matrix.architecture }}
triple: no
cmake_build_shared: ${{ matrix.cmake-build-shared }}
patomic_path: no
googletest_path: no
working_directory: no
xml_file: no
- name: Restore Cached GoogleTest
id: cache-googletest
uses: actions/cache@v3
with:
path: googletest/build/install
key: googletest-${{ env.PATOMIC_CI_ID }}
- name: Checkout GoogleTest
if: steps.cache-googletest.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
repository: google/googletest
path: googletest
- name: Build and Install GoogleTest
if: steps.cache-googletest.outputs.cache-hit != 'true'
run: |
cd googletest
cp ../patomic/CMakePresets.json .
mkdir build
cd build
cmake --preset ${{ matrix.preset }} -DCMAKE_CXX_FLAGS="" -DBUILD_SHARED_LIBS=${{ matrix.cmake-build-shared }} -DCMAKE_BUILD_TYPE=${{ matrix.cmake-build-type }} -Dgtest_force_shared_crt=ON -Dgtest_hide_internal_symbols=ON ..
cmake --build . --verbose --config ${{ matrix.cmake-build-type }}
cmake --install . --config ${{ matrix.cmake-build-type }} --prefix install
- name: Build patomic
run: |
cd patomic
mkdir build
cd build
cmake --preset ${{ matrix.preset }} -DBUILD_SHARED_LIBS=${{ matrix.cmake-build-shared }} -DCMAKE_BUILD_TYPE=${{ matrix.cmake-build-type }} -DGTest_ROOT:PATH="../../googletest/build/install/lib/cmake/GTest" ..
cmake --build . --verbose --config ${{ matrix.cmake-build-type }}
- name: Test patomic
continue-on-error: true
run: |
cd patomic/build
ctest --verbose --output-junit Testing/Temporary/results.xml --build-config ${{ matrix.cmake-build-type }} .
- name: Prepare Test Results
shell: bash
run: |
mkdir upload
python3 patomic/test/improve_ctest_xml.py --input patomic/build/Testing/Temporary/results.xml --triple ${{ env.PATOMIC_CI_ID }} --output upload/${{ env.PATOMIC_CI_ID }}.xml
- name: Upload Test Results
uses: actions/upload-artifact@v3
with:
name: test-warning-results
path: upload/
test-qemu:
runs-on: ubuntu-latest
env:
PATOMIC_CI_ID: ${{ matrix.architecture }}-ubuntu-${{ matrix.compiler }}-${{ matrix.build-shared }}
PATOMIC_CI_XARCH: ${{ matrix.architecture }}
PATOMIC_CI_XTRIPLE: ${{ matrix.triple }}
# PATOMIC_CI_XCOMPILER is specified as a cache variable in the appropriate presets (since it's a constant)
PATOMIC_CI_XCOMPILER_VERSION: ${{ matrix.compiler-version }}
PATOMIC_CI_SYSROOT: ${{ matrix.sysroot }}
strategy:
matrix:
# architecture gets converted to triple
# short form here so that it doesn't take up the whole GitHub Action name
architecture:
- aarch64
- alpha
- arm
- armhf
- hppa
# fixme: m68k is supported, but ICEs clang and segfaults qemu when built with gcc (GHI #25)
# - m68k
- mips
- mips64
- mips64el
- mipsel
- ppc
- ppc64
- ppc64le
- riscv64
- s390x
# fixme: sh4 is supported (only for gcc), but segfaults qemu when built with gcc (GHI #25)
# - sh4
- sparc64
- x86_32
compiler:
- clang
- gcc
# build-shared gets converted to cmake option
build-shared:
- static
- shared
# exclude architectures unsupported by certain compilers
exclude:
- architecture: alpha
compiler: clang
- architecture: hppa
compiler: clang
# fixme: x86_32 is supported, but not sure how to make it work with clang (GHI #25)
- architecture: x86_32
compiler: clang
# fixme: riscv64 is supported, but gcc errors on a system header (GHI #25)
- architecture: riscv64
compiler: gcc
- architecture: sh4
compiler: clang
# fixme: sparc64 is supported, but segfaults qemu when built with gcc (GHI #25)
- architecture: sparc64
compiler: gcc
# convert verbose labels to usable values (which don't appear in action name)
# also just other variables that we don't want appearing in action name
include:
# common local sysroot location for everything
# don't prefix with ${HOME} because not always expanded by actions
- sysroot: '~/sysroot'
# use Release for everything
- cmake-build-type: Release
# build-shared -> cmake-build-shared
- build-shared: static
cmake-build-shared: OFF
- build-shared: shared
cmake-build-shared: ON
# toolchain versions to use
- gcc-version: 10
- llvm-version: 15
# compiler -> preset, compiler-version
- compiler: clang
preset: patomic-ci-qemu-ubuntu-clang-warning
compiler-version: 15
- compiler: gcc
preset: patomic-ci-qemu-ubuntu-gcc-warning
compiler-version: 10
# architecture -> triple
- architecture: aarch64
triple: aarch64-linux-gnu
- architecture: alpha
triple: alpha-linux-gnu
- architecture: arm
triple: arm-linux-gnueabi
- architecture: armhf
triple: arm-linux-gnueabihf
- architecture: hppa
triple: hppa-linux-gnu
# - architecture: m68k
# triple: m68k-linux-gnu
- architecture: mips
triple: mips-linux-gnu
- architecture: mips64
triple: mips64-linux-gnuabi64
- architecture: mips64el
triple: mips64el-linux-gnuabi64
- architecture: mipsel
triple: mipsel-linux-gnu
- architecture: ppc
triple: powerpc-linux-gnu
- architecture: ppc64
triple: powerpc64-linux-gnu
- architecture: ppc64le
triple: powerpc64le-linux-gnu
- architecture: riscv64
triple: riscv64-linux-gnu
- architecture: s390x
triple: s390x-linux-gnu
# - architecture: sh4
# triple: sh4-linux-gnu
- architecture: sparc64
triple: sparc64-linux-gnu
- architecture: x86_32
triple: i686-linux-gnu
steps:
- name: Install Toolchains and Qemu
run: |
sudo apt update
sudo apt install g++-${{ matrix.gcc-version }}-multilib
sudo apt install g++-${{ matrix.gcc-version }}-${{ matrix.triple }}
sudo apt install llvm-${{ matrix.llvm-version }}
sudo apt install clang-${{ matrix.llvm-version }}
sudo apt install qemu-user
# - name: Show what architectures clang-${{ matrix.llvm-version }} supports
# run: |
# clang-${{ matrix.llvm-version }} --print-targets
# - name: Display what was Installed
# run: |
# sudo apt update
# sudo apt-cache dumpavail | sudo dpkg --merge-avail -
# sudo apt install apt-file
# sudo apt install tree
# sudo apt-file update
# sudo apt-file list g++-${{ matrix.gcc-version }}-multilib
# sudo apt-file list g++-${{ matrix.gcc-version }}-${{ matrix.triple }}
# tree /usr/${{ matrix.triple }}
# tree /usr/lib/gcc-cross/${{ matrix.triple }}/${{ matrix.gcc-version}}
- name: Checkout patomic
uses: actions/checkout@v4
with:
path: patomic
- name: Try Using Local Action
uses: ./patomic/.github/actions/test-build-run
with:
test_type: ansi
preset: ${{ matrix.preset }}
architecture: ${{ matrix.architecture }}
triple: no
cmake_build_shared: ${{ matrix.cmake-build-shared }}
patomic_path: no
googletest_path: no
working_directory: no
xml_file: no
- name: Restore Cached GoogleTest and Sysroot
id: cache-googletest
uses: actions/cache@v3
with:
path: ${{ matrix.sysroot }}
# need both gcc and llvm version in case of building with clang but using gcc sysroot
key: googletest-${{ env.PATOMIC_CI_ID }}-${{ matrix.gcc-version }}-${{ matrix.llvm-version }}
- name: Set Up Sysroot
if: steps.cache-googletest.outputs.cache-hit != 'true'
# cannot use symlink or reference directory directly, will not work
run: |
cp -r /usr/${{ matrix.triple }}/ ${{ matrix.sysroot }}
- name: Checkout GoogleTest
if: steps.cache-googletest.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
repository: google/googletest
path: googletest
- name: Build and Install GoogleTest
if: steps.cache-googletest.outputs.cache-hit != 'true'
run: |
cd googletest
cp -r ../patomic/ci/ ./
cp ../patomic/CMakePresets.json .
mkdir build
cd build
cmake --preset ${{ matrix.preset }} -DCMAKE_CXX_FLAGS="" -DBUILD_SHARED_LIBS=${{ matrix.cmake-build-shared }} -DCMAKE_BUILD_TYPE=${{ matrix.cmake-build-type }} -Dgtest_force_shared_crt=ON -Dgtest_hide_internal_symbols=ON ..
cmake --build . --verbose
cmake --install . --prefix ${{ matrix.sysroot }}
- name: Build patomic
run: |
cd patomic
mkdir build
cd build
cmake --preset ${{ matrix.preset }} -DBUILD_SHARED_LIBS=${{ matrix.cmake-build-shared }} -DCMAKE_BUILD_TYPE=${{ matrix.cmake-build-type }} -DGTest_ROOT:PATH="${{ matrix.sysroot }}/lib/cmake/GTest" ..
cmake --build . --verbose
- name: Test patomic
continue-on-error: true
run: |
cd patomic/build
ctest --verbose --output-junit Testing/Temporary/results.xml .
- name: Prepare Test Results
run: |
mkdir upload
python3 patomic/test/improve_ctest_xml.py --input patomic/build/Testing/Temporary/results.xml --triple ${{ env.PATOMIC_CI_ID }} --output upload/${{ env.PATOMIC_CI_ID }}.xml
- name: Upload Test Results
uses: actions/upload-artifact@v3
with:
name: test-warning-results
path: upload/
publish-results:
runs-on: ubuntu-latest
needs:
- test-native
- test-qemu
steps:
- name: Download Test Result Artifacts
uses: actions/download-artifact@v3
with:
name: test-warning-results
path: test-warning-results/
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
with:
action_fail: true
action_fail_on_inconclusive: true
check_name: "Tests Results: Warning"
files: test-warning-results/**/*.xml