-
Notifications
You must be signed in to change notification settings - Fork 2
164 lines (139 loc) · 5.49 KB
/
tests.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
name: tests
on:
push:
pull_request:
jobs:
build:
name: ${{matrix.os}} ${{ matrix.description }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-20.04
# oldest LLVM that the install-llvm-action action is able to install
description: "LLVM 5"
llvm-version: "5"
#gcov_executable: "llvm-cov gcov"
- os: ubuntu-22.04
# select libc++ as libstdc++ appears to be the default
description: "LLVM 16 libc++"
llvm-version: "16"
cmake-flags: '-DCMAKE_CXX_FLAGS="-stdlib=libc++" -DCMAKE_EXE_LINKER_FLAGS="-lc++abi"'
#gcov_executable: "llvm-cov gcov"
- os: ubuntu-20.04
description: "GCC 7"
gcc-version: "7"
cmake-version: "3.18"
test-amalgamation: true
- os: ubuntu-20.04
description: "GCC 9"
gcc-version: "9"
#gcov_executable: "gcov"
- os: ubuntu-latest
description: "GCC 13"
gcc-version: "13"
test-amalgamation: true
- os: ubuntu-latest
description: "Emscripten 3.1"
emscripten-version: "3.1.52"
cmake-flags: '-DCMAKE_TOOLCHAIN_FILE=$(em-config EMSCRIPTEN_ROOT)/cmake/Modules/Platform/Emscripten.cmake'
- os: ubuntu-latest
# default GCC, which has gcov
gcov_executable: "gcov"
- os: macos-latest
# uses Apple Clang
- os: windows-latest
# uses MSVC
- os: windows-latest
mingw-version: "13.2.0"
description: "MinGW 13"
cmake-flags: '-G "MinGW Makefiles"'
steps:
- uses: actions/checkout@v4
- name: Install TBB (Ubuntu)
if: contains(matrix.os, 'ubuntu')
run: sudo apt-get install -y libtbb-dev
- name: Install TBB (macOS)
if: contains(matrix.os, 'macos')
run: brew install tbb
- name: Setup GCC
uses: egor-tensin/setup-gcc@v1
if: ${{ matrix.gcc-version != '' }}
with:
version: ${{ matrix.gcc-version }}
- name: Setup MinGW
if: contains(matrix.os, 'windows') && matrix.mingw-version != ''
run: |
choco install --no-progress mingw --version ${{ matrix.mingw-version }}
Add-Content $env:GITHUB_PATH "C:\ProgramData\mingw64\mingw64\bin"
- name: Setup LLVM and Clang
uses: KyleMayes/install-llvm-action@v1
if: ${{ matrix.llvm-version != '' }}
with:
version: ${{ matrix.llvm-version }}
env: true
- name: Setup Emscripten
uses: mymindstorm/setup-emsdk@v14
if: ${{ matrix.emscripten-version != '' }}
with:
version: ${{ matrix.emscripten-version }}
# Default node.js (v18) does not support threads well.
# It might work with --experimental-wasm-threads --experimental-wasm-bulk-memory
# but newer node just works out of the box.
- name: Setup node.js for running Emscripten builds
uses: actions/setup-node@v4
if: ${{ matrix.emscripten-version != '' }}
with:
node-version: 21
- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v2
if: ${{ matrix.cmake-version != '' }}
with:
cmake-version: ${{ matrix.cmake-version }}
- name: Build and Test
run: |
cmake -S . -B build/ -DCMAKE_BUILD_TYPE=Debug -DPOOLSTL_TEST=ON -DPOOLSTL_TEST_COVERAGE=ON ${{ matrix.cmake-flags }}
cmake --build build/ --config Debug
cd build/tests
ctest -C Debug --output-on-failure --verbose
echo "Supplement Test:"
./supplement_test || ./Debug/supplement_test.exe || node supplement_test
shell: bash
- name: Create code coverage report (gcov)
if: matrix.gcov_executable != ''
working-directory: ./build/tests
run: |
pip install gcovr
gcovr --delete --root ../../ --print-summary --xml coverage.xml . --gcov-executable '${{ matrix.gcov_executable }}' --merge-mode-functions=separate --gcov-ignore-parse-errors=negative_hits.warn_once_per_file
- name: Benchmark
# Earliest GCC with all benchmarked methods is 9
if: matrix.gcc-version != '7' && matrix.gcc-version != '8'
run: |
cmake -S . -B bench_build/ -DCMAKE_BUILD_TYPE=Release -DPOOLSTL_BENCH=ON ${{ matrix.cmake-flags }}
cmake --build bench_build/ --config Release
cd bench_build/benchmark/
./poolstl_bench || ./Release/poolstl_bench.exe || node poolstl_bench
shell: bash
- name: Test Amalgamation
if: matrix.test-amalgamation
run: |
cd tools/
./create_amalgamates.sh
cd ..
rm -rf include/poolstl/*
cp tools/poolstl.hpp include/poolstl/
mkdir -p include/poolstl/internal
cp tools/poolstl.hpp include/poolstl/internal/utils.hpp
cmake -S . -B build/ -DCMAKE_BUILD_TYPE=Debug -DPOOLSTL_TEST=ON -DPOOLSTL_TEST_COVERAGE=OFF ${{ matrix.cmake-flags }}
cmake --build build/ --config Debug
cd build/tests
ctest -C Debug --output-on-failure --verbose
shell: bash
- name: Upload Coverage to Codecov
if: matrix.gcov_executable != ''
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}