Version 2.2.1 #254
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/* | |
pull_request: | |
paths: | |
- .github/workflows/CI.yml | |
- CMakeLists.txt | |
- include/* | |
- tests/* | |
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] | |
generator: [Unix Makefiles, MinGW Makefiles, Visual Studio 17] | |
exclude: | |
- os: windows-latest | |
generator: Unix Makefiles | |
- os: macos-latest | |
generator: MinGW Makefiles | |
- os: macos-latest | |
generator: Visual Studio 17 | |
- os: ubuntu-latest | |
generator: MinGW Makefiles | |
- os: ubuntu-latest | |
generator: Visual Studio 17 | |
- generator: MinGW Makefiles | |
cxx-std: 17 | |
- generator: MinGW Makefiles | |
cxx-std: 20 | |
name: ${{ matrix.os }} (C++${{ matrix.cxx-std }} - ${{ matrix.generator }}) | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- 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 | |
- 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 | |
memory_check: | |
name: memory check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Update packages | |
run: sudo apt update | |
- name: Install valgrind | |
run: sudo apt install -y valgrind | |
- name: Generate tests build file | |
run: cmake . -B build -DCMAKE_CXX_STANDARD=20 -DDYLIB_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Debug | |
- name: Build unit tests | |
run: cmake --build build | |
- name: Run unit tests with valgrind | |
working-directory: build | |
run: valgrind --leak-check=full --show-leak-kinds=all --error-exitcode=1 ./unit_tests | |
linter: | |
name: linter | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install cpplint | |
run: pip install cpplint | |
- name: Run cpplint | |
run: cpplint --linelength=140 --filter=-whitespace/indent,-whitespace/parens include/dylib.hpp |