2020-07-28 23:00:35 +02:00
# Copyright 2019 Ilya Shipitsin <chipitsine@gmail.com>
# Copyright 2020 Tim Duesterhus <tim@bastelstu.be>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version
# 2 of the License, or (at your option) any later version.
name : VTest
on :
push :
2021-10-16 18:10:26 +02:00
permissions :
contents : read
2020-07-28 23:00:35 +02:00
jobs :
# The generate-matrix job generates the build matrix using JSON output
# generated by .github/matrix.py.
generate-matrix :
name : Generate Build Matrix
runs-on : ubuntu-latest
outputs :
matrix : ${{ steps.set-matrix.outputs.matrix }}
steps :
2022-04-09 22:08:41 +02:00
- uses : actions/checkout@v3
2020-07-28 23:00:35 +02:00
- name : Generate Build Matrix
id : set-matrix
2020-11-20 00:16:00 +01:00
run : python3 .github/matrix.py "${{ github.event_name }}"
2020-07-28 23:00:35 +02:00
# The Test job actually runs the tests.
Test :
name : ${{ matrix.name }}
needs : generate-matrix
runs-on : ${{ matrix.os }}
strategy :
matrix : ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
fail-fast : false
env :
# Configure a short TMPDIR to prevent failures due to long unix socket
# paths.
TMPDIR : /tmp
# Force ASAN output into asan.log to make the output more readable.
ASAN_OPTIONS : log_path=asan.log
2022-01-15 14:23:37 +05:00
OT_CPP_VERSION : 1.6 .0
2020-07-28 23:00:35 +02:00
steps :
2022-04-09 22:08:41 +02:00
- uses : actions/checkout@v3
2020-07-28 23:00:35 +02:00
with :
fetch-depth : 100
2022-01-22 00:00:44 +05:00
#
# Github Action cache key cannot contain comma, so we calculate it based on job name
#
- name : Generate cache key
id : generate-cache-key
run : |
echo "::set-output name=key::$(echo ${{ matrix.name }} | sha256sum | awk '{print $1}')"
- name : Cache SSL libs
if : ${{ matrix.ssl && matrix.ssl != 'stock' && matrix.ssl != 'BORINGSSL=yes' && matrix.ssl != 'QUICTLS=yes' }}
id : cache_ssl
2022-04-09 22:08:42 +02:00
uses : actions/cache@v3
2022-01-22 00:00:44 +05:00
with :
path : '~/opt/'
key : ssl-${{ steps.generate-cache-key.outputs.key }}
2022-01-13 11:36:28 +05:00
- name : Cache OpenTracing
if : ${{ contains(matrix.FLAGS, 'USE_OT=1') }}
id : cache_ot
2022-04-09 22:08:42 +02:00
uses : actions/cache@v3
2022-01-13 11:36:28 +05:00
with :
path : '~/opt-ot/'
key : ot-${{ matrix.CC }}-${{ env.OT_CPP_VERSION }}-${{ contains(matrix.name, 'ASAN') }}
2020-07-28 23:00:35 +02:00
- name : Install apt dependencies
if : ${{ startsWith(matrix.os, 'ubuntu-') }}
run : |
2020-11-21 13:42:19 +05:00
sudo apt-get update
2020-07-28 23:00:35 +02:00
sudo apt-get install -y \
liblua5.3-dev \
libpcre2-dev \
libsystemd-dev \
ninja-build \
socat
- name : Install brew dependencies
if : ${{ startsWith(matrix.os, 'macos-') }}
run : |
brew install socat
brew install lua
- name : Install VTest
run : |
2021-05-15 11:46:15 +05:00
scripts/build-vtest.sh
2020-07-28 23:00:35 +02:00
- name : Install SSL ${{ matrix.ssl }}
2022-01-22 00:00:44 +05:00
if : ${{ matrix.ssl && matrix.ssl != 'stock' && steps.cache_ssl.outputs.cache-hit != 'true' }}
2020-07-28 23:00:35 +02:00
run : env ${{ matrix.ssl }} scripts/build-ssl.sh
2021-05-18 09:46:43 +00:00
- name : Install OpenTracing libs
2022-01-13 11:36:28 +05:00
if : ${{ contains(matrix.FLAGS, 'USE_OT=1') && steps.cache_ot.outputs.cache-hit != 'true' }}
run : |
2022-01-15 14:23:37 +05:00
OT_PREFIX=${HOME}/opt-ot scripts/build-ot.sh
2020-07-28 23:00:35 +02:00
- name : Build WURFL
if : ${{ contains(matrix.FLAGS, 'USE_WURFL=1') }}
2021-04-02 16:39:44 +02:00
run : make -C addons/wurfl/dummy
2020-07-28 23:00:35 +02:00
- name : Compile HAProxy with ${{ matrix.CC }}
run : |
2021-11-26 15:45:41 +01:00
echo "::group::Show platform specific defines"
echo | ${{ matrix.CC }} -dM -xc -E -
echo "::endgroup::"
2020-07-28 23:00:35 +02:00
make -j$(nproc) all \
ERR=1 \
TARGET=${{ matrix.TARGET }} \
CC=${{ matrix.CC }} \
2022-02-23 17:58:46 +01:00
DEBUG="-DDEBUG_STRICT -DDEBUG_MEMORY_POOLS -DDEBUG_POOL_INTEGRITY" \
2020-07-28 23:00:35 +02:00
${{ join(matrix.FLAGS, ' ') }} \
ADDLIB="-Wl,-rpath,/usr/local/lib/ -Wl,-rpath,$HOME/opt/lib/"
sudo make install
- name : Show HAProxy version
id : show-version
run : |
echo "::group::Show dynamic libraries."
if command -v ldd > /dev/null; then
# Linux
ldd $(which haproxy)
else
# macOS
otool -L $(which haproxy)
fi
echo "::endgroup::"
haproxy -vv
echo "::set-output name=version::$(haproxy -v |awk 'NR==1{print $3}')"
- name : Install problem matcher for VTest
# This allows one to more easily see which tests fail.
run : echo "::add-matcher::.github/vtest.json"
- name : Run VTest for HAProxy ${{ steps.show-version.outputs.version }}
id : vtest
2021-06-13 15:02:24 +02:00
run : |
# This is required for macOS which does not actually allow to increase
# the '-n' soft limit to the hard limit, thus failing to run.
ulimit -n 5000
make reg-tests VTEST_PROGRAM=../vtest/vtest REGTESTS_TYPES=default,bug,devel
2021-12-25 13:53:04 +05:00
- name : Show VTest results
if : ${{ failure() && steps.vtest.outcome == 'failure' }}
2020-07-28 23:00:35 +02:00
run : |
for folder in ${TMPDIR}/haregtests-*/vtc.*; do
printf "::group::"
cat $folder/INFO
cat $folder/LOG
echo "::endgroup::"
done
shopt -s nullglob
for asan in asan.log*; do
echo "::group::$asan"
2021-06-13 15:02:24 +02:00
cat $asan
2020-07-28 23:00:35 +02:00
echo "::endgroup::"
done