Skip to content

Merge pull request #11 from lefticus/add_type_utilities #50

Merge pull request #11 from lefticus/add_type_utilities

Merge pull request #11 from lefticus/add_type_utilities #50

Workflow file for this run

name: ci
on:
pull_request:
push:
branches:
- main
jobs:
Test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
# Recommendations:
# * support at least 2 operating systems
# * support at least 2 compilers
# * make sure all supported configurations for your project are built
#
# Disable/enable builds in this list to meet the above recommendations
# and your own projects needs
matrix:
os:
- ubuntu-20.04
# - macos-10.15
compiler:
# you can specify the version after `-` like "llvm-13.0.0".
- llvm
- gcc
generator:
- "Ninja Multi-Config"
build_type:
- Release
- Debug
developer_mode:
- ON
- OFF
exclude:
# mingw is determined by this author to be too buggy to support
- os: windows-2019
compiler: gcc
include:
# Add appropriate variables for gcov version required. This will intentionally break
# if you try to use a compiler that does not have gcov set
- compiler: gcc
gcov_executable: gcov
- compiler: llvm
gcov_executable: "llvm-cov gcov"
# This exists solely to make sure a non-multiconfig build works
- os: ubuntu-20.04
compiler: gcc
generator: "Unix Makefiles"
build_type: Debug
gcov_executable: gcov
developer_mode: On
- os: windows-2022
compiler: msvc
generator: "Visual Studio 17 2022"
build_type: Debug
developer_mode: On
- os: windows-2022
compiler: msvc
generator: "Visual Studio 17 2022"
build_type: Release
developer_mode: On
- os: windows-2022
compiler: msvc
generator: "Visual Studio 17 2022"
build_type: Debug
developer_mode: Off
- os: windows-2022
compiler: msvc
generator: "Visual Studio 17 2022"
build_type: Release
developer_mode: Off
steps:
- uses: actions/checkout@v2
- name: Cache
uses: actions/cache@v2
with:
path: |
~/vcpkg
./build/vcpkg_installed
~/.cache/pip
${{ env.HOME }}/.cache/vcpkg/archives
${{ env.XDG_CACHE_HOME }}/vcpkg/archives
${{ env.LOCALAPPDATA }}\vcpkg\archives
${{ env.APPDATA }}\vcpkg\archives
key: ${{ runner.os }}-${{ matrix.compiler }}-${{matrix.build_type}}-${{matrix.generator}}-${{matrix.developer_mode}}-${{ hashFiles('**/CMakeLists.txt') }}-${{ hashFiles('./vcpkg.json')}}
restore-keys: |
${{ runner.os }}-${{ matrix.compiler }}-${{matrix.build_type}}-${{matrix.generator}}-${{matrix.developer_mode}}
- name: Setup Cpp
uses: aminya/setup-cpp@v1
with:
compiler: ${{ matrix.compiler }}
vcvarsall: ${{ contains(matrix.os, 'windows' )}}
cmake: true
ninja: true
vcpkg: false
ccache: true
clangtidy: true
cppcheck: true
gcovr: true
opencppcoverage: true
# make sure coverage is only enabled for Debug builds, since it sets -O0 to make sure coverage
# has meaningful results
- name: Configure CMake
run: |
cmake -S . -B ./build -G "${{matrix.generator}}" -DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} -DENABLE_DEVELOPER_MODE:BOOL=${{matrix.developer_mode}} -DOPT_ENABLE_COVERAGE:BOOL=${{ matrix.build_type == 'Debug' }}
- name: Build
# Execute the build. You can specify a specific target with "--target <NAME>"
run: |
cmake --build ./build --config ${{matrix.build_type}}
- name: Unix - Test and coverage
if: runner.os != 'Windows'
working-directory: ./build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: |
ctest -C ${{matrix.build_type}}
gcovr -j ${{env.nproc}} --delete --root ../ --print-summary --xml-pretty --xml coverage.xml . --gcov-executable '${{ matrix.gcov_executable }}'
- name: Windows - Test and coverage
if: runner.os == 'Windows'
working-directory: ./build
run: |
OpenCppCoverage.exe --export_type cobertura:coverage.xml --cover_children -- ctest -C ${{matrix.build_type}}
- name: Publish to codecov
uses: codecov/codecov-action@v2
with:
flags: ${{ runner.os }}
name: ${{ runner.os }}-coverage
files: ./build/coverage.xml