forked from syslog-ng/syslog-ng
-
Notifications
You must be signed in to change notification settings - Fork 0
287 lines (237 loc) · 8.31 KB
/
devshell.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
name: CI @ devshell
on:
pull_request:
push:
schedule:
- cron: '00 21 * * *'
jobs:
general:
runs-on: ubuntu-latest
container:
image: ghcr.io/syslog-ng/dbld-devshell:latest
options: --privileged --ulimit core=-1
strategy:
matrix:
build-tool: [autotools, cmake]
cc: [gcc, clang]
fail-fast: false
steps:
- name: Checkout syslog-ng source
uses: actions/checkout@v3
- name: Setup Git safedir
run: git config --global --add safe.directory "${GITHUB_WORKSPACE}"
- name: Setup environment
run: |
. .github/workflows/gh-tools.sh
# Setup corefiles
ulimit -c unlimited
COREFILES_DIR=/tmp/corefiles
mkdir ${COREFILES_DIR}
echo "${COREFILES_DIR}/core.%h.%e.%t" > /proc/sys/kernel/core_pattern
# Setup build time environment variables
PYTHONUSERBASE="${HOME}/python_packages"
CC="${{ matrix.cc }}"
SYSLOG_NG_INSTALL_DIR=${HOME}/install/syslog-ng
CONFIGURE_FLAGS="
--prefix=${SYSLOG_NG_INSTALL_DIR}
--enable-debug
--enable-all-modules
--disable-java
--disable-java-modules
--enable-ebpf
--with-python=3
`[ $CC = clang ] && echo '--enable-force-gnu99' || true`
"
CMAKE_FLAGS="
-DCMAKE_BUILD_TYPE=Debug
-DCMAKE_C_FLAGS=-Werror
-DCMAKE_INSTALL_PREFIX=${HOME}/install/syslog-ng
-DPYTHON_VERSION=3
"
gh_export COREFILES_DIR PYTHONUSERBASE CC SYSLOG_NG_INSTALL_DIR CONFIGURE_FLAGS CMAKE_FLAGS
gh_path "${PYTHONUSERBASE}"
- name: autogen.sh
if: matrix.build-tool == 'autotools'
run: ./autogen.sh
- name: configure
if: matrix.build-tool == 'autotools'
run: |
mkdir build
cd build
../configure ${CONFIGURE_FLAGS}
- name: cmake
if: matrix.build-tool == 'cmake'
run: |
mkdir build
cd build
cmake ${CMAKE_FLAGS} ..
- name: make
working-directory: ./build
run: make V=1 -j $(nproc)
- name: make check
id: make_check
working-directory: ./build
run: make V=1 check || (mkdir -p ${COREFILES_DIR} && find . -executable -a -type f | tar -cf ${COREFILES_DIR}/test-binaries.tar --files-from=- && cat test-suite.log && false)
- name: make install
working-directory: ./build
run: make install
- name: Python virtualenv for syslog-ng runtime
run: ${SYSLOG_NG_INSTALL_DIR}/bin/syslog-ng-update-virtualenv -y
- name: Light
id: light
working-directory: ./build
run: |
make light-self-check
make light-check
- name: make func-test
working-directory: ./build
run: make VERBOSE=1 func-test
- name: "Artifact: test-suite.log"
uses: actions/upload-artifact@v3
if: always() && steps.make_check.outcome == 'failure'
with:
name: test-suite-${{ matrix.build-tool }}-${{ matrix.cc }}
path: ${{ github.workspace }}/build/test-suite.log
- name: "Prepare artifact: light-reports"
id: prepare-light-reports
if: always() && steps.light.outcome == 'failure'
run: |
REPORTS_DIR=tests/light/reports
cp -r ${REPORTS_DIR} /tmp/light-reports
find /tmp/light-reports -type p,s -print0 | xargs -0 rm -f
tar -cz -f /tmp/light-reports.tar.gz /tmp/light-reports
- name: "Artifact: light-reports"
uses: actions/upload-artifact@v3
if: always() && steps.prepare-light-reports.outcome == 'success'
with:
name: light-reports-${{ matrix.build-tool }}-${{ matrix.cc }}
path: /tmp/light-reports.tar.gz
- name: Dump corefile backtrace
working-directory: ${{ env.COREFILES_DIR }}
if: failure()
run: |
find -name "core.*syslog-ng*" -exec \
gdb --ex="thread apply all bt full" --ex="quit" ${SYSLOG_NG_INSTALL_DIR}/sbin/syslog-ng --core {} \;
- name: "Artifact: corefiles"
uses: actions/upload-artifact@v3
if: failure()
with:
name: corefiles-${{ matrix.build-tool }}-${{ matrix.cc }}
path: ${{ env.COREFILES_DIR }}
distcheck:
runs-on: ubuntu-latest
container:
image: ghcr.io/syslog-ng/dbld-devshell:latest
options: --security-opt seccomp=unconfined --ulimit core=-1
steps:
- name: Checkout syslog-ng source
uses: actions/checkout@v3
- name: Setup Git safedir
run: git config --global --add safe.directory "${GITHUB_WORKSPACE}"
- name: Set ENV variables
run: |
. .github/workflows/gh-tools.sh
DISTCHECK_CONFIGURE_FLAGS="
CFLAGS=-Werror
CXXFLAGS=-Werror
--prefix=${HOME}/install/syslog-ng
--with-ivykis=internal
--with-jsonc=system
--enable-tcp-wrapper
--enable-linux-caps
--enable-manpages
--enable-all-modules
--disable-java
--disable-java-modules
--with-python=3
"
gh_export DISTCHECK_CONFIGURE_FLAGS
- name: autogen.sh
run: ./autogen.sh
- name: configure
run: ./configure --disable-all-modules --enable-manpages
- name: distcheck
run: |
. tests/build-log-cflags-propagation.sh
exec_prop_check "make distcheck -j 3 V=1"
style-check:
runs-on: ubuntu-latest
container:
image: ghcr.io/syslog-ng/dbld-devshell:latest
steps:
- name: Checkout syslog-ng source
uses: actions/checkout@v3
- name: Setup Git safedir
run: git config --global --add safe.directory "${GITHUB_WORKSPACE}"
- name: Prepare
run: |
./autogen.sh
mkdir build && cd build
../configure
- name: Style check (C)
id: c-style-check
run: |
scripts/style-checker.sh format
git diff --exit-code > c-style-problems.diff || \
(cat c-style-problems.diff && git reset --hard HEAD && exit 1)
- name: Style check (pylib)
if: always()
working-directory: ./build
run: |
make pymodules-linters || (git reset --hard HEAD && exit 1)
- name: Style check (Light)
id: light-style-check
if: always()
working-directory: ./build
shell: bash
run: |
make light-linters || \
(git diff > ../light-style-problems.diff ; git reset --hard HEAD && exit 1)
- name: "Artifact: c-style-problems"
uses: actions/upload-artifact@v3
if: always() && steps.c-style-check.outcome == 'failure'
with:
name: c-style-problems
path: c-style-problems.diff
- name: "Artifact: light-style-problems"
uses: actions/upload-artifact@v3
if: always() && steps.light-style-check.outcome == 'failure'
with:
name: light-style-problems
path: light-style-problems.diff
copyright-check:
runs-on: ubuntu-latest
container:
image: ghcr.io/syslog-ng/dbld-devshell:latest
env:
COPYRIGHTVERBOSITY: 1
steps:
- name: Checkout syslog-ng source
uses: actions/checkout@v3
- name: Setup Git safedir
run: git config --global --add safe.directory "${GITHUB_WORKSPACE}"
- name: Copyright check
run: tests/copyright/check.sh . .
- name: "Artifact: copyright-run.log"
uses: actions/upload-artifact@v3
if: failure()
with:
name: copyright-run.log
path: copyright-run.log
commits-check:
runs-on: ubuntu-latest
container:
image: ghcr.io/syslog-ng/dbld-devshell:latest
steps:
- name: Checkout syslog-ng source
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Git safedir
run: git config --global --add safe.directory "${GITHUB_WORKSPACE}"
- name: Commits check (Pull request)
if: github.event_name == 'pull_request'
run: tests/commits/check.sh origin/${{ github.base_ref }}..HEAD
- name: Commits check (Push)
if: github.event_name == 'push'
run: tests/commits/check.sh