Debian Codegraph @

.github/workflows/ci.yml

raw symbols SCIP
1 name: CI
2
3 on:
4 push:
5 branches:
6 - master
7 - 1.3.9
8 paths-ignore:
9 - NEWS
10 - RELEASE_NOTES
11 - 'doc/**'
12 - '**/*.html'
13 - '**/*.md'
14 pull_request:
15 branches:
16 - master
17 - 1.3.9
18 paths-ignore:
19 - NEWS
20 - RELEASE_NOTES
21 - 'doc/**'
22 - '**/*.html'
23 - '**/*.md'
24
25 jobs:
26 build:
27 runs-on: ubuntu-latest
28
29 services:
30 redis:
31 # Docker Hub image
32 image: redis:6-alpine
33 # Set health checks to wait until redis has started
34 options: >-
35 --health-cmd "redis-cli ping"
36 --health-interval 10s
37 --health-timeout 5s
38 --health-retries 5
39
40 environment: CI
41
42 env:
43 # GitHub runners still causing problems with NodeJS v20; see:
44 # https://github.com/actions/checkout/issues/1809.
45 ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
46
47 PACKAGE_VERSION: 1.3.9d
48 REDIS_HOST: redis
49
50 strategy:
51 matrix:
52 compiler:
53 - clang
54 - gcc
55 container:
56 - almalinux:8
57 - alpine:3.15
58 - alpine:3.18
59 - ubuntu:22.04
60
61 container: ${{ matrix.container }}
62
63 steps:
64 - name: Prepare for checkout
65 if: ${{ matrix.container == 'ubuntu:22.04' }}
66 run: |
67 apt-get update -qq
68 apt-get install -y git
69
70 - name: Checkout source code
71 uses: actions/checkout@v3
72 with:
73 fetch-depth: 5
74
75 # NOTE: 2024-12-03: Disabled this section as it is incredibly annoying
76 # to get right via Bourne shell, and it is currently blocking my attempt
77 # to get a release out. I'll have to revisit this at a later date, when
78 # my patience has been restored.
79 #- name: Whitespace check
80 # if: ${{ matrix.container == 'ubuntu:22.04' }}
81 # run: |
82 # if ! git diff --no-color --check HEAD^ > /dev/null; then
83 # echo "You must remove whitespace before submitting a pull request"
84 # echo ""
85 # git diff --check HEAD^
86 # exit 1
87 # fi
88
89 - name: Install Alpine 3.15 packages
90 if: ${{ matrix.container == 'alpine:3.15' }}
91 run: |
92 apk update
93 # for builds
94 apk add bash build-base clang compiler-rt-static gcc make
95 # for unit tests
96 apk add check check-dev subunit subunit-dev
97
98 # for mod_lang
99 apk add gettext-dev
100 # for xattr support
101 apk add attr-dev libattr
102 # for mod_cap
103 apk add libcap-dev
104 # for mod_geoip
105 apk add geoip-dev
106 # for mod_ldap
107 apk add cyrus-sasl-dev libldap openldap-dev
108 # for mod_rewrite
109 apk add libidn2-dev
110 # for memcache support
111 apk add libmemcached-dev
112 # for redis support
113 apk add hiredis-dev hiredis-ssl
114 # for mod_sql_mysql
115 apk add mariadb-connector-c-dev
116 # for PAM support
117 apk add linux-pam-dev
118 # for mod_sql_postgres
119 apk add libpq postgresql-dev
120 # for mod_sql_odbc
121 apk add unixodbc-dev
122 # for OpenSSL support
123 apk add openssl openssl-dev
124 # for Sodium support
125 apk add libsodium-dev
126 # for mod_sql_sqlite
127 apk add sqlite sqlite-dev
128 # NOTE: Alpine does not support mod_wrap, due to lack of tcpwrappers
129 # for PCRE2 support
130 apk add pcre2-dev
131 # for ftptop
132 apk add ncurses-dev
133 # for zlib support
134 apk add zlib-dev
135
136 # for debugging
137 clang --version
138 gcc --version
139 openssl version -a
140
141 # The modules to build are distro-specific
142 echo "PROFTPD_MODULES=mod_sql:mod_sql_mysql:mod_sql_odbc:mod_sql_postgres:mod_sql_sqlite:mod_sql_passwd:mod_sftp:mod_sftp_sql:mod_sftp_pam:mod_tls:mod_tls_fscache:mod_tls_shmcache:mod_tls_memcache:mod_tls_redis:mod_ban:mod_copy:mod_ctrls_admin:mod_deflate:mod_dnsbl:mod_dynmasq:mod_exec:mod_facl:mod_geoip:mod_ifversion:mod_ldap:mod_load:mod_log_forensic:mod_qos:mod_quotatab:mod_quotatab_file:mod_quotatab_ldap:mod_quotatab_radius:mod_quotatab_sql:mod_radius:mod_readme:mod_rewrite:mod_shaper:mod_site_misc:mod_snmp:mod_wrap2:mod_wrap2_file:mod_wrap2_redis:mod_wrap2_sql:mod_digest:mod_auth_otp:mod_statcache:mod_unique_id:mod_ifsession" >> $GITHUB_ENV
143
144 # Sadly, there are enough package requirement differences between Alpine
145 # 3.15 and 3.18, that is more expedient to supply different package
146 # installation instructions.
147 - name: Install Alpine 3.18 packages
148 if: ${{ matrix.container == 'alpine:3.18' }}
149 run: |
150 apk update
151 # for builds
152 apk add bash build-base clang compiler-rt gcc make
153 # for unit tests
154 apk add check check-dev subunit subunit-dev
155
156 # for mod_lang
157 apk add gettext-dev
158 # for xattr support
159 apk add attr-dev libattr
160 # for mod_cap
161 apk add libcap-dev
162 # for mod_geoip
163 apk add geoip-dev
164 # for mod_ldap
165 apk add cyrus-sasl-dev libldap openldap-dev
166 # for mod_rewrite
167 apk add libidn2-dev
168 # for memcache support
169 apk add libmemcached-dev
170 # for redis support
171 apk add hiredis-dev hiredis-ssl
172 # for mod_sql_mysql
173 apk add mariadb-connector-c-dev
174 # for PAM support
175 apk add linux-pam-dev
176 # for mod_sql_postgres
177 apk add libpq postgresql-dev
178 # for mod_sql_odbc
179 apk add unixodbc-dev
180 # for OpenSSL support
181 apk add openssl openssl-dev
182 # for Sodium support
183 apk add libsodium-dev
184 # for mod_sql_sqlite
185 apk add sqlite sqlite-dev
186 # NOTE: Alpine does not support mod_wrap, due to lack of tcpwrappers
187 # for PCRE2 support
188 apk add pcre2-dev
189 # for ftptop
190 apk add ncurses-dev
191 # for zlib support
192 apk add zlib-dev
193
194 # for debugging
195 clang --version
196 gcc --version
197 openssl version -a
198
199 # The modules to build are distro-specific
200 echo "PROFTPD_MODULES=mod_sql:mod_sql_mysql:mod_sql_odbc:mod_sql_postgres:mod_sql_sqlite:mod_sql_passwd:mod_sftp:mod_sftp_sql:mod_sftp_pam:mod_tls:mod_tls_fscache:mod_tls_shmcache:mod_tls_memcache:mod_tls_redis:mod_ban:mod_copy:mod_ctrls_admin:mod_deflate:mod_dnsbl:mod_dynmasq:mod_exec:mod_facl:mod_geoip:mod_ifversion:mod_ldap:mod_load:mod_log_forensic:mod_qos:mod_quotatab:mod_quotatab_file:mod_quotatab_ldap:mod_quotatab_radius:mod_quotatab_sql:mod_radius:mod_readme:mod_rewrite:mod_shaper:mod_site_misc:mod_snmp:mod_wrap2:mod_wrap2_file:mod_wrap2_redis:mod_wrap2_sql:mod_digest:mod_auth_otp:mod_statcache:mod_unique_id:mod_ifsession" >> $GITHUB_ENV
201
202 - name: Install RPM packages
203 if: ${{ matrix.container == 'almalinux:8' }}
204 run: |
205 # Need to add other repos for e.g. libsodium
206 yum install -y dnf-plugins-core epel-release yum-utils gcc make
207 dnf config-manager --enable epel
208 dnf config-manager --set-enabled powertools
209 # for unit tests
210 yum install -y check-devel https://cbs.centos.org/kojifiles/packages/subunit/1.4.0/1.el8/x86_64/subunit-1.4.0-1.el8.x86_64.rpm https://cbs.centos.org/kojifiles/packages/subunit/1.4.0/1.el8/x86_64/subunit-devel-1.4.0-1.el8.x86_64.rpm
211 # for mod_lang
212 yum install -y gettext-devel glibc-all-langpacks glibc-gconv-extra
213 # for xattr support
214 yum install -y libattr-devel
215 # for mod_cap
216 yum install -y libacl-devel libcap-devel
217 # for mod_geoip
218 yum install -y GeoIP-devel
219 # for mod_ldap
220 yum install -y openldap-devel cyrus-sasl-devel
221 # for mod_rewrite
222 yum install -y libidn2-devel
223 # for memcache support
224 yum install -y libmemcached-devel
225 # for redis support
226 yum install -y hiredis-devel
227 # for mod_sql_mysql
228 yum install -y mysql-devel
229 # for PAM support
230 yum install -y pam-devel
231 # for mod_sql_postgres
232 yum install -y postgresql-devel
233 # for mod_sql_odbc
234 yum install -y unixODBC-devel
235 # for OpenSSL support
236 yum install -y openssl openssl-devel
237 # for Sodium support
238 yum install -y libsodium-devel
239 # for mod_sql_sqlite
240 yum install -y sqlite-devel
241 # for PCRE2 support
242 yum install -y pcre2-devel
243 # for ftptop
244 yum install -y ncurses-devel
245 # for zlib support
246 yum install -y zlib-devel
247 # for static code analysis
248 # - sudo yum install -y cppcheck
249 # - sudo yum install rats
250 # for integration/regression test
251 # for test code coverage
252 # for HTML validation
253 # for clang
254 yum install -y clang
255
256 # The modules to build are distro-specific
257 echo "PROFTPD_MODULES=mod_sql:mod_sql_mysql:mod_sql_odbc:mod_sql_postgres:mod_sql_sqlite:mod_sql_passwd:mod_sftp:mod_sftp_sql:mod_sftp_pam:mod_tls:mod_tls_fscache:mod_tls_shmcache:mod_tls_memcache:mod_tls_redis:mod_ban:mod_copy:mod_ctrls_admin:mod_deflate:mod_dnsbl:mod_dynmasq:mod_exec:mod_facl:mod_geoip:mod_ifversion:mod_ldap:mod_load:mod_log_forensic:mod_qos:mod_quotatab:mod_quotatab_file:mod_quotatab_ldap:mod_quotatab_radius:mod_quotatab_sql:mod_radius:mod_readme:mod_rewrite:mod_shaper:mod_site_misc:mod_snmp:mod_wrap2:mod_wrap2_file:mod_wrap2_redis:mod_wrap2_sql:mod_digest:mod_auth_otp:mod_statcache:mod_unique_id:mod_ifsession" >> $GITHUB_ENV
258
259 # for debugging
260 clang --version
261 gcc --version
262 openssl version -a
263
264 - name: Install Ubuntu 22.04 packages
265 if: ${{ matrix.container == 'ubuntu:22.04' }}
266 env:
267 DEBIAN_FRONTEND: noninteractive
268 TZ: UTC
269 run: |
270 # Need to add other repos for e.g. libsodium
271 apt-get update -qq
272 # for builds
273 apt-get install -y clang gcc git make
274 # for unit tests
275 apt-get install -y check libsubunit-dev
276 # for mod_lang
277 apt-get install -y gettext locales-all
278 # for xattr support
279 apt-get install -y libattr1-dev
280 # for mod_cap
281 apt-get install -y libcap-dev
282 # for mod_facl
283 apt-get install -y libacl1-dev
284 # for mod_geoip
285 apt-get install -y libgeoip-dev
286 # for mod_ldap
287 apt-get install -y libldap2-dev libsasl2-dev
288 # for mod_ldap runtime support for SCRAM
289 apt-get install -y libsasl2-modules-gssapi-mit
290 # for mod_rewrite
291 apt-get install -y libidn2-dev
292 # for memcache support
293 apt-get install -y libmemcached-dev
294 # for redis support
295 apt-get install -y libhiredis-dev
296 # for mod_sql_mysql
297 apt-get install -y libmysqlclient-dev
298 # for PAM support
299 apt-get install -y libpam-dev
300 # for mod_sql_postgres
301 apt-get install -y libpq-dev
302 # for mod_sql_odbc
303 apt-get install -y unixodbc-dev
304 # for OpenSSL support
305 apt-get install -y libssl-dev
306 # for Sodium support
307 apt-get install -y --force-yes libsodium-dev
308 # for mod_sql_sqlite
309 apt-get install -y libsqlite3-dev sqlite3
310 # for mod_wrap
311 apt-get install -y libwrap0-dev
312 # for PCRE2 support
313 apt-get install -y libpcre2-dev libpcre2-posix3
314 # for ftptop
315 apt-get install -y ncurses-dev
316 # for zlib support
317 apt-get install -y zlib1g-dev
318
319 # for static code analysis
320 # - sudo apt-get install -y cppcheck
321 # - sudo apt-get install rats
322 # for integration/regression test
323 # for test code coverage
324 apt-get install -y lcov ruby
325 gem install coveralls-lcov
326
327 # for logging
328 apt-get install -y rsyslog
329
330 # for HTML validation
331 apt-get install -y tidy
332
333 # The modules to build are distro-specific
334 echo "PROFTPD_MODULES=mod_sql:mod_sql_mysql:mod_sql_odbc:mod_sql_postgres:mod_sql_sqlite:mod_sql_passwd:mod_sftp:mod_sftp_sql:mod_sftp_pam:mod_tls:mod_tls_fscache:mod_tls_shmcache:mod_tls_memcache:mod_tls_redis:mod_ban:mod_copy:mod_ctrls_admin:mod_deflate:mod_dnsbl:mod_dynmasq:mod_exec:mod_facl:mod_geoip:mod_ifversion:mod_ldap:mod_load:mod_log_forensic:mod_qos:mod_quotatab:mod_quotatab_file:mod_quotatab_ldap:mod_quotatab_radius:mod_quotatab_sql:mod_radius:mod_readme:mod_rewrite:mod_shaper:mod_site_misc:mod_snmp:mod_wrap:mod_wrap2:mod_wrap2_file:mod_wrap2_redis:mod_wrap2_sql:mod_digest:mod_auth_otp:mod_statcache:mod_unique_id:mod_ifsession" >> $GITHUB_ENV
335
336 # for debugging
337 clang --version
338 gcc --version
339 openssl version -a
340 lcov --version
341
342 - name: Prepare code coverage
343 if: ${{ matrix.container == 'ubuntu:22.04' }}
344 run: |
345 lcov --directory . --zerocounters
346
347 - name: Build with static modules
348 env:
349 CC: ${{ matrix.compiler }}
350 run: |
351 ./configure LIBS="-lodbc -lm -lsubunit -lrt -pthread" --enable-devel=coverage:fortify --enable-ctrls --enable-facl --enable-memcache --enable-nls --enable-pcre2 --enable-redis --enable-tests --with-modules="${{ env.PROFTPD_MODULES }}"
352 make
353
354 - name: Run unit tests
355 env:
356 CC: ${{ matrix.compiler }}
357 # Note: Skip the unit tests on Alpine, or when using clang.
358 #
359 # On recent (as of 2022-11-13) AlmaLinux with clang and the
360 # `--enable-devel=fortify` configure settings, some of the unit tests
361 # inexplicably fail. So skip clang unit tests, for now.
362 if: ${{ matrix.compiler == 'gcc' && matrix.container != 'alpine:3.15' && matrix.container != 'alpine:3.18' }}
363 run: |
364 make TEST_VERBOSE=1 check-api
365
366 - name: Upload code coverage
367 env:
368 COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
369 if: ${{ matrix.compiler == 'gcc' && matrix.container == 'ubuntu:22.04' }}
370 run: |
371 lcov --ignore-errors gcov,source --directory . --capture --output-file all.info
372 # filter out system and test code
373 lcov --output-file coverage.info --remove all.info '*/lib/glibc-glob.c' '*/lib/ccan-json.c' '*/lib/hanson-tpl.*' '*/lib/openbsd-*' '*/lib/pr_fnmatch*'
374 # debug before upload
375 lcov --list coverage.info
376 # upload coverage info to coveralls
377 coveralls-lcov --repo-token="$COVERALLS_REPO_TOKEN" --service-name=github --service-job-id="$GITHUB_RUN_ID" --branch="$GITHUB_REF" coverage.info
378
379 - name: Install with static modules
380 env:
381 CC: ${{ matrix.compiler }}
382 run: |
383 make clean
384 ./configure LIBS="-lodbc" --enable-ctrls --enable-facl --enable-memcache --enable-nls --enable-pcre2 --enable-redis --with-modules="${{ env.PROFTPD_MODULES }}"
385 make
386 make install
387
388 - name: Run restart tests
389 env:
390 CC: ${{ matrix.compiler }}
391 PROFTPD_TEST_BIN: /usr/local/sbin/proftpd
392 PROFTPD_TEST_PIDFILE: /usr/local/var/proftpd.pid
393 # Note that the default config assumes user 'nobody', group 'nogroup',
394 # which do not exist in the default images of all distributions.
395 if: ${{ matrix.container == 'ubuntu:22.04' }}
396 run: |
397 test -e $PROFTPD_TEST_BIN
398 $PROFTPD_TEST_BIN
399 kill -0 $(cat $PROFTPD_TEST_PIDFILE)
400 kill -HUP $(cat $PROFTPD_TEST_PIDFILE)
401
402 kill -0 $(cat $PROFTPD_TEST_PIDFILE)
403 kill -HUP $(cat $PROFTPD_TEST_PIDFILE)
404
405 kill -0 $(cat $PROFTPD_TEST_PIDFILE)
406 kill -HUP $(cat $PROFTPD_TEST_PIDFILE)
407
408 kill -0 $(cat $PROFTPD_TEST_PIDFILE)
409 kill -TERM $(cat $PROFTPD_TEST_PIDFILE)
410
411 # Given the daemon a chance to clean up
412 sleep 1
413 ! test -f $PROFTPD_TEST_PIDFILE
414
415 - name: Build with shared modules
416 env:
417 CC: ${{ matrix.compiler }}
418 run: |
419 make clean
420 ./configure LIBS="-lodbc -lm -lsubunit -lrt -pthread" --enable-devel=fortify --enable-ctrls --enable-dso --enable-facl --enable-memcache --enable-nls --enable-pcre2 --enable-tests --with-shared="${{ env.PROFTPD_MODULES }}"
421 make
422
423 - name: Install with shared modules
424 run: |
425 make install
426
427 # https://github.com/google/sanitizers/wiki/AddressSanitizer
428 # https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer
429 # https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html
430 #
431 # NOTE: Using MemorySanitizer is desirable, but currently unusable since
432 # libcheck is not instrumented, resulting in unsuppressible false
433 # positives.
434 - name: Run unit tests under asan+lsan+ubsan
435 env:
436 ASAN_OPTIONS: abort_on_error=1,check_initialization_order=true,debug=true,detect_invalid_pointer_pairs=2,detect_leaks=1,detect_stack_use_after_return=true,strict_string_checks=true,verbosity=0
437 CC: ${{ matrix.compiler }}
438 CFLAGS: -fsanitize=address,undefined -DPR_DEVEL_NO_POOL_FREELIST
439 LDFLAGS: -fsanitize=address,undefined
440 if: ${{ matrix.compiler == 'clang' && matrix.container == 'ubuntu:22.04' }}
441 run: |
442 make clean
443 ./configure LIBS="-lm -lsubunit -lrt -pthread" --enable-devel --enable-ctrls --enable-facl --enable-memcache --enable-nls --enable-pcre2 --enable-redis --enable-tests
444 make
445 export ASAN_SYMBOLIZER_PATH=$(readlink -f $(which llvm-symbolizer-10))
446 make check-api
447
448 - name: Check Perl scripts
449 if: ${{ matrix.container == 'ubuntu:22.04' }}
450 run: |
451 perl -cw contrib/ftpasswd
452 perl -cw contrib/ftpquota
453
454 - name: Check HTML docs
455 if: ${{ matrix.container == 'ubuntu:22.04' }}
456 run: |
457 for f in $(/bin/ls doc/contrib/*.html doc/directives/*.html doc/howto/*.html doc/modules/*.html doc/utils/*.html); do echo "Processing $f"; tidy -errors -omit -q $f; done || exit 0