blob: cbec75a09118bfc6df2ceb808206cac2011b7883 [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
14jobs:
15 # The generate-matrix job generates the build matrix using JSON output
16 # generated by .github/matrix.py.
17 generate-matrix:
18 name: Generate Build Matrix
19 runs-on: ubuntu-latest
20 outputs:
21 matrix: ${{ steps.set-matrix.outputs.matrix }}
22 steps:
Tim Duesterhus4bb778b2022-04-09 22:08:41 +020023 - uses: actions/checkout@v3
Tim Duesterhus288c0772020-07-28 23:00:35 +020024 - name: Generate Build Matrix
25 id: set-matrix
Tim Duesterhus8d173e12020-11-20 00:16:00 +010026 run: python3 .github/matrix.py "${{ github.event_name }}"
Tim Duesterhus288c0772020-07-28 23:00:35 +020027
28 # The Test job actually runs the tests.
29 Test:
30 name: ${{ matrix.name }}
31 needs: generate-matrix
32 runs-on: ${{ matrix.os }}
33 strategy:
34 matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
35 fail-fast: false
36 env:
37 # Configure a short TMPDIR to prevent failures due to long unix socket
38 # paths.
39 TMPDIR: /tmp
40 # Force ASAN output into asan.log to make the output more readable.
41 ASAN_OPTIONS: log_path=asan.log
Ilya Shipitsinef86b472022-01-13 11:36:28 +050042 OT_CPP_VERSION: 1.5.0
Tim Duesterhus288c0772020-07-28 23:00:35 +020043 steps:
Tim Duesterhus4bb778b2022-04-09 22:08:41 +020044 - uses: actions/checkout@v3
Tim Duesterhus288c0772020-07-28 23:00:35 +020045 with:
46 fetch-depth: 100
Ilya Shipitsin81189f62022-01-22 00:00:44 +050047#
48# Github Action cache key cannot contain comma, so we calculate it based on job name
49#
50 - name: Generate cache key
51 id: generate-cache-key
52 run: |
53 echo "::set-output name=key::$(echo ${{ matrix.name }} | sha256sum | awk '{print $1}')"
54
55 - name: Cache SSL libs
56 if: ${{ matrix.ssl && matrix.ssl != 'stock' && matrix.ssl != 'BORINGSSL=yes' && matrix.ssl != 'QUICTLS=yes' }}
57 id: cache_ssl
58 uses: actions/cache@v2
59 with:
60 path: '~/opt/'
61 key: ssl-${{ steps.generate-cache-key.outputs.key }}
62
Ilya Shipitsinef86b472022-01-13 11:36:28 +050063 - name: Cache OpenTracing
64 if: ${{ contains(matrix.FLAGS, 'USE_OT=1') }}
65 id: cache_ot
66 uses: actions/cache@v2
67 with:
68 path: '~/opt-ot/'
69 key: ot-${{ matrix.CC }}-${{ env.OT_CPP_VERSION }}-${{ contains(matrix.name, 'ASAN') }}
Tim Duesterhus288c0772020-07-28 23:00:35 +020070 - name: Install apt dependencies
71 if: ${{ startsWith(matrix.os, 'ubuntu-') }}
72 run: |
Ilya Shipitsine48853a2020-11-21 13:42:19 +050073 sudo apt-get update
Tim Duesterhus288c0772020-07-28 23:00:35 +020074 sudo apt-get install -y \
75 liblua5.3-dev \
76 libpcre2-dev \
77 libsystemd-dev \
78 ninja-build \
79 socat
80 - name: Install brew dependencies
81 if: ${{ startsWith(matrix.os, 'macos-') }}
82 run: |
83 brew install socat
84 brew install lua
85 - name: Install VTest
86 run: |
Tim Duesterhus2ca0bbc2021-03-02 19:18:59 +010087 curl -fsSL https://github.com/vtest/VTest/archive/master.tar.gz -o VTest.tar.gz
Tim Duesterhus288c0772020-07-28 23:00:35 +020088 mkdir VTest
89 tar xvf VTest.tar.gz -C VTest --strip-components=1
Tim Duesterhusb38b5c32021-05-12 21:08:49 +020090 make -C VTest -j$(nproc) FLAGS="-O2 -s -Wall"
Tim Duesterhus288c0772020-07-28 23:00:35 +020091 sudo install -m755 VTest/vtest /usr/local/bin/vtest
Tim Duesterhus288c0772020-07-28 23:00:35 +020092 - name: Install SSL ${{ matrix.ssl }}
Ilya Shipitsin81189f62022-01-22 00:00:44 +050093 if: ${{ matrix.ssl && matrix.ssl != 'stock' && steps.cache_ssl.outputs.cache-hit != 'true' }}
Tim Duesterhus288c0772020-07-28 23:00:35 +020094 run: env ${{ matrix.ssl }} scripts/build-ssl.sh
Ilya Shipitsin73c3ed92021-05-18 09:46:43 +000095 - name: Install OpenTracing libs
Ilya Shipitsinef86b472022-01-13 11:36:28 +050096 if: ${{ contains(matrix.FLAGS, 'USE_OT=1') && steps.cache_ot.outputs.cache-hit != 'true' }}
97 run: |
98 wget https://github.com/opentracing/opentracing-cpp/archive/v${OT_CPP_VERSION}.tar.gz
99 tar xf v${OT_CPP_VERSION}.tar.gz
100 cd opentracing-cpp-${OT_CPP_VERSION}
101 mkdir build
102 cd build
103 cmake -DCMAKE_INSTALL_PREFIX=${HOME}/opt-ot -DBUILD_STATIC_LIBS=OFF -DBUILD_MOCKTRACER=OFF -DBUILD_TESTING=OFF ..
104 make -j$(nproc)
105 make install
106 git clone https://github.com/haproxytech/opentracing-c-wrapper.git
107 cd opentracing-c-wrapper
108 ./scripts/bootstrap
109 ./configure --prefix=${HOME}/opt-ot --with-opentracing=${HOME}/opt-ot
110 make -j$(nproc)
111 make install
Tim Duesterhus288c0772020-07-28 23:00:35 +0200112 - name: Build WURFL
113 if: ${{ contains(matrix.FLAGS, 'USE_WURFL=1') }}
Willy Tarreau57610c62021-04-02 16:39:44 +0200114 run: make -C addons/wurfl/dummy
Tim Duesterhus288c0772020-07-28 23:00:35 +0200115 - name: Compile HAProxy with ${{ matrix.CC }}
116 run: |
Willy Tarreau06bed612021-11-26 15:45:41 +0100117 echo "::group::Show platform specific defines"
118 echo | ${{ matrix.CC }} -dM -xc -E -
119 echo "::endgroup::"
Tim Duesterhus288c0772020-07-28 23:00:35 +0200120 make -j$(nproc) all \
121 ERR=1 \
122 TARGET=${{ matrix.TARGET }} \
123 CC=${{ matrix.CC }} \
Willy Tarreau16bfd732022-02-23 17:58:46 +0100124 DEBUG="-DDEBUG_STRICT -DDEBUG_MEMORY_POOLS -DDEBUG_POOL_INTEGRITY" \
Tim Duesterhus288c0772020-07-28 23:00:35 +0200125 ${{ join(matrix.FLAGS, ' ') }} \
126 ADDLIB="-Wl,-rpath,/usr/local/lib/ -Wl,-rpath,$HOME/opt/lib/"
127 sudo make install
128 - name: Show HAProxy version
129 id: show-version
130 run: |
131 echo "::group::Show dynamic libraries."
132 if command -v ldd > /dev/null; then
133 # Linux
134 ldd $(which haproxy)
135 else
136 # macOS
137 otool -L $(which haproxy)
138 fi
139 echo "::endgroup::"
140 haproxy -vv
141 echo "::set-output name=version::$(haproxy -v |awk 'NR==1{print $3}')"
Tim Duesterhus288c0772020-07-28 23:00:35 +0200142 - name: Install problem matcher for VTest
143 # This allows one to more easily see which tests fail.
144 run: echo "::add-matcher::.github/vtest.json"
145 - name: Run VTest for HAProxy ${{ steps.show-version.outputs.version }}
146 id: vtest
147 # sudo is required, because macOS fails due to an open files limit.
148 run: sudo make reg-tests REGTESTS_TYPES=default,bug,devel
149 - name: Show results
150 if: ${{ failure() }}
151 # The chmod / sudo is necessary due to the `sudo` while running the tests.
152 run: |
153 sudo chmod a+rX ${TMPDIR}/haregtests-*/
154 for folder in ${TMPDIR}/haregtests-*/vtc.*; do
155 printf "::group::"
156 cat $folder/INFO
157 cat $folder/LOG
158 echo "::endgroup::"
159 done
160 shopt -s nullglob
161 for asan in asan.log*; do
162 echo "::group::$asan"
163 sudo cat $asan
164 echo "::endgroup::"
165 done