-
Notifications
You must be signed in to change notification settings - Fork 1.6k
238 lines (218 loc) · 8.16 KB
/
unit-tests.yaml
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
name: Run unit tests
on:
push:
branches:
- master
- 2.1
- 2.0
- 1.9
- 1.8
pull_request:
paths-ignore:
- '.github/**'
- 'dockerfiles/**'
- 'docker_compose/**'
- 'packaging/**'
- '.gitignore'
- 'appveyor.yml'
- '**.sh'
- 'examples/**'
branches:
- master
- 2.1
- 2.0
- 1.9
- 1.8
types: [opened, reopened, synchronize]
workflow_dispatch:
jobs:
run-ubuntu-unit-tests:
runs-on: ubuntu-20.04
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
flb_option:
- "-DFLB_JEMALLOC=On"
- "-DFLB_JEMALLOC=Off"
- "-DFLB_SMALL=On"
- "-DSANITIZE_ADDRESS=On"
- "-DSANITIZE_UNDEFINED=On"
- "-DFLB_COVERAGE=On"
- "-DFLB_SANITIZE_MEMORY=On"
- "-DFLB_SANITIZE_THREAD=On"
- "-DFLB_SIMD=On"
- "-DFLB_SIMD=Off"
compiler:
- gcc
- clang
exclude:
- flb_option: "-DFLB_COVERAGE=On"
compiler: clang
permissions:
contents: read
steps:
- name: Setup environment
run: |
sudo apt-get update
sudo apt-get install -y gcc-7 g++-7 clang-6.0 libsystemd-dev gcovr libyaml-dev libbpf-dev linux-tools-common
sudo ln -s /usr/bin/llvm-symbolizer-6.0 /usr/bin/llvm-symbolizer || true
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: calyptia/fluent-bit-ci
path: ci
- name: ${{ matrix.compiler }} - ${{ matrix.flb_option }}
run: |
echo "CC = $CC, CXX = $CXX, FLB_OPT = $FLB_OPT"
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 90
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 90
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-6.0 90
sudo usermod -a -G systemd-journal $(id -un)
sudo -E su -p $(id -un) -c "PATH=$PATH ci/scripts/run-unit-tests.sh"
env:
CC: ${{ matrix.compiler }}
CXX: ${{ matrix.compiler }}
FLB_OPT: ${{ matrix.flb_option }}
run-macos-unit-tests:
# We chain this after Linux one as there are costs and restrictions associated
needs:
- run-ubuntu-unit-tests
runs-on: macos-latest
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
flb_option:
- "-DFLB_JEMALLOC=Off"
- "-DFLB_SANITIZE_MEMORY=On"
- "-DFLB_SANITIZE_THREAD=On"
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: calyptia/fluent-bit-ci
path: ci
- name: ${{ matrix.flb_option }}
run: |
echo "CC = $CC, CXX = $CXX, FLB_OPT = $FLB_OPT"
brew update
brew install bison flex openssl || true
ci/scripts/run-unit-tests.sh
env:
CC: gcc
CXX: g++
FLB_OPT: ${{ matrix.flb_option }}
run-aarch64-unit-tests:
# Ensure for OSS Fluent Bit repo we enable usage of Actuated runners for ARM builds, for forks it should keep existing ubuntu-latest usage.
runs-on: ${{(github.repository == 'fluent/fluent-bit') && 'actuated-arm64-8cpu-16gb' || 'ubuntu-latest' }}
permissions:
contents: read
# We chain this after Linux one as there are costs for actuated workers
needs:
- run-ubuntu-unit-tests
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
config:
- name: "Aarch64 actuated testing"
flb_option: "-DFLB_WITHOUT_flb-it-network=1 -DFLB_WITHOUT_flb-it-fstore=1"
omit_option: "-DFLB_WITHOUT_flb-it-utils=1 -DFLB_WITHOUT_flb-it-pack=1"
global_option: "-DFLB_BACKTRACE=Off -DFLB_SHARED_LIB=Off -DFLB_DEBUG=On -DFLB_ALL=On -DFLB_EXAMPLES=Off"
unit_test_option: "-DFLB_TESTS_INTERNAL=On"
compiler: gcc
steps:
- name: Checkout Fluent Bit code
uses: actions/checkout@v4
- name: Set up Actuated mirror
if: github.repository == 'fluent/fluent-bit'
uses: self-actuated/hub-mirror@master
- name: Setup environment
run: |
sudo apt-get update
sudo apt-get install -y gcc-9 g++-9 clang-12 cmake flex bison libsystemd-dev gcovr libyaml-dev libbpf-dev linux-tools-common
sudo ln -s /usr/bin/llvm-symbolizer-12 /usr/bin/llvm-symbolizer || true
- name: Build and test with actuated runners
run: |
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 90
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 90
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-12 90
export nparallel=$(( $(getconf _NPROCESSORS_ONLN) > 8 ? 8 : $(getconf _NPROCESSORS_ONLN) ))
export FLB_OPTION="${{ matrix.config.flb_option }}"
export FLB_OMIT_OPTION="${{ matrix.config.omit_option }}"
export GLOBAL_OPTION="${{ matrix.config.global_option }}"
export FLB_UNIT_TEST_OPTION="${{ matrix.config.unit_test_option }}"
export FLB_OPT="${FLB_OPTION} ${GLOBAL_OPTION} ${FLB_UNIT_TEST_OPTION} ${FLB_OMIT_OPTION}"
echo "CC = ${{ matrix.config.compiler }}, CXX = ${{ matrix.config.compiler }}, FLB_OPT = $FLB_OPT"
cmake ${FLB_OPT} ../
make -j $nparallel
ctest -j $nparallel --build-run-dir . --output-on-failure
working-directory: build
env:
CC: ${{ matrix.config.compiler }}
CXX: ${{ matrix.config.compiler }}
run-qemu-ubuntu-unit-tests:
# We chain this after Linux one as there are CPU time costs for QEMU emulation
needs:
- run-ubuntu-unit-tests
runs-on: ubuntu-20.04
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
arch:
- s390x
steps:
- name: Checkout Fluent Bit code
uses: actions/checkout@v4
- name: Prepare and build with QEMU ${{ matrix.arch }}
uses: uraimo/run-on-arch-action@v2
id: build-and-test-on-qemu
with:
arch: ${{ matrix.arch }}
distro: ubuntu20.04
shell: /bin/bash
dockerRunArgs: |
--volume "/var/lib/dbus/machine-id:/var/lib/dbus/machine-id"
--volume "/etc/machine-id:/etc/machine-id"
install: |
apt-get update
apt-get install -y gcc-7 g++-7 clang-6.0 libyaml-dev cmake flex bison libssl-dev libbpf-dev linux-tools-common#libsystemd-dev
ln -s /usr/bin/llvm-symbolizer-6.0 /usr/bin/llvm-symbolizer || true
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 90
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 90
update-alternatives --install /usr/bin/clang clang /usr/bin/clang-6.0 90
run: |
cd build
export nparallel=$(( $(getconf _NPROCESSORS_ONLN) > 8 ? 8 : $(getconf _NPROCESSORS_ONLN) ))
export FLB_OPTION="-DFLB_WITHOUT_flb-it-network=1 -DFLB_WITHOUT_flb-it-fstore=1"
export FLB_OMIT_OPTION=""
export GLOBAL_OPTION="-DFLB_BACKTRACE=Off -DFLB_SHARED_LIB=Off -DFLB_DEBUG=On -DFLB_ALL=On -DFLB_EXAMPLES=Off"
export FLB_UNIT_TEST_OPTION="-DFLB_TESTS_INTERNAL=On"
export FLB_OPT="${FLB_OPTION} ${GLOBAL_OPTION} ${FLB_UNIT_TEST_OPTION} ${FLB_OMIT_OPTION}"
export CC=gcc
export CXX=gcc
echo "CC = $CC, CXX = $CXX, FLB_OPT = $FLB_OPT"
cmake ${FLB_OPT} ../
make -j $nparallel
ctest -j $nparallel --build-run-dir . --output-on-failure
# Required check looks at this so do not remove
run-all-unit-tests:
if: always()
runs-on: ubuntu-latest
name: Unit tests (matrix)
permissions:
contents: none
needs:
- run-macos-unit-tests
- run-ubuntu-unit-tests
- run-aarch64-unit-tests
- run-qemu-ubuntu-unit-tests
steps:
- name: Check build matrix status
# Ignore MacOS failures
if: ${{ needs.run-ubuntu-unit-tests.result != 'success' }}
run: exit 1