forked from bloomberg/blazingmq
-
Notifications
You must be signed in to change notification settings - Fork 0
428 lines (363 loc) · 14.1 KB
/
Copy pathbuild.yaml
File metadata and controls
428 lines (363 loc) · 14.1 KB
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
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
name: Tests
on:
push:
branches:
- main
- 'integration/**'
pull_request:
branches:
- main
- 'integration/**'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
get_dependencies:
name: "Dependencies"
uses: ./.github/workflows/dependencies.yaml
with:
cxx_standard: cpp23
get_dependencies_cpp03:
name: "Dependencies [C++03]"
uses: ./.github/workflows/dependencies.yaml
with:
cxx_standard: cpp03
build_ubuntu:
name: "Build [ubuntu]"
needs: get_dependencies
uses: ./.github/workflows/build-ubuntu.yaml
with:
ref: ${{ github.sha }}
target: "bmqbrkr bmqtool bmqstoragetool all.it"
save_build_as_artifacts: true
run_unit_tests: false
cxx_standard: cpp23
build_ubuntu_cpp03:
name: "Build [ubuntu, C++03]"
needs: get_dependencies_cpp03
uses: ./.github/workflows/build-ubuntu.yaml
with:
ref: ${{ github.sha }}
target: "bmqbrkr bmqtool bmq.t mqb.t"
save_build_as_artifacts: false
run_unit_tests: false
cxx_standard: cpp03
unit_tests_cxx:
name: "UT [c++]"
needs: get_dependencies
uses: ./.github/workflows/build-ubuntu.yaml
with:
ref: ${{ github.sha }}
target: "all.t"
save_build_as_artifacts: false
run_unit_tests: true
cxx_standard: cpp23
unit_tests_python:
name: UT [python]
runs-on: ubuntu-latest
needs: build_ubuntu
steps:
- uses: actions/checkout@v6
- name: Run Python Unit Tests
env:
PYTHONPATH: ${{ github.workspace }}/src/python
run: |
pip install -r ${{ github.workspace }}/src/python/requirements-test.txt
pip install "xsdata[cli]==25.7"
cd ${{ github.workspace }}
src/python/bin/schemagen
src/python/bin/tweakgen
pytest src/python
- name: Print generated schemas
if: failure()
run: |
cd ${{ github.workspace }}
cat src/python/blazingmq/schemas/mqbcfg.py
cat src/python/blazingmq/schemas/mqbconf.py
cat src/python/blazingmq/dev/it/tweaks/generated.py
integration_tests_ubuntu:
name: IT [${{ matrix.cluster }}/${{ matrix.mode }}/${{ matrix.consistency }}]
strategy:
matrix:
mode: ["legacy_mode", "fsm_mode"]
cluster: ["single", "multi"]
consistency: ["eventual_consistency", "strong_consistency", "not (eventual_consistency or strong_consistency)"]
fail-fast: false
runs-on: ubuntu-latest
needs: build_ubuntu
env:
RUN_UID: ${{ matrix.cluster }}_${{ matrix.mode }}_${{ matrix.consistency }}
steps:
- uses: actions/checkout@v6
- uses: actions/download-artifact@v5
with:
name: ${{needs.build_ubuntu.outputs.artifact_key }}
# Solaris: make sure all ITs scripts are compatible with python3.8
- uses: actions/setup-python@v6
with:
python-version: '3.8'
# Set execution permissions for all .tsk
# which were lost when the artifact was created
- name: Chmod all .tsk
run: find ./build -type f -name "*.tsk" -exec chmod +x {} +
- name: Setup core_pattern
run: |
# Default Ubuntu core_pattern: '|/usr/lib/systemd/systemd-coredump %P %u %g %s %t 9223372036854775808 %h'
# To enable core dumps copying to the failure-logs folder (implemented in src/python/blazingmq/dev/it/cluster.py)
# the core_pattern must be an absolute path and must contain %p (i.e. process id)
sudo mkdir /cores
sudo chmod 777 /cores
echo "/cores/%e.%p.%s.%t" | sudo tee /proc/sys/kernel/core_pattern
- name: Run Integration Tests
run: |
# Allow core dumps
ulimit -c unlimited
# Pin tproxy of 27 Feb 2026:
go install github.com/kevwan/tproxy@d6d45cbbd1b3c5dad6e5043b74120f9ea962826b
export GOPATH=$HOME/go
export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin
pip install -r ${{ github.workspace }}/src/python/requirements-test.txt
${{ github.workspace }}/src/integration-tests/run-tests \
"${{ matrix.mode }} and ${{ matrix.cluster }} and ${{ matrix.consistency }}" \
--log-level ERROR \
--log-file-level=info \
--bmq-tolerate-dirty-shutdown \
--bmq-log-dir=failure-logs \
--bmq-log-level=INFO \
--junitxml=integration-tests.xml \
--tb long \
--durations=0 \
-n logical -v
- name: Print core information
if: failure()
run: |
sudo apt-get update && sudo apt-get install -qy gdb
python3 ${{ github.workspace }}/.github/workflows/ext/print_cores.py \
--cores-dir=${{ github.workspace }}/src/integration-tests/failure-logs \
--build-dir=${{ github.workspace }}/build/blazingmq
- name: Upload failure-logs as artifacts
if: failure()
uses: actions/upload-artifact@v5
with:
name: ${{ github.run_id }}_failure_logs_${{ env.RUN_UID }}
path: ${{ github.workspace }}/src/integration-tests/failure-logs
retention-days: 5
- name: Upload broker executable as artifacts to debug the core
if: failure()
uses: actions/upload-artifact@v5
with:
name: ${{ github.run_id }}_bmqbrkr
overwrite: true # broker binary is the same across all matrix runs
path: ${{ github.workspace }}/build/blazingmq/src/applications/bmqbrkr/bmqbrkr.tsk
retention-days: 5
fuzz_tests_ubuntu:
name: Fuzz test [${{ matrix.request }}]
strategy:
matrix:
request: [
"authentication",
"negotiation_bypass_authentication",
"negotiation",
"open_queue",
"configure_stream",
"configure_queue_stream",
"put",
"confirm",
"close_queue",
"disconnect"
]
fail-fast: false
runs-on: ubuntu-latest
needs: build_ubuntu
steps:
- uses: actions/checkout@v6
- uses: actions/download-artifact@v5
with:
name: ${{needs.build_ubuntu.outputs.artifact_key }}
# Set execution permissions for all .tsk
# which were lost when the artifact was created
- name: Chmod all .tsk
run: |
find ./build -type f -name "*.tsk" -exec chmod +x {} +
chmod +x ./build/blazingmq/src/applications/bmqbrkr/run
- name: Setup core_pattern
run: |
sudo mkdir /cores
sudo chmod 777 /cores
echo "/cores/%e.%p.%s.%t" | sudo tee /proc/sys/kernel/core_pattern
- name: Run Fuzz Test
env:
BLAZINGMQ_BUILD_DIR: ${{ github.workspace }}/build/blazingmq
PYTHONPATH: ${{ github.workspace }}/src/python
run: |
pip install -r ${{ github.workspace }}/src/python/requirements-test.txt
pytest "${{ github.workspace }}/src/fuzz-tests/test_fuzz.py::test_fuzz_request[${{ matrix.request }}]" --tb=short > ${{ matrix.request}}_fuzz.log
# Do not print everything, GitHub Actions is not able to handle 100MB+ of logs.
# Typically the error found with fuzzer is related to the latest requests and broker state.
# If this is not enough, consider running the test on your local machine and get full logs.
- name: Print Fuzz Log tail
if: failure()
run: |
tail -n 2000 ${{ matrix.request }}_fuzz.log
- name: Print core information
if: failure()
run: |
sudo apt-get update && sudo apt-get install -qy gdb
python3 ${{ github.workspace }}/.github/workflows/ext/print_cores.py \
--cores-dir=/cores \
--build-dir=${{ github.workspace }}/build/blazingmq
- name: Upload fuzz-logs as artifacts
if: failure()
uses: actions/upload-artifact@v5
with:
name: ${{ matrix.request }}_fuzz.log
path: ${{ github.workspace }}/${{ matrix.request }}_fuzz.log
retention-days: 5
sanitize_ubuntu:
name: Sanitize
uses: ./.github/workflows/sanitize.yaml
needs: integration_tests_ubuntu
if: ${{ !cancelled() }}
integration_tests_storagetool_ubuntu:
name: IT [Storage tool]
runs-on: ubuntu-latest
needs: build_ubuntu
steps:
- uses: actions/checkout@v6
- uses: actions/download-artifact@v5
with:
name: ${{needs.build_ubuntu.outputs.artifact_key }}
# Set execution permissions for all .tsk
# which were lost when the artifact was created
- name: Chmod all .tsk
run: find ./build -type f -name "*.tsk" -exec chmod +x {} +
- name: Run Storage Tool integration tests
run: |
pip install -r ${{ github.workspace }}/src/python/requirements-test.txt
cd ${{ github.workspace }}/src/applications/bmqstoragetool/integration-tests
./run-tests
build_macosx:
name: Build [macosx_${{ matrix.arch }}]
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: macos-14
arch: arm64
steps:
- uses: actions/checkout@v6
- name: Set up dependencies
run: |
brew install \
bison \
flex \
google-benchmark \
googletest \
python@3.10 \
zlib
- name: Build BlazingMQ
env:
CXXFLAGS: "-Werror -Wno-poison-system-directories"
run: |
echo "::add-matcher::.github/workflows/problem-matchers/cpp.json"
bin/build-darwin.sh
echo "::remove-matcher owner=cpp"
build_and_test_bmqprometheus_plugin:
name: "Build Prometheus plugin [ubuntu]"
runs-on: ubuntu-latest
needs: get_dependencies
steps:
- uses: actions/checkout@v6
- uses: actions/cache/restore@v4
with:
path: |
deps
/opt/bb
key: ${{ needs.get_dependencies.outputs.cache_key }}
- name: Set up plugins dependencies
run: |
sudo apt-get update
sudo apt-get install -qy build-essential \
gdb \
curl \
python3.10 \
cmake \
ninja-build \
pkg-config \
bison \
libfl-dev \
libbenchmark-dev \
libgmock-dev \
libgtest-dev \
libz-dev \
autoconf \
libtool
- name: Install cached non packaged dependencies
working-directory: deps
run: ../docker/build_deps.sh
- name: Create dependency fetcher working directory
run: mkdir -p deps
- name: Fetch & Build non packaged plugins dependencies
working-directory: deps
run: ${{ github.workspace }}/src/plugins/bmqprometheus/build_prometheus_deps.sh
- name: Build plugins
env:
PKG_CONFIG_PATH: /usr/lib/x86_64-linux-gnu/pkgconfig:/opt/bb/lib64/pkgconfig
run: |
cmake --preset gh-prometheus-ubuntu-latest-cpp23 -S .
echo "::add-matcher::.github/workflows/problem-matchers/cpp-prometheus.json"
cmake --build --preset gh-prometheus-ubuntu-latest-cpp23
echo "::remove-matcher owner=cpp-prometheus"
- name: Create prometheus dirs
run: mkdir -p prometheus_dir/pull prometheus_dir/push
- name: Download Prometheus
run: curl -SL "https://github.com/prometheus/prometheus/releases/download/v2.45.1/prometheus-2.45.1.linux-amd64.tar.gz" | tar -xzC prometheus_dir/
- name: Run Prometheus for "pull" mode
run: ./prometheus_dir/prometheus-2.45.1.linux-amd64/prometheus --config.file=${{ github.workspace }}/.github/workflows/ext/prometheus_localhost_pull.yaml --web.listen-address=0.0.0.0:9090 --storage.tsdb.path=${{ github.workspace }}/prometheus_dir/pull &
- name: Run Prometheus for "push" mode
run: ./prometheus_dir/prometheus-2.45.1.linux-amd64/prometheus --config.file=${{ github.workspace }}/.github/workflows/ext/prometheus_localhost_push.yaml --web.listen-address=0.0.0.0:9092 --storage.tsdb.path=${{ github.workspace }}/prometheus_dir/push &
- name: Run Pushgateway
run: |
# 30 Oct 2025, v1.11.2:
docker pull prom/pushgateway@sha256:c835998819105d84d484918908df132807c78c05f3e0e649df0c0479c6780d98
docker run -d -p 9091:9091 prom/pushgateway
- name: Prometheus plugin IT[pull]
run: ${{ github.workspace }}/src/plugins/bmqprometheus/tests/bmqprometheus_prometheusstatconsumer_test.py -p ${{ github.workspace }}/build/blazingmq -m pull --no-docker --prometheus-host localhost:9090
- name: Prometheus plugin IT[push]
run: ${{ github.workspace }}/src/plugins/bmqprometheus/tests/bmqprometheus_prometheusstatconsumer_test.py -p ${{ github.workspace }}/build/blazingmq -m push --no-docker --prometheus-host localhost:9092
documentation:
name: "Documentation"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up dependencies
run: |
sudo apt-get update
sudo apt-get install -qy doxygen
- name: Set up output directory
run: |
mkdir -p docs/docs/apidocs
- name: Build docs
run: |
echo "::add-matcher::.github/workflows/problem-matchers/doxygen.json"
doxygen Doxyfile
echo "::remove-matcher owner=doxygen"
shellcheck:
name: Shellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@00b27aa7cb85167568cb48a3838b75f4265f2bca # 20 Jun 2024
docker_build_ubuntu:
name: "Docker [ubuntu]"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Docker Single-Node Workflow
run: docker compose -f docker/single-node/docker-compose.yaml up --build -d
- name: Docker Cluster Workflow
run: docker compose -f docker/cluster/docker-compose.yaml up --build -d
- name: Inspect Docker images
run: docker image ls