blob: 5137099de8ae7c9c825089b6fba89cfa01060461 [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
William Lallemand61839b02022-12-23 14:40:04 +010028 env:
Tim Duesterhus96e03e12022-12-29 17:40:27 +010029 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Tim Duesterhus288c0772020-07-28 23:00:35 +020030 id: set-matrix
Ilya Shipitsin4a04cd32022-12-12 19:15:22 +050031 run: python3 .github/matrix.py "${{ github.ref_name }}"
Tim Duesterhus288c0772020-07-28 23:00:35 +020032
33 # The Test job actually runs the tests.
34 Test:
35 name: ${{ matrix.name }}
36 needs: generate-matrix
37 runs-on: ${{ matrix.os }}
38 strategy:
39 matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
40 fail-fast: false
41 env:
42 # Configure a short TMPDIR to prevent failures due to long unix socket
43 # paths.
44 TMPDIR: /tmp
45 # Force ASAN output into asan.log to make the output more readable.
46 ASAN_OPTIONS: log_path=asan.log
Ilya Shipitsine9efc3a2022-01-15 14:23:37 +050047 OT_CPP_VERSION: 1.6.0
Tim Duesterhus288c0772020-07-28 23:00:35 +020048 steps:
Tim Duesterhus5f4ddb52022-04-09 22:08:41 +020049 - uses: actions/checkout@v3
Tim Duesterhus288c0772020-07-28 23:00:35 +020050 with:
51 fetch-depth: 100
Ilya Shipitsin27df87c2022-01-22 00:00:44 +050052#
53# Github Action cache key cannot contain comma, so we calculate it based on job name
54#
55 - name: Generate cache key
56 id: generate-cache-key
57 run: |
Tim Duesterhusb87ecbb2022-10-14 19:46:07 +020058 echo "key=$(echo ${{ matrix.name }} | sha256sum | awk '{print $1}')" >> $GITHUB_OUTPUT
Ilya Shipitsin27df87c2022-01-22 00:00:44 +050059
60 - name: Cache SSL libs
61 if: ${{ matrix.ssl && matrix.ssl != 'stock' && matrix.ssl != 'BORINGSSL=yes' && matrix.ssl != 'QUICTLS=yes' }}
62 id: cache_ssl
Tim Duesterhus538d8fe2022-04-09 22:08:42 +020063 uses: actions/cache@v3
Ilya Shipitsin27df87c2022-01-22 00:00:44 +050064 with:
65 path: '~/opt/'
66 key: ssl-${{ steps.generate-cache-key.outputs.key }}
67
Ilya Shipitsinb9e3fb72022-01-13 11:36:28 +050068 - name: Cache OpenTracing
69 if: ${{ contains(matrix.FLAGS, 'USE_OT=1') }}
70 id: cache_ot
Tim Duesterhus538d8fe2022-04-09 22:08:42 +020071 uses: actions/cache@v3
Ilya Shipitsinb9e3fb72022-01-13 11:36:28 +050072 with:
73 path: '~/opt-ot/'
74 key: ot-${{ matrix.CC }}-${{ env.OT_CPP_VERSION }}-${{ contains(matrix.name, 'ASAN') }}
Tim Duesterhus288c0772020-07-28 23:00:35 +020075 - name: Install apt dependencies
76 if: ${{ startsWith(matrix.os, 'ubuntu-') }}
77 run: |
Ilya Shipitsine48853a2020-11-21 13:42:19 +050078 sudo apt-get update
Tim Duesterhus288c0772020-07-28 23:00:35 +020079 sudo apt-get install -y \
80 liblua5.3-dev \
81 libpcre2-dev \
82 libsystemd-dev \
83 ninja-build \
84 socat
85 - name: Install brew dependencies
86 if: ${{ startsWith(matrix.os, 'macos-') }}
87 run: |
88 brew install socat
89 brew install lua
90 - name: Install VTest
91 run: |
Ilya Shipitsin0b038952021-05-15 11:46:15 +050092 scripts/build-vtest.sh
Tim Duesterhus288c0772020-07-28 23:00:35 +020093 - name: Install SSL ${{ matrix.ssl }}
Ilya Shipitsin27df87c2022-01-22 00:00:44 +050094 if: ${{ matrix.ssl && matrix.ssl != 'stock' && steps.cache_ssl.outputs.cache-hit != 'true' }}
Tim Duesterhus288c0772020-07-28 23:00:35 +020095 run: env ${{ matrix.ssl }} scripts/build-ssl.sh
Ilya Shipitsin75c95aa2021-05-18 09:46:43 +000096 - name: Install OpenTracing libs
Ilya Shipitsinb9e3fb72022-01-13 11:36:28 +050097 if: ${{ contains(matrix.FLAGS, 'USE_OT=1') && steps.cache_ot.outputs.cache-hit != 'true' }}
98 run: |
Ilya Shipitsine9efc3a2022-01-15 14:23:37 +050099 OT_PREFIX=${HOME}/opt-ot scripts/build-ot.sh
Tim Duesterhus288c0772020-07-28 23:00:35 +0200100 - name: Build WURFL
101 if: ${{ contains(matrix.FLAGS, 'USE_WURFL=1') }}
Willy Tarreau57610c62021-04-02 16:39:44 +0200102 run: make -C addons/wurfl/dummy
Tim Duesterhus288c0772020-07-28 23:00:35 +0200103 - name: Compile HAProxy with ${{ matrix.CC }}
104 run: |
Willy Tarreaua0518162022-11-14 11:03:18 +0100105 echo "::group::Show compiler's version"
106 echo | ${{ matrix.CC }} -v
107 echo "::endgroup::"
Willy Tarreau4673c5e2021-11-26 15:45:41 +0100108 echo "::group::Show platform specific defines"
109 echo | ${{ matrix.CC }} -dM -xc -E -
110 echo "::endgroup::"
Tim Duesterhus288c0772020-07-28 23:00:35 +0200111 make -j$(nproc) all \
112 ERR=1 \
113 TARGET=${{ matrix.TARGET }} \
114 CC=${{ matrix.CC }} \
Willy Tarreaua0a69112022-02-23 17:58:46 +0100115 DEBUG="-DDEBUG_STRICT -DDEBUG_MEMORY_POOLS -DDEBUG_POOL_INTEGRITY" \
Tim Duesterhus288c0772020-07-28 23:00:35 +0200116 ${{ join(matrix.FLAGS, ' ') }} \
117 ADDLIB="-Wl,-rpath,/usr/local/lib/ -Wl,-rpath,$HOME/opt/lib/"
118 sudo make install
119 - name: Show HAProxy version
120 id: show-version
121 run: |
122 echo "::group::Show dynamic libraries."
123 if command -v ldd > /dev/null; then
124 # Linux
125 ldd $(which haproxy)
126 else
127 # macOS
128 otool -L $(which haproxy)
129 fi
130 echo "::endgroup::"
131 haproxy -vv
Tim Duesterhusb87ecbb2022-10-14 19:46:07 +0200132 echo "version=$(haproxy -v |awk 'NR==1{print $3}')" >> $GITHUB_OUTPUT
Tim Duesterhus288c0772020-07-28 23:00:35 +0200133 - name: Install problem matcher for VTest
134 # This allows one to more easily see which tests fail.
135 run: echo "::add-matcher::.github/vtest.json"
136 - name: Run VTest for HAProxy ${{ steps.show-version.outputs.version }}
137 id: vtest
Tim Duesterhus8a91fa42021-06-13 15:02:24 +0200138 run: |
139 # This is required for macOS which does not actually allow to increase
140 # the '-n' soft limit to the hard limit, thus failing to run.
William Lallemand2cb14932022-12-14 00:03:13 +0100141 ulimit -n 65536
Tim Duesterhus8a91fa42021-06-13 15:02:24 +0200142 make reg-tests VTEST_PROGRAM=../vtest/vtest REGTESTS_TYPES=default,bug,devel
Ilya Shipitsin2ef4c7c2021-12-25 13:53:04 +0500143 - name: Show VTest results
144 if: ${{ failure() && steps.vtest.outcome == 'failure' }}
Tim Duesterhus288c0772020-07-28 23:00:35 +0200145 run: |
Tim Duesterhus288c0772020-07-28 23:00:35 +0200146 for folder in ${TMPDIR}/haregtests-*/vtc.*; do
147 printf "::group::"
148 cat $folder/INFO
149 cat $folder/LOG
150 echo "::endgroup::"
151 done
152 shopt -s nullglob
153 for asan in asan.log*; do
154 echo "::group::$asan"
Tim Duesterhus8a91fa42021-06-13 15:02:24 +0200155 cat $asan
Tim Duesterhus288c0772020-07-28 23:00:35 +0200156 echo "::endgroup::"
157 done