blob: 7a1c1ef62a5f63c5b49bdd662ae0222d3c367e65 [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:
Tim Duesterhus5f4ddb52022-04-09 22:08:41 +020026 - uses: actions/checkout@v3
Tim Duesterhus288c0772020-07-28 23:00:35 +020027 - 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
Ilya Shipitsine9efc3a2022-01-15 14:23:37 +050045 OT_CPP_VERSION: 1.6.0
Tim Duesterhus288c0772020-07-28 23:00:35 +020046 steps:
Tim Duesterhus5f4ddb52022-04-09 22:08:41 +020047 - uses: actions/checkout@v3
Tim Duesterhus288c0772020-07-28 23:00:35 +020048 with:
49 fetch-depth: 100
Ilya Shipitsin27df87c2022-01-22 00:00:44 +050050#
51# Github Action cache key cannot contain comma, so we calculate it based on job name
52#
53 - name: Generate cache key
54 id: generate-cache-key
55 run: |
56 echo "::set-output name=key::$(echo ${{ matrix.name }} | sha256sum | awk '{print $1}')"
57
58 - name: Cache SSL libs
59 if: ${{ matrix.ssl && matrix.ssl != 'stock' && matrix.ssl != 'BORINGSSL=yes' && matrix.ssl != 'QUICTLS=yes' }}
60 id: cache_ssl
Tim Duesterhus538d8fe2022-04-09 22:08:42 +020061 uses: actions/cache@v3
Ilya Shipitsin27df87c2022-01-22 00:00:44 +050062 with:
63 path: '~/opt/'
64 key: ssl-${{ steps.generate-cache-key.outputs.key }}
65
Ilya Shipitsinb9e3fb72022-01-13 11:36:28 +050066 - name: Cache OpenTracing
67 if: ${{ contains(matrix.FLAGS, 'USE_OT=1') }}
68 id: cache_ot
Tim Duesterhus538d8fe2022-04-09 22:08:42 +020069 uses: actions/cache@v3
Ilya Shipitsinb9e3fb72022-01-13 11:36:28 +050070 with:
71 path: '~/opt-ot/'
72 key: ot-${{ matrix.CC }}-${{ env.OT_CPP_VERSION }}-${{ contains(matrix.name, 'ASAN') }}
Tim Duesterhus288c0772020-07-28 23:00:35 +020073 - name: Install apt dependencies
74 if: ${{ startsWith(matrix.os, 'ubuntu-') }}
75 run: |
Ilya Shipitsine48853a2020-11-21 13:42:19 +050076 sudo apt-get update
Tim Duesterhus288c0772020-07-28 23:00:35 +020077 sudo apt-get install -y \
78 liblua5.3-dev \
79 libpcre2-dev \
80 libsystemd-dev \
81 ninja-build \
82 socat
83 - name: Install brew dependencies
84 if: ${{ startsWith(matrix.os, 'macos-') }}
85 run: |
86 brew install socat
87 brew install lua
88 - name: Install VTest
89 run: |
Ilya Shipitsin0b038952021-05-15 11:46:15 +050090 scripts/build-vtest.sh
Tim Duesterhus288c0772020-07-28 23:00:35 +020091 - name: Install SSL ${{ matrix.ssl }}
Ilya Shipitsin27df87c2022-01-22 00:00:44 +050092 if: ${{ matrix.ssl && matrix.ssl != 'stock' && steps.cache_ssl.outputs.cache-hit != 'true' }}
Tim Duesterhus288c0772020-07-28 23:00:35 +020093 run: env ${{ matrix.ssl }} scripts/build-ssl.sh
Ilya Shipitsin75c95aa2021-05-18 09:46:43 +000094 - name: Install OpenTracing libs
Ilya Shipitsinb9e3fb72022-01-13 11:36:28 +050095 if: ${{ contains(matrix.FLAGS, 'USE_OT=1') && steps.cache_ot.outputs.cache-hit != 'true' }}
96 run: |
Ilya Shipitsine9efc3a2022-01-15 14:23:37 +050097 OT_PREFIX=${HOME}/opt-ot scripts/build-ot.sh
Tim Duesterhus288c0772020-07-28 23:00:35 +020098 - name: Build WURFL
99 if: ${{ contains(matrix.FLAGS, 'USE_WURFL=1') }}
Willy Tarreau57610c62021-04-02 16:39:44 +0200100 run: make -C addons/wurfl/dummy
Tim Duesterhus288c0772020-07-28 23:00:35 +0200101 - name: Compile HAProxy with ${{ matrix.CC }}
102 run: |
Willy Tarreau4673c5e2021-11-26 15:45:41 +0100103 echo "::group::Show platform specific defines"
104 echo | ${{ matrix.CC }} -dM -xc -E -
105 echo "::endgroup::"
Tim Duesterhus288c0772020-07-28 23:00:35 +0200106 make -j$(nproc) all \
107 ERR=1 \
108 TARGET=${{ matrix.TARGET }} \
109 CC=${{ matrix.CC }} \
Willy Tarreaua0a69112022-02-23 17:58:46 +0100110 DEBUG="-DDEBUG_STRICT -DDEBUG_MEMORY_POOLS -DDEBUG_POOL_INTEGRITY" \
Tim Duesterhus288c0772020-07-28 23:00:35 +0200111 ${{ join(matrix.FLAGS, ' ') }} \
112 ADDLIB="-Wl,-rpath,/usr/local/lib/ -Wl,-rpath,$HOME/opt/lib/"
113 sudo make install
114 - name: Show HAProxy version
115 id: show-version
116 run: |
117 echo "::group::Show dynamic libraries."
118 if command -v ldd > /dev/null; then
119 # Linux
120 ldd $(which haproxy)
121 else
122 # macOS
123 otool -L $(which haproxy)
124 fi
125 echo "::endgroup::"
126 haproxy -vv
127 echo "::set-output name=version::$(haproxy -v |awk 'NR==1{print $3}')"
Tim Duesterhus288c0772020-07-28 23:00:35 +0200128 - name: Install problem matcher for VTest
129 # This allows one to more easily see which tests fail.
130 run: echo "::add-matcher::.github/vtest.json"
131 - name: Run VTest for HAProxy ${{ steps.show-version.outputs.version }}
132 id: vtest
Tim Duesterhus8a91fa42021-06-13 15:02:24 +0200133 run: |
134 # This is required for macOS which does not actually allow to increase
135 # the '-n' soft limit to the hard limit, thus failing to run.
136 ulimit -n 5000
137 make reg-tests VTEST_PROGRAM=../vtest/vtest REGTESTS_TYPES=default,bug,devel
Ilya Shipitsin2ef4c7c2021-12-25 13:53:04 +0500138 - name: Show VTest results
139 if: ${{ failure() && steps.vtest.outcome == 'failure' }}
Tim Duesterhus288c0772020-07-28 23:00:35 +0200140 run: |
Tim Duesterhus288c0772020-07-28 23:00:35 +0200141 for folder in ${TMPDIR}/haregtests-*/vtc.*; do
142 printf "::group::"
143 cat $folder/INFO
144 cat $folder/LOG
145 echo "::endgroup::"
146 done
147 shopt -s nullglob
148 for asan in asan.log*; do
149 echo "::group::$asan"
Tim Duesterhus8a91fa42021-06-13 15:02:24 +0200150 cat $asan
Tim Duesterhus288c0772020-07-28 23:00:35 +0200151 echo "::endgroup::"
152 done