-
Notifications
You must be signed in to change notification settings - Fork 45
147 lines (117 loc) · 3.83 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
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: Install libelf
if: ${{ matrix.os == 'ubuntu-latest' }}
run: sudo apt install -y libelf-dev
- 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_32bit_linux:
strategy:
fail-fast: false
matrix:
cxx-std: [11, 14, 17, 20]
name: debian-latest 32bit (C++${{ matrix.cxx-std }} - gcc)
runs-on: ubuntu-latest
container:
image: i386/debian:latest
steps:
- 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
working-directory: build
run: ctest --verbose
memory_check:
name: memory check
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Update packages
run: sudo apt update
- name: Install valgrind
run: sudo apt install -y valgrind libelf-dev
- name: Generate tests build file
run: cmake . -B build -DCMAKE_CXX_STANDARD=20 -DDYLIB_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Debug
- name: Build unit tests
run: cmake --build build
- name: Run unit tests with valgrind
working-directory: build
run: valgrind --leak-check=full --show-leak-kinds=all --error-exitcode=1 ./unit_tests