Merge pull request #27 from yobeonline/io1 #214
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 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: Configure | |
shell: cmake -P {0} | |
run: | | |
if ("${{ matrix.compiler }}" STREQUAL "msvc") | |
set(vcpkg_triplet x64-windows) | |
set(compiler_flags "/EHsc /W4") | |
else() | |
set(vcpkg_triplet x64-linux) | |
set(compiler_flags "-Wall -Wextra -Wpedantic -Wconversion -Wshadow") | |
if ("${{ matrix.compiler }}" STREQUAL "gcc") | |
set(ENV{CC} "gcc-13") | |
set(ENV{CXX} "g++-13") | |
else() | |
set(ENV{CC} "clang-15") | |
set(ENV{CXX} "clang++-15") | |
endif() | |
endif() | |
execute_process( | |
COMMAND cmake | |
-S . | |
-B build | |
-D CMAKE_BUILD_TYPE=${{ matrix.config }} | |
-D VCPKG_TARGET_TRIPLET=${vcpkg_triplet} | |
-D "CMAKE_CXX_FLAGS=${compiler_flags}" | |
--toolchain "$ENV{VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake" | |
RESULT_VARIABLE result | |
) | |
if (NOT result EQUAL 0) | |
message(FATAL_ERROR "Bad exit status") | |
endif() | |
- 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@v3 | |
with: | |
report_paths: 'build/test/junit_*.xml' | |
- name: Install | |
run: cmake --install build --prefix install --config ${{ matrix.config }} | |
- name: Configure with install | |
shell: cmake -P {0} | |
run: | | |
if ("${{ matrix.compiler }}" STREQUAL "gcc") | |
set(ENV{CC} "gcc-13") | |
set(ENV{CXX} "g++-13") | |
else() | |
set(ENV{CC} "clang-15") | |
set(ENV{CXX} "clang++-15") | |
endif() | |
execute_process( | |
COMMAND cmake | |
-S test | |
-B install_build | |
-D CMAKE_BUILD_TYPE=${{ matrix.config }} | |
-D "io1_DIR=../install/share/io1/cmake" | |
RESULT_VARIABLE result | |
) | |
if (NOT result EQUAL 0) | |
message(FATAL_ERROR "Bad exit status") | |
endif() | |
- name: Build with install | |
run: cmake --build install_build --config ${{ matrix.config }} --parallel |