mirror of
https://github.com/haproxy/haproxy.git
synced 2026-07-16 12:23:15 -04:00
In commit 7640d794 ("CI: Integrate Musl build into vtest.yml"), the
alpine job was integrated into VTest.yml. However, most of the task are
still duplicated and changes in the workflow need edits of copy/paste
code in two places because of that.
This commit deduplicates the code by making the alpine job part of the
matrix, like it was done for macOS.
183 lines
6.3 KiB
YAML
183 lines
6.3 KiB
YAML
# 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:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
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-slim
|
|
outputs:
|
|
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- name: Generate Build Matrix
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
id: set-matrix
|
|
run: python3 .github/matrix.py "${{ github.ref_name }}"
|
|
|
|
# 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
|
|
container: ${{ matrix.container }}
|
|
env:
|
|
# Configure a short TMPDIR to prevent failures due to long unix socket
|
|
# paths.
|
|
TMPDIR: /tmp
|
|
OT_CPP_VERSION: 1.6.0
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
fetch-depth: 100
|
|
|
|
#
|
|
# 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 "key=$(echo ${{ matrix.name }} | sha256sum | awk '{print $1}')" >> $GITHUB_OUTPUT
|
|
|
|
- name: Cache SSL libs
|
|
if: ${{ matrix.ssl && matrix.ssl != 'stock' && matrix.ssl != 'BORINGSSL=yes' && !contains(matrix.ssl, 'QUICTLS') }}
|
|
id: cache_ssl
|
|
uses: actions/cache@v5
|
|
with:
|
|
path: '~/opt/'
|
|
key: ssl-${{ steps.generate-cache-key.outputs.key }}
|
|
|
|
- name: Cache OpenTracing
|
|
if: ${{ contains(matrix.FLAGS, 'USE_OT=1') }}
|
|
id: cache_ot
|
|
uses: actions/cache@v5
|
|
with:
|
|
path: '~/opt-ot/'
|
|
key: ${{ matrix.os }}-ot-${{ matrix.CC }}-${{ env.OT_CPP_VERSION }}-${{ contains(matrix.name, 'ASAN') }}
|
|
- name: Install apt dependencies
|
|
if: ${{ startsWith(matrix.os, 'ubuntu-') && matrix.TARGET != 'linux-musl' }}
|
|
run: |
|
|
sudo apt-get update -o Acquire::Languages=none -o Acquire::Translation=none
|
|
sudo apt-get --no-install-recommends -y install \
|
|
${{ case(contains(matrix.FLAGS, 'USE_LUA=1'), 'liblua5.4-dev', '') }} \
|
|
${{ case(contains(matrix.FLAGS, 'USE_PCRE2=1'), 'libpcre2-dev', '') }} \
|
|
${{ case(contains(matrix.ssl, 'BORINGSSL=yes'), 'ninja-build', '') }} \
|
|
socat \
|
|
gdb \
|
|
jose
|
|
- name: Install apk dependencies
|
|
if: ${{ matrix.TARGET == 'linux-musl' }}
|
|
run: apk add gcc gdb make tar git python3 libc-dev linux-headers pcre-dev pcre2-dev openssl-dev lua5.3-dev grep socat curl musl-dbg lua5.3-dbg jose sudo
|
|
- name: Install brew dependencies
|
|
if: ${{ startsWith(matrix.os, 'macos-') }}
|
|
run: |
|
|
brew install socat
|
|
brew install lua
|
|
- uses: ./.github/actions/setup-vtest
|
|
- name: Install SSL ${{ matrix.ssl }}
|
|
if: ${{ matrix.ssl && matrix.ssl != 'stock' && steps.cache_ssl.outputs.cache-hit != 'true' }}
|
|
run: env ${{ matrix.ssl }} scripts/build-ssl.sh
|
|
- name: Install OpenTracing libs
|
|
if: ${{ contains(matrix.FLAGS, 'USE_OT=1') && steps.cache_ot.outputs.cache-hit != 'true' }}
|
|
run: |
|
|
OT_PREFIX=${HOME}/opt-ot scripts/build-ot.sh
|
|
- name: Build WURFL
|
|
if: ${{ contains(matrix.FLAGS, 'USE_WURFL=1') }}
|
|
run: make -C addons/wurfl/dummy
|
|
- name: Compile HAProxy with ${{ matrix.CC }}
|
|
run: |
|
|
echo "::group::Show compiler's version"
|
|
echo | ${{ matrix.CC }} -v
|
|
echo "::endgroup::"
|
|
echo "::group::Show platform specific defines"
|
|
echo | ${{ matrix.CC }} -dM -xc -E -
|
|
echo "::endgroup::"
|
|
make -j$(nproc) all \
|
|
ERR=1 \
|
|
TARGET=${{ matrix.TARGET }} \
|
|
CC=${{ matrix.CC }} \
|
|
DEBUG="-DDEBUG_POOL_INTEGRITY -DDEBUG_UNIT" \
|
|
${{ join(matrix.FLAGS, ' ') }} \
|
|
ADDLIB="-Wl,-rpath,/usr/local/lib/ -Wl,-rpath,$HOME/opt/lib/"
|
|
sudo make install-bin
|
|
- name: Compile admin/halog/halog
|
|
run: |
|
|
make -j$(nproc) admin/halog/halog \
|
|
ERR=1 \
|
|
TARGET=${{ matrix.TARGET }} \
|
|
CC=${{ matrix.CC }} \
|
|
DEBUG="-DDEBUG_POOL_INTEGRITY -DDEBUG_UNIT" \
|
|
${{ join(matrix.FLAGS, ' ') }} \
|
|
ADDLIB="-Wl,-rpath,/usr/local/lib/ -Wl,-rpath,$HOME/opt/lib/"
|
|
- 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 "version=$(haproxy -vq)" >> $GITHUB_OUTPUT
|
|
- name: Run VTest for HAProxy ${{ steps.show-version.outputs.version }}
|
|
id: vtest
|
|
run: |
|
|
make reg-tests VTEST_PROGRAM=${{ github.workspace }}/vtest/vtest REGTESTS_TYPES=default,bug,devel
|
|
- name: Show VTest results
|
|
if: ${{ failure() && steps.vtest.outcome == 'failure' }}
|
|
run: |
|
|
for folder in ${TMPDIR:-/tmp}/haregtests-*/vtc.*; do
|
|
printf "::group::"
|
|
cat $folder/INFO
|
|
cat $folder/LOG
|
|
echo "::endgroup::"
|
|
done
|
|
exit 1
|
|
- name: Run Unit tests
|
|
id: unittests
|
|
run: |
|
|
make unit-tests
|
|
- name: Show Unit-Tests results
|
|
if: ${{ failure() && steps.unittests.outcome == 'failure' }}
|
|
run: |
|
|
for result in ${TMPDIR:-/tmp}/ha-unittests-*/results/res.*; do
|
|
printf "::group::"
|
|
cat $result
|
|
echo "::endgroup::"
|
|
done
|
|
exit 1
|
|
- name: Show coredumps
|
|
if: ${{ failure() && steps.vtest.outcome == 'failure' }}
|
|
run: |
|
|
failed=false
|
|
for file in /tmp/core/core.*; do
|
|
failed=true
|
|
printf "::group::"
|
|
gdb -ex 'thread apply all bt full' ./haproxy $file
|
|
echo "::endgroup::"
|
|
done
|
|
if [ "$failed" = true ]; then
|
|
exit 1;
|
|
fi
|