-
Notifications
You must be signed in to change notification settings - Fork 2
148 lines (131 loc) · 4.98 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
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"
# - 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"'
#
# - 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"
#
# - os: ubuntu-latest
# description: "GCC 13"
# gcc-version: "13"
# test-amalgamation: true
- os: ubuntu-latest
description: "Emscripten"
emscripten-version: "3.1.52"
# needs:
# - use emscripten's cmake toolchain file so cmake uses em++ and such
# - must compile with -pthread for C++11 threads to work
# - enable PTHREAD_POOL_SIZE
# - disable codecov because emscripten does not support it.
cmake-flags: '-DCMAKE_TOOLCHAIN_FILE=$(em-config EMSCRIPTEN_ROOT)/cmake/Modules/Platform/Emscripten.cmake -DCMAKE_CXX_FLAGS="-pthread" -DCMAKE_EXE_LINKER_FLAGS="-sPTHREAD_POOL_SIZE=navigator.hardwareConcurrency" -DPOOLSTL_TEST_COVERAGE=OFF'
# - os: ubuntu-latest
# # default GCC, which has 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 }}
- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v1
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: 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: contains(matrix.os, 'ubuntu') || contains(matrix.os, 'macos')
uses: codecov/codecov-action@v3
with:
gcov: true
gcov_include: include/*