Unit Test #282
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: Unit Test | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
workflow_dispatch: | |
inputs: | |
compiler: | |
description: 'Compiler' | |
required: false | |
default: 'all' | |
type: choice | |
options: | |
- all | |
- gcc | |
- clang | |
- mingw | |
- msvc | |
- xcode | |
jobs: | |
ci_coverage: | |
if: ${{ !inputs.compiler }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ ubuntu-22.04 ] | |
build_type: [ Debug ] | |
env: | |
COVERAGE_DIR: ${{github.workspace}}/coverage | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install lcov | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y lcov | |
- name: Configure CMake | |
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DENABLE_COVERAGE=ON | |
- name: Build | |
run: cmake --build ${{github.workspace}}/build --config ${{matrix.build_type}} --parallel 10 | |
- name: Run tests | |
working-directory: ${{github.workspace}} | |
run: cd build ; ctest --build-config ${{ matrix.build_type }} --output-on-failure --parallel 10 | |
- name: Generate coverage files | |
run: | | |
mkdir ${{env.COVERAGE_DIR}} | |
lcov --capture --directory . --output-file ${{env.COVERAGE_DIR}}/coverage.info | |
lcov --remove ${{env.COVERAGE_DIR}}/coverage.info '/usr/*' --output-file ${{env.COVERAGE_DIR}}/coverage.info | |
lcov --remove ${{env.COVERAGE_DIR}}/coverage.info '*/examples/*' --output-file ${{env.COVERAGE_DIR}}/coverage.info | |
lcov --remove ${{env.COVERAGE_DIR}}/coverage.info '*/tests/*' --output-file ${{env.COVERAGE_DIR}}/coverage.info | |
lcov --list ${{env.COVERAGE_DIR}}/coverage.info # debug info | |
- uses: codecov/codecov-action@v1 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ${{ env.COVERAGE_DIR }}/coverage.info | |
# directory: ${{ env.COVERAGE_DIR }} | |
# functionalities: gcov,gcovout | |
env_vars: OS | |
flags: unittests | |
name: codecov-umbrella | |
fail_ci_if_error: true | |
verbose: true | |
ci_gcc: | |
if: ${{ !inputs.compiler || inputs.compiler == 'gcc' }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ ubuntu-22.04, macos-12 ] | |
compiler: [ g++-9, g++-10, g++-11, g++-12, g++-13 ] | |
build_type: [ Debug ] | |
exclude: | |
- os: macos-12 | |
compiler: g++-9 | |
- os: macos-12 | |
compiler: g++-10 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Configure CMake | |
run: cmake -B ${{github.workspace}}/build -DCMAKE_CXX_COMPILER="${{matrix.compiler}}" -DCMAKE_BUILD_TYPE=${{matrix.build_type}} | |
- name: Build | |
run: cmake --build ${{github.workspace}}/build --config ${{matrix.build_type}} --parallel 10 | |
- name: Run tests | |
working-directory: ${{github.workspace}} | |
run: cd build ; ctest --build-config ${{ matrix.build_type }} --output-on-failure --parallel 10 | |
ci_clang: | |
if: ${{ !inputs.compiler || inputs.compiler == 'clang' }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ ubuntu-22.04, windows-2022, macos-12 ] | |
clang_version: [ 10, 11, 12, 13 ] | |
build_type: [ Debug ] | |
include: | |
- os: ubuntu-22.04 | |
cmake_params: -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -stdlib=libc++" | |
- os: windows-2022 | |
cmake_params: -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} /EHsc" | |
- os: macos-12 | |
cmake_params: -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS}" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install LLVM and Clang | |
uses: KyleMayes/install-llvm-action@v1 | |
with: | |
version: ${{ matrix.clang_version }} | |
- name: Configure CMake | |
run: | | |
clang++ --version | |
cmake -B ${{github.workspace}}/build -DCMAKE_CXX_COMPILER="clang++" -DCMAKE_BUILD_TYPE=${{matrix.build_type}} ${{matrix.cmake_params}} | |
- name: Build | |
run: cmake --build ${{github.workspace}}/build --config ${{matrix.build_type}} --parallel 10 | |
- name: Run tests | |
working-directory: ${{github.workspace}} | |
run: cd build ; ctest --build-config ${{ matrix.build_type }} --output-on-failure --parallel 10 | |
ci_xcode: | |
if: ${{ !inputs.compiler || inputs.compiler == 'xcode' }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ macos-12 ] | |
build_type: [ Debug ] | |
xcode_version: [ 14.2, 13.4.1 ] | |
env: | |
DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode_version }}.app/Contents/Developer | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Configure CMake | |
run: | | |
clang++ --version | |
cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.build_type}} | |
- name: Build | |
run: cmake --build ${{github.workspace}}/build --config ${{matrix.build_type}} --parallel 10 | |
- name: Run tests | |
working-directory: ${{github.workspace}} | |
run: cd build ; ctest --build-config ${{ matrix.build_type }} --output-on-failure --parallel 10 | |
ci_mingw: | |
if: ${{ !inputs.compiler || inputs.compiler == 'mingw' }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ windows-2022 ] | |
architecture: [ x64, x86 ] | |
build_type: [ Debug ] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up MinGW | |
uses: egor-tensin/setup-mingw@v2 | |
with: | |
platform: ${{ matrix.architecture }} | |
version: 12.2.0 # https://github.com/egor-tensin/setup-mingw/issues/14 | |
- name: Configure CMake | |
run: cmake -B build -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=${{matrix.build_type}} | |
- name: Build | |
run: cmake --build build --config ${{matrix.build_type}} --parallel 10 | |
- name: Run tests | |
run: cd build ; ctest --build-config ${{ matrix.build_type }} --output-on-failure --parallel 10 | |
ci_msvc: | |
if: ${{ !inputs.compiler || inputs.compiler == 'msvc' }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ windows-2019, windows-2022 ] | |
build_type: [ Debug ] | |
architecture: [ Win32, x64 ] | |
include: | |
- os: windows-2019 | |
vsversion: Visual Studio 16 2019 | |
- os: windows-2022 | |
vsversion: Visual Studio 17 2022 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Configure CMake | |
run: cmake -B build -G "${{ matrix.vsversion }}" -A ${{ matrix.architecture }} | |
- name: Build | |
run: cmake --build build --config ${{ matrix.build_type }} --parallel 10 | |
- name: Run tests | |
run: cd build ; ctest --build-config ${{ matrix.build_type }} --output-on-failure --parallel 10 |