blob: 6fa09df34c07c3a2665ef3ea08c5e9cd47fe7a50 [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:
23 - uses: actions/checkout@v2
24 - 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:
44 - uses: actions/checkout@v2
45 with:
46 fetch-depth: 100
Ilya Shipitsinef86b472022-01-13 11:36:28 +050047 - name: Cache OpenTracing
48 if: ${{ contains(matrix.FLAGS, 'USE_OT=1') }}
49 id: cache_ot
50 uses: actions/cache@v2
51 with:
52 path: '~/opt-ot/'
53 key: ot-${{ matrix.CC }}-${{ env.OT_CPP_VERSION }}-${{ contains(matrix.name, 'ASAN') }}
Tim Duesterhus288c0772020-07-28 23:00:35 +020054 - name: Install apt dependencies
55 if: ${{ startsWith(matrix.os, 'ubuntu-') }}
56 run: |
Ilya Shipitsine48853a2020-11-21 13:42:19 +050057 sudo apt-get update
Tim Duesterhus288c0772020-07-28 23:00:35 +020058 sudo apt-get install -y \
59 liblua5.3-dev \
60 libpcre2-dev \
61 libsystemd-dev \
62 ninja-build \
63 socat
64 - name: Install brew dependencies
65 if: ${{ startsWith(matrix.os, 'macos-') }}
66 run: |
67 brew install socat
68 brew install lua
69 - name: Install VTest
70 run: |
Tim Duesterhus2ca0bbc2021-03-02 19:18:59 +010071 curl -fsSL https://github.com/vtest/VTest/archive/master.tar.gz -o VTest.tar.gz
Tim Duesterhus288c0772020-07-28 23:00:35 +020072 mkdir VTest
73 tar xvf VTest.tar.gz -C VTest --strip-components=1
Tim Duesterhusb38b5c32021-05-12 21:08:49 +020074 make -C VTest -j$(nproc) FLAGS="-O2 -s -Wall"
Tim Duesterhus288c0772020-07-28 23:00:35 +020075 sudo install -m755 VTest/vtest /usr/local/bin/vtest
Tim Duesterhus288c0772020-07-28 23:00:35 +020076 - name: Install SSL ${{ matrix.ssl }}
77 if: ${{ matrix.ssl && matrix.ssl != 'stock' }}
78 run: env ${{ matrix.ssl }} scripts/build-ssl.sh
Ilya Shipitsin73c3ed92021-05-18 09:46:43 +000079 - name: Install OpenTracing libs
Ilya Shipitsinef86b472022-01-13 11:36:28 +050080 if: ${{ contains(matrix.FLAGS, 'USE_OT=1') && steps.cache_ot.outputs.cache-hit != 'true' }}
81 run: |
82 wget https://github.com/opentracing/opentracing-cpp/archive/v${OT_CPP_VERSION}.tar.gz
83 tar xf v${OT_CPP_VERSION}.tar.gz
84 cd opentracing-cpp-${OT_CPP_VERSION}
85 mkdir build
86 cd build
87 cmake -DCMAKE_INSTALL_PREFIX=${HOME}/opt-ot -DBUILD_STATIC_LIBS=OFF -DBUILD_MOCKTRACER=OFF -DBUILD_TESTING=OFF ..
88 make -j$(nproc)
89 make install
90 git clone https://github.com/haproxytech/opentracing-c-wrapper.git
91 cd opentracing-c-wrapper
92 ./scripts/bootstrap
93 ./configure --prefix=${HOME}/opt-ot --with-opentracing=${HOME}/opt-ot
94 make -j$(nproc)
95 make install
Tim Duesterhus288c0772020-07-28 23:00:35 +020096 - name: Build WURFL
97 if: ${{ contains(matrix.FLAGS, 'USE_WURFL=1') }}
Willy Tarreau57610c62021-04-02 16:39:44 +020098 run: make -C addons/wurfl/dummy
Tim Duesterhus288c0772020-07-28 23:00:35 +020099 - name: Compile HAProxy with ${{ matrix.CC }}
100 run: |
Willy Tarreau06bed612021-11-26 15:45:41 +0100101 echo "::group::Show platform specific defines"
102 echo | ${{ matrix.CC }} -dM -xc -E -
103 echo "::endgroup::"
Tim Duesterhus288c0772020-07-28 23:00:35 +0200104 make -j$(nproc) all \
105 ERR=1 \
106 TARGET=${{ matrix.TARGET }} \
107 CC=${{ matrix.CC }} \
Willy Tarreau16bfd732022-02-23 17:58:46 +0100108 DEBUG="-DDEBUG_STRICT -DDEBUG_MEMORY_POOLS -DDEBUG_POOL_INTEGRITY" \
Tim Duesterhus288c0772020-07-28 23:00:35 +0200109 ${{ join(matrix.FLAGS, ' ') }} \
110 ADDLIB="-Wl,-rpath,/usr/local/lib/ -Wl,-rpath,$HOME/opt/lib/"
111 sudo make install
112 - name: Show HAProxy version
113 id: show-version
114 run: |
115 echo "::group::Show dynamic libraries."
116 if command -v ldd > /dev/null; then
117 # Linux
118 ldd $(which haproxy)
119 else
120 # macOS
121 otool -L $(which haproxy)
122 fi
123 echo "::endgroup::"
124 haproxy -vv
125 echo "::set-output name=version::$(haproxy -v |awk 'NR==1{print $3}')"
Tim Duesterhus288c0772020-07-28 23:00:35 +0200126 - name: Install problem matcher for VTest
127 # This allows one to more easily see which tests fail.
128 run: echo "::add-matcher::.github/vtest.json"
129 - name: Run VTest for HAProxy ${{ steps.show-version.outputs.version }}
130 id: vtest
131 # sudo is required, because macOS fails due to an open files limit.
132 run: sudo make reg-tests REGTESTS_TYPES=default,bug,devel
133 - name: Show results
134 if: ${{ failure() }}
135 # The chmod / sudo is necessary due to the `sudo` while running the tests.
136 run: |
137 sudo chmod a+rX ${TMPDIR}/haregtests-*/
138 for folder in ${TMPDIR}/haregtests-*/vtc.*; do
139 printf "::group::"
140 cat $folder/INFO
141 cat $folder/LOG
142 echo "::endgroup::"
143 done
144 shopt -s nullglob
145 for asan in asan.log*; do
146 echo "::group::$asan"
147 sudo cat $asan
148 echo "::endgroup::"
149 done