-
Notifications
You must be signed in to change notification settings - Fork 45
181 lines (148 loc) · 4.98 KB
/
CI.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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
name: CI
on:
push:
paths:
- .github/workflows/CI.yml
- CMakeLists.txt
- include/*
- tests/*
- src/*
pull_request:
paths:
- .github/workflows/CI.yml
- CMakeLists.txt
- include/*
- tests/*
- src/*
defaults:
run:
shell: bash
jobs:
unit_tests:
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
cxx-std: [11, 14, 17, 20]
include:
- os: windows-latest
compiler: MSVC
generator: Visual Studio 17
- os: macos-latest
compiler: clang
generator: Unix Makefiles
- os: ubuntu-latest
compiler: gcc
generator: Unix Makefiles
name: ${{ matrix.os }} (C++${{ matrix.cxx-std }} - ${{ matrix.compiler }})
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Generate project files
run: cmake . -B build -G "${{ matrix.generator }}" -DCMAKE_CXX_STANDARD=${{ matrix.cxx-std }} -DDYLIB_BUILD_TESTS=ON -DDYLIB_WARNING_AS_ERRORS=ON
- name: Build dynamic library and unit tests
run: cmake --build build
- name: Run unit tests
working-directory: build
run: ctest --verbose
- name: Generate code coverage
if: ${{ matrix.os == 'ubuntu-latest' && matrix.cxx-std == 20 }}
run: gcov -abcfu build/CMakeFiles/unit_tests.dir/tests/tests.cpp.gcda
- name: Send coverage to codecov.io
if: ${{ matrix.os == 'ubuntu-latest' && matrix.cxx-std == 20 }}
uses: codecov/codecov-action@v3
with:
files: dylib.hpp.gcov
unit_tests_msys2:
defaults:
run:
shell: msys2 {0}
strategy:
fail-fast: false
matrix:
sys: [mingw32, mingw64, ucrt64, clang64]
cxx-std: [11, 14, 17, 20]
name: windows-latest (C++${{ matrix.cxx-std }} - ${{matrix.sys}})
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: msys2/setup-msys2@v2
with:
msystem: ${{matrix.sys}}
update: true
install: make
pacboy: toolchain:p cmake:p
- name: Generate project files
run: cmake . -B build -G "MinGW Makefiles" -DCMAKE_CXX_STANDARD=${{ matrix.cxx-std }} -DDYLIB_BUILD_TESTS=ON -DDYLIB_WARNING_AS_ERRORS=ON
- name: Build dynamic library and unit tests
run: cmake --build build
- name: Run unit tests
working-directory: build
run: ctest --verbose
unit_tests_linux:
strategy:
fail-fast: false
matrix:
cxx-std: [11, 14, 17, 20]
arch: [64bit, 32bit]
action: [tests, valgrind]
include:
- arch: 64bit
docker_arch: amd64
- arch: 32bit
docker_arch: i386
name: linux ${{ matrix.arch }} ${{ matrix.action }} / C++${{ matrix.cxx-std }} / gcc)
runs-on: ubuntu-latest
container:
image: ${{ matrix.docker_arch }}/debian:latest
options: --user root
volumes: ${{ github.workspace }}:/workspace
steps:
# https://github.com/actions/upload-artifact/issues/616
- uses: actions/checkout@v1
- name: Update packages
run: apt update
- name: Install build tools
run: apt install -y build-essential cmake valgrind
- name: Generate project files
run: cmake . -B build -DCMAKE_CXX_STANDARD=${{ matrix.cxx-std }} -DDYLIB_BUILD_TESTS=ON -DDYLIB_WARNING_AS_ERRORS=ON
- name: Build dynamic library and unit tests
run: cmake --build build
- name: Run unit tests
if: ${{ matrix.action == 'tests'}}
working-directory: build
run: ctest --verbose
- name: Run unit tests with valgrind
if: ${{ matrix.action == 'valgrind'}}
working-directory: build
run: valgrind --leak-check=full --show-leak-kinds=all --error-exitcode=1 ./unit_tests
unit_tests_macos:
strategy:
fail-fast: false
matrix:
cxx-std: [11, 14, 17, 20]
arch: [intel, silicon, universal]
action: [tests, leaks]
include:
- arch: intel
osx_arch: x86_64
- arch: silicon
osx_arch: arm64
- arch: universal
osx_arch: arm64;x86_64
name: macos ${{ matrix.arch }} ${{ matrix.action }} / C++${{ matrix.cxx-std }} / clang
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Generate project files
run: cmake . -B build "-DCMAKE_OSX_ARCHITECTURES=${{ matrix.osx_arch }}" -DCMAKE_CXX_STANDARD=${{ matrix.cxx-std }} -DDYLIB_BUILD_TESTS=ON -DDYLIB_WARNING_AS_ERRORS=ON
- name: Build dynamic library and unit tests
run: cmake --build build
- name: Run unit tests
if: ${{ matrix.action == 'tests'}}
working-directory: build
run: ctest --verbose
- name: Run unit tests with leaks
if: ${{ matrix.action == 'leaks'}}
working-directory: build
run: leaks -atExit -- ./unit_tests