-
Notifications
You must be signed in to change notification settings - Fork 0
314 lines (270 loc) · 10.1 KB
/
main.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
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
name: Flow pipeline
on:
push:
branches:
- '*'
pull_request:
branches:
- '*'
# To run a workflow manually, the workflow must be configured to run on the workflow_dispatch event.
workflow_dispatch:
jobs:
doc:
strategy:
fail-fast: false
matrix:
compiler:
- id: clang-15
name: clang
version: 15
c-path: /usr/bin/clang-15
cpp-path: /usr/bin/clang++-15
build-type:
- id: release
conan-build-type: Release
conan-preset: release
runs-on: ubuntu-latest
name: |
doc-${{ matrix.compiler.id }}-${{ matrix.build-type.id }}
steps:
- name: Checkout Flow repository
uses: actions/checkout@v4
- name: Update available software list for apt-get
run: sudo apt-get update
- name: Install Flow dependencies (like Graphviz) with apt-get
run: |
sudo apt-get install -y graphviz
- name: Install the latest version of Conan which is less than 2
run: |
pip install "conan<2"
- name: Create Conan profile
run: |
cat <<EOF > conan_profile
[settings]
compiler = ${{ matrix.compiler.name }}
compiler.version = ${{ matrix.compiler.version }}
compiler.cppstd = 17
compiler.libcxx = libstdc++11
arch = x86_64
os = Linux
build_type = ${{ matrix.build-type.conan-build-type }}
[conf]
tools.build:compiler_executables = { "c": "${{ matrix.compiler.c-path }}", "cpp": "${{ matrix.compiler.cpp-path }}" }
tools.env.virtualenv:auto_use = True
[buildenv]
CC = ${{ matrix.compiler.c-path }}
CXX = ${{ matrix.compiler.cpp-path }}
[options]
flow:build = False
flow:doc = True
EOF
- name: Install Flow dependencies (like Doxygen) with Conan using the profile
run: |
conan install \
. \
--profile:build conan_profile \
--profile:host conan_profile \
--build missing
which cmake
echo $PATH
/usr/local/bin/cmake --version
cmake \
--preset ${{ matrix.build-type.conan-preset }} \
-DCFG_ENABLE_DOC_GEN=ON \
-DCFG_SKIP_CODE_GEN=ON
- name: Get the number of processor cores to generate documentation in parallel
uses: SimenB/github-actions-cpu-cores@v1
id: cpu-cores
- name: Generate code documentation (full and API-only) using Makefile and Doxygen
run: |
VERBOSE=1 make \
flow_doc_public \
flow_doc_full \
--directory $GITHUB_WORKSPACE/build/${{ matrix.build-type.conan-build-type }} \
-j${{ steps.cpu-cores.outputs.count }}
- name: Package documentation tarball [full, API-only and landing page]
run: |
cd $GITHUB_WORKSPACE/doc/flow_doc
$GITHUB_WORKSPACE/tools/doc/stage_generated_docs.sh $GITHUB_WORKSPACE/build/${{ matrix.build-type.conan-build-type }}
- name: Upload documentation tarball
uses: actions/upload-artifact@v3
with:
name: flow-doc-${{ matrix.compiler.id }}-${{ matrix.build-type.id }}
path: |
${{ github.workspace }}/doc/flow_doc.tgz
build:
strategy:
fail-fast: false
matrix:
compiler:
- id: gcc-9
name: gcc
version: 9
c-path: /usr/bin/gcc-9
cpp-path: /usr/bin/g++-9
- id: gcc-10
name: gcc
version: 10
c-path: /usr/bin/gcc-10
cpp-path: /usr/bin/g++-10
- id: gcc-11
name: gcc
version: 11
c-path: /usr/bin/gcc-11
cpp-path: /usr/bin/g++-11
- id: gcc-13
name: gcc
version: 13
c-path: /usr/bin/gcc-13
cpp-path: /usr/bin/g++-13
- id: clang-13
name: clang
version: 13
c-path: /usr/bin/clang-13
cpp-path: /usr/bin/clang++-13
- id: clang-15
name: clang
version: 15
c-path: /usr/bin/clang-15
cpp-path: /usr/bin/clang++-15
- id: clang-16
name: clang
version: 16
c-path: /usr/bin/clang-16
cpp-path: /usr/bin/clang++-16
install: True
- id: clang-17
name: clang
version: 17
c-path: /usr/bin/clang-17
cpp-path: /usr/bin/clang++-17
install: True
build-type:
- id: relwithdebinfo-tsan
conan-build-type: RelWithDebInfo
conan-preset: relwithdebinfo
conan-custom-settings: |
data['compiler']['gcc']['sanitizer'] = ['None', 'address', 'thread', 'memory', 'undefined-behavior']
data['compiler']['clang']['sanitizer'] = ['None', 'address', 'thread', 'memory', 'undefined-behavior']
conan-profile-custom-conf: |
tools.build:cflags = [ "-fsanitize=thread" ]
tools.build:cxxflags = [ "-fsanitize=thread" ]
tools.build:sharedlinkflags = [ "-fsanitize=thread" ]
tools.build:staticlinkflags = [ "-fsanitize=thread" ]
tools.build:exelinkflags = [ "-fsanitize=thread" ]
tools.build:defines = [ "CMAKE_STATIC_LINKER_FLAGS=-fsanitize=thread" ]
conan-profile-custom-settings: |
compiler.sanitizer = thread
before-each-test: |
export TSAN_OPTIONS="suppressions=$GITHUB_WORKSPACE/tsan_suppressions.cfg second_deadlock_stack=1"
exclude:
- compiler: { id: gcc-9 }
build-type: { id: relwithdebinfo-tsan }
- compiler: { id: gcc-10 }
build-type: { id: relwithdebinfo-tsan }
- compiler: { id: gcc-11 }
build-type: { id: relwithdebinfo-tsan }
- compiler: { id: gcc-13 }
build-type: { id: relwithdebinfo-tsan }
runs-on: ubuntu-latest
name: |
build-${{ matrix.compiler.id }}-${{ matrix.build-type.id }}
steps:
- name: Checkout Flow repository
uses: actions/checkout@v4
- name: Update available software list for apt-get
run: sudo apt-get update
- name: Install clang compiler
if: |
matrix.compiler.install && matrix.compiler.name == 'clang'
run: |
wget https://apt.llvm.org/llvm.sh
chmod u+x llvm.sh
sudo ./llvm.sh ${{ matrix.compiler.version }}
- name: Install GCC compiler
if: |
matrix.compiler.install && matrix.compiler.name == 'gcc'
run: |
sudo apt-get install -y software-properties-common
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
sudo apt-get update
sudo apt-get install -y gcc-${{ matrix.compiler.version }} g++-${{ matrix.compiler.version }}
- name: Install the latest version of Conan which is less than 2
run: |
pip install "conan<2"
- name: Add custom settings for Conan packages
run: |
conan config init
pip install PyYAML
CONAN_SETTINGS_PATH=$(conan config home)/settings.yml
python -c "
import yaml
with open('$CONAN_SETTINGS_PATH', 'r') as file:
data = yaml.safe_load(file)
${{ matrix.build-type.conan-custom-settings }}
with open('$CONAN_SETTINGS_PATH', 'w') as file:
yaml.dump(data, file)
"
if: |
matrix.build-type.conan-custom-settings
- name: Create Conan profile
run: |
cat <<EOF > conan_profile
[settings]
compiler = ${{ matrix.compiler.name }}
compiler.version = ${{ matrix.compiler.version }}
compiler.cppstd = 17
# TODO: Consider testing with LLVM-libc++ also (with clang anyway).
compiler.libcxx = libstdc++11
arch = x86_64
os = Linux
build_type = ${{ matrix.build-type.conan-build-type }}
${{ matrix.build-type.conan-profile-custom-settings }}
[conf]
tools.build:compiler_executables = {"c": "${{ matrix.compiler.c-path }}", "cpp": "${{ matrix.compiler.cpp-path }}"}
${{ matrix.build-type.conan-profile-custom-conf }}
[buildenv]
CC = ${{ matrix.compiler.c-path }}
CXX = ${{ matrix.compiler.cpp-path }}
LD_FLAGS = -fsanitize=thread
LDFLAGS = -fsanitize=thread
[options]
flow:build = True
flow:doc = False
EOF
- name: Install Flow dependencies with Conan using the profile
run: |
conan install \
. \
--profile:build conan_profile \
--profile:host conan_profile \
--build missing
- name: Get the number of processor cores to enable parallelization when working with Makefile
uses: SimenB/github-actions-cpu-cores@v1
id: cpu-cores
- name: Prepare Makefile using CMake
run: |
which cmake
/usr/local/bin/cmake --version
echo $PATH
cmake \
--preset ${{ matrix.build-type.conan-preset }} \
-DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/install/${{ matrix.build-type.conan-build-type }}
- name: Build library and demos/tests with Makefile
run: |
VERBOSE=1 make \
--keep-going \
--directory $GITHUB_WORKSPACE/build/${{ matrix.build-type.conan-build-type }} \
-j${{ steps.cpu-cores.outputs.count }}
- name: Install library and demos/tests with Makefile
run: |
VERBOSE=1 make install \
--directory $GITHUB_WORKSPACE/build/${{ matrix.build-type.conan-build-type }} \
-j${{ steps.cpu-cores.outputs.count }}
- name: Run 'NetFlow echo' demo/test
run: |
${{ matrix.build-type.before-each-test }}
cd $GITHUB_WORKSPACE/install/${{ matrix.build-type.conan-build-type }}/bin/
./net_flow_echo_srv.exec 8888 localhost &
sleep 1
./net_flow_echo_cli.exec 1 127.0.01 8888 "Hello world!"