Skip to content

Merge pull request #30 from yobeonline/mismatch #228

Merge pull request #30 from yobeonline/mismatch

Merge pull request #30 from yobeonline/mismatch #228

Workflow file for this run

name: unit tests
on: [push]
jobs:
unit-tests:
runs-on: ${{ matrix.os }}
strategy:
matrix:
config: [Release, Debug]
os: [ubuntu-latest, windows-latest]
compiler: [gcc, clang, msvc]
exclude:
- os: windows-latest
compiler: gcc
- os: windows-latest
compiler: clang
- os: ubuntu-latest
compiler: msvc
steps:
- uses: actions/checkout@v4
- name: Get latest cmake
uses: lukka/get-cmake@latest
- name: Set environment
shell: cmake -P {0}
run: |
if ("${{ matrix.compiler }}" STREQUAL "msvc")
file(APPEND $ENV{GITHUB_ENV} "VCPKG_TARGET_TRIPLET=x64-windows\n")
file(APPEND $ENV{GITHUB_ENV} "CXXFLAGS=/EHsc /W4\n")
file(APPEND $ENV{GITHUB_ENV} "CFLAGS=/EHsc /W4\n")
else()
file(APPEND $ENV{GITHUB_ENV} "VCPKG_TARGET_TRIPLET=x64-linux\n")
file(APPEND $ENV{GITHUB_ENV} "CXXFLAGS=-Wall -Wextra -Wpedantic -Wconversion -Wshadow\n")
file(APPEND $ENV{GITHUB_ENV} "CFLAGS=-Wall -Wextra -Wpedantic -Wconversion -Wshadow\n")
if ("${{ matrix.compiler }}" STREQUAL "gcc")
file(APPEND $ENV{GITHUB_ENV} "CC=gcc-13\n")
file(APPEND $ENV{GITHUB_ENV} "CXX=g++-13\n")
else()
file(APPEND $ENV{GITHUB_ENV} "CC=clang-15\n")
file(APPEND $ENV{GITHUB_ENV} "CXX=clang++-15\n")
endif()
endif()
file(APPEND $ENV{GITHUB_ENV} "CMAKE_TOOLCHAIN_FILE=$ENV{VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake\n")
- name: Configure
run: cmake -S . -B build -D CMAKE_BUILD_TYPE=${{ matrix.config }}
- name: Build
run: cmake --build build --config ${{ matrix.config }} --parallel
- name: Execute
run: ctest --test-dir build -C ${{ matrix.config }}
- name: Publish test report
uses: mikepenz/action-junit-report@v4
with:
report_paths: 'build/test/junit_*.xml'
- name: Install
run: cmake --install build --prefix install --config ${{ matrix.config }}
- name: Configure with install
run: cmake -S test -B install_build -D CMAKE_BUILD_TYPE=${{ matrix.config }} -D "io1_DIR=../install/share/io1/cmake"
- name: Build with install
run: cmake --build install_build --config ${{ matrix.config }} --parallel