blob: 121c37d4e68fcc85372b9351cf5bb3a8c441a550 [file] [log] [blame]
Tim Duesterhus288c0772020-07-28 23:00:35 +02001# Copyright 2019 Ilya Shipitsin <chipitsine@gmail.com>
2# Copyright 2020 Tim Duesterhus <tim@bastelstu.be>
3#
4# This program is free software; you can redistribute it and/or
5# modify it under the terms of the GNU General Public License
6# as published by the Free Software Foundation; either version
7# 2 of the License, or (at your option) any later version.
8
9name: VTest
10
11on:
12 push:
13
Tim Duesterhus89c9d0a2021-10-16 18:10:26 +020014permissions:
15 contents: read
16
Tim Duesterhus288c0772020-07-28 23:00:35 +020017jobs:
18 # The generate-matrix job generates the build matrix using JSON output
19 # generated by .github/matrix.py.
20 generate-matrix:
21 name: Generate Build Matrix
22 runs-on: ubuntu-latest
23 outputs:
24 matrix: ${{ steps.set-matrix.outputs.matrix }}
25 steps:
26 - uses: actions/checkout@v2
27 - name: Generate Build Matrix
28 id: set-matrix
Tim Duesterhus8d173e12020-11-20 00:16:00 +010029 run: python3 .github/matrix.py "${{ github.event_name }}"
Tim Duesterhus288c0772020-07-28 23:00:35 +020030
31 # The Test job actually runs the tests.
32 Test:
33 name: ${{ matrix.name }}
34 needs: generate-matrix
35 runs-on: ${{ matrix.os }}
36 strategy:
37 matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
38 fail-fast: false
39 env:
40 # Configure a short TMPDIR to prevent failures due to long unix socket
41 # paths.
42 TMPDIR: /tmp
43 # Force ASAN output into asan.log to make the output more readable.
44 ASAN_OPTIONS: log_path=asan.log
45 steps:
46 - uses: actions/checkout@v2
47 with:
48 fetch-depth: 100
49 - name: Install apt dependencies
50 if: ${{ startsWith(matrix.os, 'ubuntu-') }}
51 run: |
Ilya Shipitsine48853a2020-11-21 13:42:19 +050052 sudo apt-get update
Tim Duesterhus288c0772020-07-28 23:00:35 +020053 sudo apt-get install -y \
54 liblua5.3-dev \
55 libpcre2-dev \
56 libsystemd-dev \
57 ninja-build \
58 socat
59 - name: Install brew dependencies
60 if: ${{ startsWith(matrix.os, 'macos-') }}
61 run: |
62 brew install socat
63 brew install lua
64 - name: Install VTest
65 run: |
Ilya Shipitsin0b038952021-05-15 11:46:15 +050066 scripts/build-vtest.sh
Tim Duesterhus288c0772020-07-28 23:00:35 +020067 - name: Install SSL ${{ matrix.ssl }}
68 if: ${{ matrix.ssl && matrix.ssl != 'stock' }}
69 run: env ${{ matrix.ssl }} scripts/build-ssl.sh
Ilya Shipitsin75c95aa2021-05-18 09:46:43 +000070 - name: Install OpenTracing libs
71 if: ${{ contains(matrix.FLAGS, 'USE_OT=1') }}
72 run: scripts/build-ot.sh
Tim Duesterhus288c0772020-07-28 23:00:35 +020073 - name: Build WURFL
74 if: ${{ contains(matrix.FLAGS, 'USE_WURFL=1') }}
Willy Tarreau57610c62021-04-02 16:39:44 +020075 run: make -C addons/wurfl/dummy
Tim Duesterhus288c0772020-07-28 23:00:35 +020076 - name: Compile HAProxy with ${{ matrix.CC }}
77 run: |
Willy Tarreau4673c5e2021-11-26 15:45:41 +010078 echo "::group::Show platform specific defines"
79 echo | ${{ matrix.CC }} -dM -xc -E -
80 echo "::endgroup::"
Tim Duesterhus288c0772020-07-28 23:00:35 +020081 make -j$(nproc) all \
82 ERR=1 \
83 TARGET=${{ matrix.TARGET }} \
84 CC=${{ matrix.CC }} \
Tim Duesterhus9fee7e02020-11-21 18:08:00 +010085 DEBUG=-DDEBUG_STRICT=1 \
Tim Duesterhus288c0772020-07-28 23:00:35 +020086 ${{ join(matrix.FLAGS, ' ') }} \
87 ADDLIB="-Wl,-rpath,/usr/local/lib/ -Wl,-rpath,$HOME/opt/lib/"
88 sudo make install
89 - name: Show HAProxy version
Ilya Shipitsin2ef4c7c2021-12-25 13:53:04 +050090 if: ${{ !failure() }}
Tim Duesterhus288c0772020-07-28 23:00:35 +020091 id: show-version
92 run: |
93 echo "::group::Show dynamic libraries."
94 if command -v ldd > /dev/null; then
95 # Linux
96 ldd $(which haproxy)
97 else
98 # macOS
99 otool -L $(which haproxy)
100 fi
101 echo "::endgroup::"
102 haproxy -vv
103 echo "::set-output name=version::$(haproxy -v |awk 'NR==1{print $3}')"
Tim Duesterhus288c0772020-07-28 23:00:35 +0200104 - name: Install problem matcher for VTest
Ilya Shipitsin2ef4c7c2021-12-25 13:53:04 +0500105 if: ${{ !failure() }}
Tim Duesterhus288c0772020-07-28 23:00:35 +0200106 # This allows one to more easily see which tests fail.
107 run: echo "::add-matcher::.github/vtest.json"
108 - name: Run VTest for HAProxy ${{ steps.show-version.outputs.version }}
Ilya Shipitsin2ef4c7c2021-12-25 13:53:04 +0500109 if: ${{ !failure() }}
Tim Duesterhus288c0772020-07-28 23:00:35 +0200110 id: vtest
Tim Duesterhus8a91fa42021-06-13 15:02:24 +0200111 run: |
112 # This is required for macOS which does not actually allow to increase
113 # the '-n' soft limit to the hard limit, thus failing to run.
114 ulimit -n 5000
115 make reg-tests VTEST_PROGRAM=../vtest/vtest REGTESTS_TYPES=default,bug,devel
Ilya Shipitsin2ef4c7c2021-12-25 13:53:04 +0500116 - name: Show VTest results
117 if: ${{ failure() && steps.vtest.outcome == 'failure' }}
Tim Duesterhus288c0772020-07-28 23:00:35 +0200118 run: |
Tim Duesterhus288c0772020-07-28 23:00:35 +0200119 for folder in ${TMPDIR}/haregtests-*/vtc.*; do
120 printf "::group::"
121 cat $folder/INFO
122 cat $folder/LOG
123 echo "::endgroup::"
124 done
125 shopt -s nullglob
126 for asan in asan.log*; do
127 echo "::group::$asan"
Tim Duesterhus8a91fa42021-06-13 15:02:24 +0200128 cat $asan
Tim Duesterhus288c0772020-07-28 23:00:35 +0200129 echo "::endgroup::"
130 done