forked from syslog-ng/syslog-ng
-
Notifications
You must be signed in to change notification settings - Fork 0
252 lines (227 loc) · 9.55 KB
/
Copy pathdevshell-build.yml
File metadata and controls
252 lines (227 loc) · 9.55 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
# .github/workflows/devshell-build.yml
#
# Reusable workflow called by devshell.yml for each matrix entry.
# The `run-condition` boolean input controls whether the build job actually runs:
# when false, GitHub skips the job entirely — no runner is allocated.
# This avoids machine startup costs for matrix entries that are irrelevant
# (e.g. non-devshell images on PR builds).
name: Devshell Build
on:
workflow_call:
inputs:
build-tool:
required: true
type: string
cc:
required: true
type: string
platform:
required: true
type: string
image-name:
required: true
type: string
image-arch-suffix:
required: false
type: string
default: ""
image-cflags:
required: false
type: string
default: ""
image-configure-flags:
required: false
type: string
default: ""
image-cmake-configure-flags:
required: false
type: string
default: ""
run-condition:
required: true
type: boolean
use_all:
required: false
type: boolean
default: false
permissions:
contents: read # actions/checkout, git fetch
actions: write # actions/upload-artifact
packages: read # pull ghcr.io/syslog-ng/dbld-* container images
jobs:
build:
if: ${{ inputs.run-condition || inputs.use_all}}
name: ${{ inputs.image-name }}-${{ inputs.build-tool }}-${{ inputs.cc }}${{ inputs.image-arch-suffix || '-X86-64' }}
runs-on: ${{ inputs.platform }}
container:
image: ghcr.io/syslog-ng/dbld-${{ inputs.image-name }}${{ inputs.image-arch-suffix }}:latest
options: --privileged --ulimit core=-1
steps:
- name: Setup Git safedir
run: git config --global --add safe.directory "${GITHUB_WORKSPACE}"
- name: Checkout syslog-ng source
if: ${{ inputs.image-arch-suffix != '-i386' }}
uses: actions/checkout@v4
- name: Checkout syslog-ng source (i386 - manual git)
# actions/checkout@v4 runs a 64-bit Node.js binary which fails inside a 32-bit (i386) container.
# Use plain shell git commands instead, which work fine in 32-bit userspace.
if: ${{ inputs.image-arch-suffix == '-i386' }}
run: |
git init
git remote add origin https://github.com/${{ github.repository }}
if [ "${{ github.event_name }}" = "pull_request" ]; then
git fetch --depth=1 origin +${{ github.sha }}:refs/remotes/pull/${{ github.event.pull_request.number }}/merge
git checkout refs/remotes/pull/${{ github.event.pull_request.number }}/merge
else
git fetch --depth=1 origin ${{ github.ref }}
git checkout FETCH_HEAD
fi
- name: Setup environment
run: |
. .github/workflows/gh-tools.sh
# Setup corefiles
ulimit -c unlimited
COREFILES_DIR=/tmp/corefiles
mkdir -p ${COREFILES_DIR}
echo "${COREFILES_DIR}/core.%h.%e.%t" > /proc/sys/kernel/core_pattern
# Setup build time environment variables
PYTHONUSERBASE="${HOME}/python_packages"
CC="${{ inputs.cc }}"
CXX=$( [ $CC = gcc ] && echo g++ || echo clang++ )
CFLAGS="${{ inputs.image-cflags }} -Wno-unused-command-line-argument -DNO_PTHREAD_SELF_USAGE_WARNING=1"
CXXFLAGS="${CFLAGS}"
SYSLOG_NG_INSTALL_DIR=${HOME}/install/syslog-ng
CONFIGURE_FLAGS="
--enable-colored-log
`[ $CC = clang ] && echo '--enable-force-gnu99' || true`
--enable-extra-warnings
--enable-debug
--prefix=${SYSLOG_NG_INSTALL_DIR}
--enable-tests
--enable-jemalloc=auto
--enable-all-modules
--enable-slog
--with-python=3
--with-ivykis=internal
--disable-java
--disable-java-modules
--enable-stackdump
${{ inputs.image-configure-flags }}
"
CMAKE_CONFIGURE_FLAGS="
`[ $CC = clang ] && echo '-DENABLE_FORCE_GNU99=ON' || true`
-DENABLE_EXTRA_WARNINGS=ON
-DCMAKE_BUILD_TYPE=Debug
-DCMAKE_INSTALL_PREFIX=${SYSLOG_NG_INSTALL_DIR}
-DSUMMARY_LEVEL=1
-DENABLE_TESTING=ON
-DENABLE_JEMALLOC=AUTO
-DPYTHON_VERSION=3
-DIVYKIS_SOURCE=internal
-DENABLE_SLOG=ON
-DENABLE_JAVA=OFF
-DENABLE_JAVA_MODULES=OFF
-DENABLE_STACKDUMP=ON
-DENABLE_EBPF=ON
${{ inputs.image-cmake-configure-flags }}
"
gh_export COREFILES_DIR PYTHONUSERBASE CC CXX SYSLOG_NG_INSTALL_DIR CFLAGS CXXFLAGS CONFIGURE_FLAGS CMAKE_CONFIGURE_FLAGS
gh_path "${PYTHONUSERBASE}"
- name: autogen.sh
if: ${{ inputs.build-tool == 'autotools' }}
run: |
env | sort
./autogen.sh
- name: autotools configure
if: ${{ inputs.build-tool == 'autotools' }}
run: |
env | sort
mkdir build
cd build
../configure ${CONFIGURE_FLAGS}
- name: cmake configure
if: ${{ inputs.build-tool == 'cmake' }}
run: |
env | sort
mkdir build
cd build
cmake ${CMAKE_CONFIGURE_FLAGS} ..
- name: make
working-directory: ./build
run: |
make V=1 -j $(nproc)
- name: make install
working-directory: ./build
run: |
make install -j $(nproc)
- name: check installed binary
working-directory: ./build
run: |
echo "Checking produced installation..."
"${SYSLOG_NG_INSTALL_DIR}/sbin/syslog-ng" -FdevtV > syslog-ng.unsorted.log 2>&1
sort syslog-ng.unsorted.log > syslog-ng.log
cat syslog-ng.log
# Check for failing modules
if grep -q "Error opening plugin module;" syslog-ng.log; then
echo "Modules failing to load:"
grep "Error opening plugin module;" syslog-ng.log
exit 1
fi
- name: jemalloc stats
if: ${{ inputs.image-name == 'devshell' && inputs.image-arch-suffix != '-i386' }}
run: MALLOC_CONF=stats_print:true "${SYSLOG_NG_INSTALL_DIR}/sbin/syslog-ng" -V 2>&1 | grep -A50 "jemalloc"
- name: make check
# Skip testing for now in none-devshell images
if: ${{ inputs.image-name == 'devshell' || inputs.use_all }}
id: make_check
working-directory: ./build
run: make V=1 check -j $(nproc) || (mkdir -p ${COREFILES_DIR} && find . -executable -a -type f | tar -cf ${COREFILES_DIR}/test-binaries.tar --files-from=- && cat test-suite.log && false)
- name: Python virtualenv for syslog-ng runtime
# Skip Python virtualenv setup for now in none-devshell images or if no python support in the image yet
if: ${{ inputs.image-name == 'devshell' || inputs.use_all }}
run: ${SYSLOG_NG_INSTALL_DIR}/bin/syslog-ng-update-virtualenv -y
- name: Light
# Skip Light testing for now in none-devshell images or if no python support in the image yet
if: ${{ inputs.image-name == 'devshell' || inputs.use_all }}
id: light
working-directory: ./build
run: |
make light-self-check
make light-check
- name: "Artifact: test-suite.log"
uses: actions/upload-artifact@v4
# Handle failures only for devshell images now (exclude i386 reporting for now, actions/upload-artifact@v4 has no i386 support)
if: ${{ inputs.image-arch-suffix != '-i386' && inputs.image-name == 'devshell' && always() && steps.make_check.outcome == 'failure' }}
with:
name: test-suite-${{ inputs.build-tool }}-${{ inputs.cc }}
path: ${{ github.workspace }}/build/test-suite.log
- name: "Prepare artifact: light-reports"
id: prepare-light-reports
# Handle failures only for devshell images now
if: ${{ inputs.image-name == 'devshell' && 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@v4
# Handle failures only for devshell images now (exclude i386 reporting for now, actions/upload-artifact@v4 has no i386 support)
if: ${{ inputs.image-arch-suffix != '-i386' && inputs.image-name == 'devshell' && always() && steps.prepare-light-reports.outcome == 'success' }}
with:
name: light-reports-${{ inputs.build-tool }}-${{ inputs.cc }}
path: /tmp/light-reports.tar.gz
- name: Dump corefile backtrace
working-directory: ${{ env.COREFILES_DIR }}
# Handle failures only for devshell images now
if: ${{ inputs.image-name == 'devshell' && 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@v4
# Handle failures only for devshell images now (exclude i386 for now, actions/upload-artifact@v4 has no i386 support)
if: ${{ inputs.image-arch-suffix != '-i386' && inputs.image-name == 'devshell' && failure() }}
with:
name: corefiles-${{ inputs.build-tool }}-${{ inputs.cc }}
path: ${{ env.COREFILES_DIR }}