Test on Emscripten #266
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/* |