Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 1 | # 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 | |
| 9 | name: VTest |
| 10 | |
| 11 | on: |
| 12 | push: |
| 13 | |
| 14 | jobs: |
| 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 Duesterhus | 8d173e1 | 2020-11-20 00:16:00 +0100 | [diff] [blame] | 26 | run: python3 .github/matrix.py "${{ github.event_name }}" |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 27 | |
| 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 Shipitsin | e48853a | 2020-11-21 13:42:19 +0500 | [diff] [blame] | 49 | sudo apt-get update |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 50 | 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 Duesterhus | 2ca0bbc | 2021-03-02 19:18:59 +0100 | [diff] [blame] | 63 | curl -fsSL https://github.com/vtest/VTest/archive/master.tar.gz -o VTest.tar.gz |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 64 | mkdir VTest |
| 65 | tar xvf VTest.tar.gz -C VTest --strip-components=1 |
Tim Duesterhus | b38b5c3 | 2021-05-12 21:08:49 +0200 | [diff] [blame] | 66 | make -C VTest -j$(nproc) FLAGS="-O2 -s -Wall" |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 67 | sudo install -m755 VTest/vtest /usr/local/bin/vtest |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 68 | - name: Install SSL ${{ matrix.ssl }} |
| 69 | if: ${{ matrix.ssl && matrix.ssl != 'stock' }} |
| 70 | run: env ${{ matrix.ssl }} scripts/build-ssl.sh |
| 71 | - name: Build WURFL |
| 72 | if: ${{ contains(matrix.FLAGS, 'USE_WURFL=1') }} |
Willy Tarreau | 57610c6 | 2021-04-02 16:39:44 +0200 | [diff] [blame] | 73 | run: make -C addons/wurfl/dummy |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 74 | - name: Compile HAProxy with ${{ matrix.CC }} |
| 75 | run: | |
| 76 | make -j$(nproc) all \ |
| 77 | ERR=1 \ |
| 78 | TARGET=${{ matrix.TARGET }} \ |
| 79 | CC=${{ matrix.CC }} \ |
Tim Duesterhus | 9fee7e0 | 2020-11-21 18:08:00 +0100 | [diff] [blame] | 80 | DEBUG=-DDEBUG_STRICT=1 \ |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 81 | ${{ join(matrix.FLAGS, ' ') }} \ |
| 82 | ADDLIB="-Wl,-rpath,/usr/local/lib/ -Wl,-rpath,$HOME/opt/lib/" |
| 83 | sudo make install |
| 84 | - name: Show HAProxy version |
| 85 | id: show-version |
| 86 | run: | |
| 87 | echo "::group::Show dynamic libraries." |
| 88 | if command -v ldd > /dev/null; then |
| 89 | # Linux |
| 90 | ldd $(which haproxy) |
| 91 | else |
| 92 | # macOS |
| 93 | otool -L $(which haproxy) |
| 94 | fi |
| 95 | echo "::endgroup::" |
| 96 | haproxy -vv |
| 97 | echo "::set-output name=version::$(haproxy -v |awk 'NR==1{print $3}')" |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 98 | - name: Install problem matcher for VTest |
| 99 | # This allows one to more easily see which tests fail. |
| 100 | run: echo "::add-matcher::.github/vtest.json" |
| 101 | - name: Run VTest for HAProxy ${{ steps.show-version.outputs.version }} |
| 102 | id: vtest |
| 103 | # sudo is required, because macOS fails due to an open files limit. |
| 104 | run: sudo make reg-tests REGTESTS_TYPES=default,bug,devel |
| 105 | - name: Show results |
| 106 | if: ${{ failure() }} |
| 107 | # The chmod / sudo is necessary due to the `sudo` while running the tests. |
| 108 | run: | |
| 109 | sudo chmod a+rX ${TMPDIR}/haregtests-*/ |
| 110 | for folder in ${TMPDIR}/haregtests-*/vtc.*; do |
| 111 | printf "::group::" |
| 112 | cat $folder/INFO |
| 113 | cat $folder/LOG |
| 114 | echo "::endgroup::" |
| 115 | done |
| 116 | shopt -s nullglob |
| 117 | for asan in asan.log*; do |
| 118 | echo "::group::$asan" |
| 119 | sudo cat $asan |
| 120 | echo "::endgroup::" |
| 121 | done |