forked from Zuehlke/cpp_example_project
-
Notifications
You must be signed in to change notification settings - Fork 0
241 lines (203 loc) · 8.32 KB
/
build_cmake.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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
name: CMake
on: [push, pull_request]
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: RelWithDebInfo
# Conan cache environment variables
CONAN_SYSREQUIRES_MODE: enabled
CONAN_USER_HOME: "${{ github.workspace }}/conan-cache"
CONAN_USER_HOME_SHORT: "${{ github.workspace }}/conan-cache/short"
jobs:
docker:
name: Test docker images
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Build docker-ci image
shell: bash
run: cd docker && ./build-ci-image.sh
- name: Build docker-dev image
shell: bash
run: cd docker && ./build-dev-image.sh
- name: Build .devcontainer docker image
shell: bash
run: cd .devcontainer && DOCKER_BUILDKIT=1 docker build -t devcontainer:latest .
linux:
name: ${{ matrix.os }}, ${{ matrix.compiler.name }}, C++${{ matrix.cxx }}, ${{ matrix.buildtype }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false # 'false' means Don't stop matrix workflows even if some matrix entry fails.
matrix:
os: [ubuntu-22.04]
buildtype: [debug]
compiler: [ {name: 'GCC 10', preset: gcc-10, pkgs: 'gcc-10 g++-10 lib32gcc-10-dev gcc-multilib'},
{name: 'GCC 11', preset: gcc-11, pkgs: 'gcc-11 g++-11 lib32gcc-11-dev gcc-multilib'},
{name: 'GCC 12', preset: gcc-12, pkgs: 'gcc-12 g++-12 lib32gcc-12-dev gcc-multilib'},
{name: 'Clang 12', preset: clang-12, pkgs: 'clang-12 llvm-12'},
{name: 'Clang 13', preset: clang-13, pkgs: 'clang-13 llvm-13'},
{name: 'Clang 14', preset: clang-14, pkgs: 'clang-14 llvm-14'},
{name: 'Clang 15', preset: clang-15, pkgs: 'clang-15 llvm-15'}
]
cxx: [17, 20]
steps:
- uses: actions/checkout@v3
- name: Cache
uses: actions/cache@v3
env:
cache-name: cache-conan-modules
with:
path: |
${{ env.CONAN_USER_HOME }}
~/.cache/pip
key: ${{ runner.os }}-${{ env.BUILD_TYPE }}-${{ hashFiles('CMakeLists.txt') }}-${{ hashFiles('cmake/Conan.cmake') }}
- name: Install conan
shell: bash
run: |
python3 -m pip install --upgrade pip setuptools conan
source ~/.profile
- name: Install dependencies
run: |
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
sudo apt update
sudo apt install ninja-build ${{ matrix.compiler.pkgs }}
shell: bash
- name: Configure via CMake
shell: bash
run: cmake --preset unixlike-${{ matrix.compiler.preset }}-${{ matrix.buildtype }} -DCXX_STANDARD=${{ matrix.cxx }}
- name: Build
shell: bash
run: cmake --build --preset build-unixlike-${{ matrix.compiler.preset }}-${{ matrix.buildtype }}
- name: Test
shell: bash
run: ctest --preset test-unixlike-${{ matrix.compiler.preset }}-${{ matrix.buildtype }}
linux-static_analysis:
name: Static Analysis, ${{ matrix.os }}, ${{ matrix.compiler.name }}, ${{ matrix.buildtype }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false # 'false' means Don't stop matrix workflows even if some matrix entry fails.
matrix:
os: [ubuntu-22.04]
buildtype: [debug]
compiler: [{name: 'Clang 15', preset: clang-15, pkgs: 'clang-15 llvm-15 llvm-15-dev libclang-15-dev', iwyu_branch: 'clang_15', path_prefix: "/usr/lib/llvm-15"}]
steps:
- uses: actions/checkout@v3
- name: Cache
uses: actions/cache@v3
env:
cache-name: cache-conan-modules
with:
path: |
${{ env.CONAN_USER_HOME }}
~/.cache/pip
key: ${{ runner.os }}-${{ env.BUILD_TYPE }}-${{ hashFiles('CMakeLists.txt') }}-${{ hashFiles('cmake/Conan.cmake') }}
- name: Install conan
shell: bash
run: |
python3 -m pip install --upgrade pip setuptools conan
source ~/.profile
- name: Install dependencies
run: |
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
sudo apt update
sudo apt install ninja-build ${{ matrix.compiler.pkgs }} cppcheck
shell: bash
- name: Compile and install IWYU
run: |
mkdir iwyu && cd iwyu
git clone https://github.com/include-what-you-use/include-what-you-use.git
cd include-what-you-use
git checkout ${{ matrix.compiler.iwyu_branch }}
cd ..
mkdir build && cd build
cmake -G "Ninja" -DCMAKE_PREFIX_PATH=${{ matrix.compiler.path_prefix }} ../include-what-you-use
ninja
sudo ninja install
shell: bash
- name: Configure via CMake
shell: bash
run: cmake --preset unixlike-${{ matrix.compiler.preset }}-${{ matrix.buildtype }}-static-analysis
- name: Build
shell: bash
run: cmake --build --preset build-unixlike-${{ matrix.compiler.preset }}-${{ matrix.buildtype }}-static-analysis
linux-cross-compiling-armv7:
name: ARM GCC, ${{ matrix.os }}, ${{ matrix.buildtype }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false # 'false' means Don't stop matrix workflows even if some matrix entry fails.
matrix:
os: [ubuntu-22.04]
buildtype: [debug, release]
steps:
- uses: actions/checkout@v3
- name: Cache
uses: actions/cache@v3
env:
cache-name: cache-conan-modules
with:
path: |
${{ env.CONAN_USER_HOME }}
~/.cache/pip
key: ${{ runner.os }}-${{ env.BUILD_TYPE }}-${{ hashFiles('CMakeLists.txt') }}-${{ hashFiles('cmake/Conan.cmake') }}
- name: Install conan
shell: bash
run: |
python3 -m pip install --upgrade pip setuptools conan
source ~/.profile
- name: Install dependencies
run: |
sudo apt update
sudo apt install ninja-build wget
shell: bash
- name: Install GCC ARM
run: |
wget -O archive.tar.xz "https://developer.arm.com/-/media/Files/downloads/gnu/12.2.rel1/binrel/arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi.tar.xz?rev=7bd049b7a3034e64885fa1a71c12f91d&hash=732D909FA8F68C0E1D0D17D08E057619" && \
echo 84be93d0f9e96a15addd490b6e237f588c641c8afdf90e7610a628007fc96867 archive.tar.xz > /tmp/archive.sha256 && sha256sum -c /tmp/archive.sha256 && rm /tmp/archive.sha256 && \
tar xf archive.tar.xz -C /opt
shell: bash
- name: Configure via CMake
shell: bash
run: cmake --preset gcc-arm-${{ matrix.buildtype }}
- name: Build
shell: bash
run: cmake --build --preset build-gcc-arm-${{ matrix.buildtype }}
linux-fuzzing:
name: ${{ matrix.os }}, ${{ matrix.compiler.name }}, libFuzzer, ${{ matrix.buildtype }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false # 'false' means Don't stop matrix workflows even if some matrix entry fails.
matrix:
os: [ubuntu-22.04]
buildtype: [debug]
compiler: [ {name: 'Clang 12', preset: clang-12, pkgs: 'clang-12 llvm-12'},
{name: 'Clang 13', preset: clang-13, pkgs: 'clang-13 llvm-13'},
{name: 'Clang 14', preset: clang-14, pkgs: 'clang-14 llvm-14'},
{name: 'Clang 15', preset: clang-15, pkgs: 'clang-15 llvm-15'}
]
steps:
- uses: actions/checkout@v3
- name: Cache
uses: actions/cache@v3
env:
cache-name: cache-conan-modules
with:
path: |
${{ env.CONAN_USER_HOME }}
~/.cache/pip
key: ${{ runner.os }}-${{ env.BUILD_TYPE }}-${{ hashFiles('CMakeLists.txt') }}-${{ hashFiles('cmake/Conan.cmake') }}
- name: Install conan
shell: bash
run: |
python3 -m pip install --upgrade pip setuptools conan
source ~/.profile
- name: Install dependencies
run: |
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
sudo apt update
sudo apt install ninja-build ${{ matrix.compiler.pkgs }}
shell: bash
- name: Configure via CMake
shell: bash
run: cmake --preset unixlike-${{ matrix.compiler.preset }}-${{ matrix.buildtype }}
- name: Build
shell: bash
run: cmake --build --preset build-unixlike-${{ matrix.compiler.preset }}-${{ matrix.buildtype }}