-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (49 loc) · 1.69 KB
/
unit_tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: unit tests
on: [push]
jobs:
unit-tests:
runs-on: ${{ matrix.os }}
strategy:
matrix:
config: [Release, Debug]
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- name: Get latest cmake
uses: lukka/get-cmake@latest
- name: Configure
shell: cmake -P {0}
run: |
file(GLOB LISTT "$ENV{VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/*")
message("${LISTT}")
if ("${{ matrix.os }}" STREQUAL "windows-latest")
set(vcpkg_triplet x64-windows)
set(compiler_flags "/EHsc /W4")
else()
set(vcpkg_triplet x64-linux)
set(compiler_flags "-Wall -Wextra -Wpedantic -Wconversion -Wshadow")
set(ENV{CC} "gcc-13")
set(ENV{CXX} "g++-13")
endif()
execute_process(
COMMAND cmake
-S .
-B build
-D CMAKE_BUILD_TYPE=${{ matrix.config}}
-D VCPKG_TARGET_TRIPLET=${vcpkg_triplet}
-D "CMAKE_C_FLAGS=${compiler_flags}"
-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/bin/junit_*.xml'