generated from cpp-best-practices/cmake_conan_boilerplate_template
-
-
Notifications
You must be signed in to change notification settings - Fork 5
151 lines (131 loc) · 4.11 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
name: ci
on:
pull_request:
release:
types: [published]
push:
branches:
- main
- develop
- master
jobs:
Test:
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
runs-on: ${{ matrix.os }}
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
# Recommendations:
# * support at least 2 operating systems
# * support at least 2 compilers
# * make sure all supported configurations for your project are built
#
# Disable/enable builds in this list to meet the above recommendations
# and your own projects needs
matrix:
os:
- ubuntu-22.04
- macos-13
- macos-14
- windows-2022
compiler:
# you can specify the version after `-` like "llvm-13.0.0".
- llvm
- gcc
CMAKE_GENERATOR:
- "Ninja Multi-Config"
CPACK_GENERATOR:
- ZIP
include:
# Inject GCOV variable for gcc
- compiler: gcc
GCOV: gcov
# Inject GCOV variable for llvm
- compiler: llvm
GCOV: "llvm-cov gcov"
# Only to test non-multiconfig builds
- os: ubuntu-22.04
compiler: gcc-11
CMAKE_GENERATOR: "Unix Makefiles"
GCOV: gcov-11
- os: windows-2022
compiler: msvc
CMAKE_GENERATOR: "Visual Studio 17 2022"
- os: macos-14
compiler: appleclang
# To exclude a specific job from the matrix (e.g llvm on macos-14), you can use this syntax.
exclude:
- os: macos-14
compiler: llvm
steps:
- uses: actions/checkout@v4
- name: Cache
uses: actions/cache@v4
with:
path: |
~/vcpkg
./build/vcpkg_installed
${{ env.CONAN_USER_HOME }}
~/.cache/pip
${{ env.HOME }}/.cache/vcpkg/archives
${{ env.XDG_CACHE_HOME }}/vcpkg/archives
${{ env.LOCALAPPDATA }}\vcpkg\archives
${{ env.APPDATA }}\vcpkg\archives
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ hashFiles('./vcpkg.json')}}-${{ matrix.CMAKE_GENERATOR }}-${{ hashFiles('**/CMakeLists.txt') }}
restore-keys: |
${{ runner.os }}-${{ matrix.compiler }}-${{ hashFiles('./vcpkg.json') }}-
- name: Setup Cpp
uses: aminya/setup-cpp@v1
with:
compiler: ${{ matrix.compiler }}
vcvarsall: ${{ contains(matrix.os, 'windows' )}}
cmake: "3.28.4"
ninja: true
vcpkg: true
ccache: true
clangtidy: true
task: true
cppcheck: true
gcovr: 7.2
opencppcoverage: true
- name: Initialize CodeQL
if: ${{ contains(matrix.os, 'ubuntu') && contains(matrix.compiler, 'llvm') }}
uses: github/codeql-action/init@v3
with:
languages: "cpp"
- name: Test/Coverage
run: |
task coverage
env:
CMAKE_GENERATOR: ${{matrix.CMAKE_GENERATOR}}
GCOV: ${{matrix.GCOV}}
- name: Test release
run: |
task test_release
env:
CMAKE_GENERATOR: ${{matrix.CMAKE_GENERATOR}}
GCOV: ${{matrix.GCOV}}
- name: Install
run: |
task install
env:
CMAKE_GENERATOR: ${{matrix.CMAKE_GENERATOR}}
CPACK_GENERATOR: ${{matrix.CPACK_GENERATOR}}
- name: Perform CodeQL Analysis
if: ${{ contains(matrix.os, 'ubuntu') && contains(matrix.compiler, 'llvm') }}
uses: github/codeql-action/analyze@v3
- name: Publish Tagged Release
uses: softprops/action-gh-release@v2
if: ${{ startsWith(github.ref, 'refs/tags/') && matrix.CPACK_GENERATOR != '' }}
with:
files: |
build/*-*Release*-*.*
- name: Publish to codecov
uses: codecov/codecov-action@v4
with:
flags: ${{ runner.os }}
name: ${{ runner.os }}-coverage
files: ./build/coverage.xml