-
Notifications
You must be signed in to change notification settings - Fork 46
112 lines (89 loc) · 2.93 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
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]
generator: [Unix Makefiles, MinGW Makefiles, Visual Studio 17]
exclude:
- os: windows-latest
generator: Unix Makefiles
- os: macos-latest
generator: MinGW Makefiles
- os: macos-latest
generator: Visual Studio 17
- os: ubuntu-latest
generator: MinGW Makefiles
- os: ubuntu-latest
generator: Visual Studio 17
- generator: MinGW Makefiles
cxx-std: 17
- generator: MinGW Makefiles
cxx-std: 20
name: ${{ matrix.os }} (C++${{ matrix.cxx-std }} - ${{ matrix.generator }})
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- 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
- 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
memory_check:
name: memory check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- 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
linter:
name: linter
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install cpplint
run: pip install cpplint
- name: Run cpplint
run: cpplint --linelength=140 --filter=-whitespace/indent,-whitespace/parens,-build/include_subdir src/* include/*