CI: try new linux tests #347
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: CI | |
on: | |
push: | |
paths: | |
- .github/workflows/CI.yml | |
- CMakeLists.txt | |
- include/* | |
- tests/* | |
- src/* | |
pull_request: | |
paths: | |
- .github/workflows/CI.yml | |
- CMakeLists.txt | |
- include/* | |
- tests/* | |
- src/* | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
unit_tests: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [windows-latest, macos-latest, ubuntu-latest] | |
cxx-std: [11, 14, 17, 20] | |
include: | |
- os: windows-latest | |
compiler: MSVC | |
generator: Visual Studio 17 | |
- os: macos-latest | |
compiler: clang | |
generator: Unix Makefiles | |
- os: ubuntu-latest | |
compiler: gcc | |
generator: Unix Makefiles | |
name: ${{ matrix.os }} (C++${{ matrix.cxx-std }} - ${{ matrix.compiler }}) | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Generate project files | |
run: cmake . -B build -G "${{ matrix.generator }}" -DCMAKE_CXX_STANDARD=${{ matrix.cxx-std }} -DDYLIB_BUILD_TESTS=ON -DDYLIB_WARNING_AS_ERRORS=ON | |
- name: Build dynamic library and unit tests | |
run: cmake --build build | |
- name: Run unit tests | |
working-directory: build | |
run: ctest --verbose | |
- name: Generate code coverage | |
if: ${{ matrix.os == 'ubuntu-latest' && matrix.cxx-std == 20 }} | |
run: gcov -abcfu build/CMakeFiles/unit_tests.dir/tests/tests.cpp.gcda | |
- name: Send coverage to codecov.io | |
if: ${{ matrix.os == 'ubuntu-latest' && matrix.cxx-std == 20 }} | |
uses: codecov/codecov-action@v3 | |
with: | |
files: dylib.hpp.gcov | |
unit_tests_msys2: | |
defaults: | |
run: | |
shell: msys2 {0} | |
strategy: | |
fail-fast: false | |
matrix: | |
sys: [mingw32, mingw64, ucrt64, clang64] | |
cxx-std: [11, 14, 17, 20] | |
name: windows-latest (C++${{ matrix.cxx-std }} - ${{matrix.sys}}) | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: msys2/setup-msys2@v2 | |
with: | |
msystem: ${{matrix.sys}} | |
update: true | |
install: make | |
pacboy: toolchain:p cmake:p | |
- name: Generate project files | |
run: cmake . -B build -G "MinGW Makefiles" -DCMAKE_CXX_STANDARD=${{ matrix.cxx-std }} -DDYLIB_BUILD_TESTS=ON -DDYLIB_WARNING_AS_ERRORS=ON | |
- name: Build dynamic library and unit tests | |
run: cmake --build build | |
- name: Run unit tests | |
working-directory: build | |
run: ctest --verbose | |
unit_tests_linux: | |
strategy: | |
fail-fast: false | |
matrix: | |
cxx-std: [11, 14, 17, 20] | |
arch: [64bit, 32bit] | |
action: [tests, valgrind] | |
include: | |
- arch: 64bit | |
docker_arch: amd64 | |
- arch: 32bit | |
docker_arch: i386 | |
name: linux ${{ matrix.arch }} ${{ matrix.action }} / C++${{ matrix.cxx-std }} / gcc) | |
runs-on: ubuntu-latest | |
container: | |
image: ${{ matrix.docker_arch }}/debian:latest | |
options: --user root | |
volumes: ${{ github.workspace }}:/workspace | |
steps: | |
# https://github.com/actions/upload-artifact/issues/616 | |
- uses: actions/checkout@v1 | |
- name: Update packages | |
run: apt update | |
- name: Install build tools | |
run: apt install -y build-essential cmake valgrind | |
- name: Generate project files | |
run: cmake . -B build -DCMAKE_CXX_STANDARD=${{ matrix.cxx-std }} -DDYLIB_BUILD_TESTS=ON -DDYLIB_WARNING_AS_ERRORS=ON | |
- name: Build dynamic library and unit tests | |
run: cmake --build build | |
- name: Run unit tests | |
if: ${{ matrix.action == 'tests'}} | |
working-directory: build | |
run: ctest --verbose | |
- name: Run unit tests with valgrind | |
if: ${{ matrix.action == 'valgrind'}} | |
working-directory: build | |
run: valgrind --leak-check=full --show-leak-kinds=all --error-exitcode=1 ./unit_tests | |
unit_tests_macos: | |
strategy: | |
fail-fast: false | |
matrix: | |
cxx-std: [11, 14, 17, 20] | |
arch: [intel, silicon, universal] | |
action: [tests, leaks] | |
include: | |
- arch: intel | |
osx_arch: x86_64 | |
- arch: silicon | |
osx_arch: arm64 | |
- arch: universal | |
osx_arch: arm64;x86_64 | |
name: macos ${{ matrix.arch }} ${{ matrix.action }} / C++${{ matrix.cxx-std }} / clang | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Generate project files | |
run: cmake . -B build "-DCMAKE_OSX_ARCHITECTURES=${{ matrix.osx_arch }}" -DCMAKE_CXX_STANDARD=${{ matrix.cxx-std }} -DDYLIB_BUILD_TESTS=ON -DDYLIB_WARNING_AS_ERRORS=ON | |
- name: Build dynamic library and unit tests | |
run: cmake --build build | |
- name: Run unit tests | |
if: ${{ matrix.action == 'tests'}} | |
working-directory: build | |
run: ctest --verbose | |
- name: Run unit tests with leaks | |
if: ${{ matrix.action == 'leaks'}} | |
working-directory: build | |
run: leaks -atExit -- ./unit_tests |