CI: move checkout at the begining #343
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_32bit_linux: | |
strategy: | |
fail-fast: false | |
matrix: | |
cxx-std: [11, 14, 17, 20] | |
name: debian-latest 32bit (C++${{ matrix.cxx-std }} - gcc) | |
runs-on: ubuntu-latest | |
container: | |
image: i386/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 | |
- 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 | |
working-directory: build | |
run: ctest --verbose | |
memory_check: | |
name: memory check | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- 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 |