blob: f5f35a6e1cb1811edbb7dfc6feaf771c3a387c1e [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
42 steps:
43 - uses: actions/checkout@v2
44 with:
45 fetch-depth: 100
46 - name: Install apt dependencies
47 if: ${{ startsWith(matrix.os, 'ubuntu-') }}
48 run: |
Ilya Shipitsine48853a2020-11-21 13:42:19 +050049 sudo apt-get update
Tim Duesterhus288c0772020-07-28 23:00:35 +020050 sudo apt-get install -y \
51 liblua5.3-dev \
52 libpcre2-dev \
53 libsystemd-dev \
54 ninja-build \
55 socat
56 - name: Install brew dependencies
57 if: ${{ startsWith(matrix.os, 'macos-') }}
58 run: |
59 brew install socat
60 brew install lua
61 - name: Install VTest
62 run: |
Tim Duesterhus24105302021-01-20 19:13:29 +010063 curl -fsSL https://github.com/vtest/VTest/archive/02a9bc16d78e70d1d415b40d5349b9f3e56df05b.tar.gz -o VTest.tar.gz
Tim Duesterhus288c0772020-07-28 23:00:35 +020064 mkdir VTest
65 tar xvf VTest.tar.gz -C VTest --strip-components=1
66 make -C VTest -j$(nproc) FLAGS="-O2 -s -Wall"
67 sudo install -m755 VTest/vtest /usr/local/bin/vtest
68 - name: Install SLZ
69 if: ${{ contains(matrix.FLAGS, 'USE_SLZ=1') }}
70 run: |
71 curl -fsSL https://github.com/wtarreau/libslz/archive/master.tar.gz -o libslz.tar.gz
72 mkdir libslz
73 tar xvf libslz.tar.gz -C libslz --strip-components=1
74 make -C libslz
75 sudo make -C libslz install
76 - name: Install SSL ${{ matrix.ssl }}
77 if: ${{ matrix.ssl && matrix.ssl != 'stock' }}
78 run: env ${{ matrix.ssl }} scripts/build-ssl.sh
79 - name: Build WURFL
80 if: ${{ contains(matrix.FLAGS, 'USE_WURFL=1') }}
81 run: make -C contrib/wurfl
82 - name: Compile HAProxy with ${{ matrix.CC }}
83 run: |
84 make -j$(nproc) all \
85 ERR=1 \
86 TARGET=${{ matrix.TARGET }} \
87 CC=${{ matrix.CC }} \
Tim Duesterhus9fee7e02020-11-21 18:08:00 +010088 DEBUG=-DDEBUG_STRICT=1 \
Tim Duesterhus288c0772020-07-28 23:00:35 +020089 ${{ join(matrix.FLAGS, ' ') }} \
90 ADDLIB="-Wl,-rpath,/usr/local/lib/ -Wl,-rpath,$HOME/opt/lib/"
91 sudo make install
92 - name: Show HAProxy version
93 id: show-version
94 run: |
95 echo "::group::Show dynamic libraries."
96 if command -v ldd > /dev/null; then
97 # Linux
98 ldd $(which haproxy)
99 else
100 # macOS
101 otool -L $(which haproxy)
102 fi
103 echo "::endgroup::"
104 haproxy -vv
105 echo "::set-output name=version::$(haproxy -v |awk 'NR==1{print $3}')"
Tim Duesterhus288c0772020-07-28 23:00:35 +0200106 - name: Install problem matcher for VTest
107 # This allows one to more easily see which tests fail.
108 run: echo "::add-matcher::.github/vtest.json"
109 - name: Run VTest for HAProxy ${{ steps.show-version.outputs.version }}
110 id: vtest
111 # sudo is required, because macOS fails due to an open files limit.
112 run: sudo make reg-tests REGTESTS_TYPES=default,bug,devel
113 - name: Show results
114 if: ${{ failure() }}
115 # The chmod / sudo is necessary due to the `sudo` while running the tests.
116 run: |
117 sudo chmod a+rX ${TMPDIR}/haregtests-*/
118 for folder in ${TMPDIR}/haregtests-*/vtc.*; do
119 printf "::group::"
120 cat $folder/INFO
121 cat $folder/LOG
122 echo "::endgroup::"
123 done
124 shopt -s nullglob
125 for asan in asan.log*; do
126 echo "::group::$asan"
127 sudo cat $asan
128 echo "::endgroup::"
129 done