-
Notifications
You must be signed in to change notification settings - Fork 2
112 lines (99 loc) · 3.4 KB
/
ci_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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
name: "CI tests"
on: [ push ]
jobs:
build:
name: Tests and application run on ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "Windows Latest MSVC", artifact: "Windows-MSVC.tar.xz",
os: windows-latest,
build_type: "Release", cc: "cl", cxx: "cl",
environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat"
}
- {
name: "Windows Latest MinGW", artifact: "Windows-MinGW.tar.xz",
os: windows-latest,
build_type: "Release", cc: "gcc", cxx: "g++"
}
- {
name: "Ubuntu Latest GCC", artifact: "Linux.tar.xz",
os: ubuntu-latest,
build_type: "Release", cc: "gcc", cxx: "g++"
}
- {
name: "macOS Latest Clang", artifact: "macOS.tar.xz",
os: macos-latest,
build_type: "Release", cc: "clang", cxx: "clang++"
}
steps:
- uses: actions/checkout@v3
- name: Create CMake cache
shell: bash
run: |
if [ "${{ matrix.config.cxx }}" == "g++" ]; then
cmake -S . -B cmake-build-release -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles"
cmake -S . -B cmake-build-debug -DCMAKE_BUILD_TYPE=Debug -G "Unix Makefiles"
else
cmake -S . -B cmake-build-release -DCMAKE_BUILD_TYPE=Release
cmake -S . -B cmake-build-debug -DCMAKE_BUILD_TYPE=Debug
fi
- name: Build main target
shell: bash
run: |
cmake --build cmake-build-release --target cpp_tests || echo "Built with errors"
- name: Build tests target
shell: bash
run: |
cmake --build cmake-build-debug --target cpp_tests_tests || echo "Built with errors"
- name: Run program
shell: bash
working-directory: ./cmake-build-release
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
if [ "${{ matrix.config.cxx }}" == "g++" ]; then
./cpp_tests.exe --help
else
cd Debug
./cpp_tests.exe --help
fi
else
cd bin
./cpp_tests --help
fi
- name: Run tests
shell: bash
working-directory: ./cmake-build-debug
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
if [ "${{ matrix.config.cxx }}" == "g++" ]; then
./cpp_tests_tests.exe
else
cd Debug
./cpp_tests_tests.exe
fi
else
cd tests
./cpp_tests_tests
fi
memory-leaks:
name: Find memory leaks in tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install valgrind
run: |
sudo apt-get update && sudo apt-get -y install valgrind
- name: Create CMake cache
run: |
cmake -S . -B cmake-build -DCMAKE_BUILD_TYPE=Debug
- name: Build tests target
run: |
cmake --build cmake-build --target cpp_tests_tests
- name: Run valgrind
working-directory: ./cmake-build/tests
run: |
valgrind --leak-check=full --track-origins=yes --error-exitcode=1 ./cpp_tests_tests