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 |
| 26 | run: python3 .github/matrix.py |
| 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: | |
| 49 | sudo apt-get install -y \ |
| 50 | liblua5.3-dev \ |
| 51 | libpcre2-dev \ |
| 52 | libsystemd-dev \ |
| 53 | ninja-build \ |
| 54 | socat |
| 55 | - name: Install brew dependencies |
| 56 | if: ${{ startsWith(matrix.os, 'macos-') }} |
| 57 | run: | |
| 58 | brew install socat |
| 59 | brew install lua |
| 60 | - name: Install VTest |
| 61 | run: | |
| 62 | curl -fsSL https://github.com/vtest/VTest/archive/master.tar.gz -o VTest.tar.gz |
| 63 | mkdir VTest |
| 64 | tar xvf VTest.tar.gz -C VTest --strip-components=1 |
| 65 | make -C VTest -j$(nproc) FLAGS="-O2 -s -Wall" |
| 66 | sudo install -m755 VTest/vtest /usr/local/bin/vtest |
| 67 | - name: Install SLZ |
| 68 | if: ${{ contains(matrix.FLAGS, 'USE_SLZ=1') }} |
| 69 | run: | |
| 70 | curl -fsSL https://github.com/wtarreau/libslz/archive/master.tar.gz -o libslz.tar.gz |
| 71 | mkdir libslz |
| 72 | tar xvf libslz.tar.gz -C libslz --strip-components=1 |
| 73 | make -C libslz |
| 74 | sudo make -C libslz install |
| 75 | - name: Install SSL ${{ matrix.ssl }} |
| 76 | if: ${{ matrix.ssl && matrix.ssl != 'stock' }} |
| 77 | run: env ${{ matrix.ssl }} scripts/build-ssl.sh |
| 78 | - name: Build WURFL |
| 79 | if: ${{ contains(matrix.FLAGS, 'USE_WURFL=1') }} |
| 80 | run: make -C contrib/wurfl |
| 81 | - name: Compile HAProxy with ${{ matrix.CC }} |
| 82 | run: | |
| 83 | make -j$(nproc) all \ |
| 84 | ERR=1 \ |
| 85 | TARGET=${{ matrix.TARGET }} \ |
| 86 | CC=${{ matrix.CC }} \ |
| 87 | ${{ join(matrix.FLAGS, ' ') }} \ |
| 88 | ADDLIB="-Wl,-rpath,/usr/local/lib/ -Wl,-rpath,$HOME/opt/lib/" |
| 89 | sudo make install |
| 90 | - name: Show HAProxy version |
| 91 | id: show-version |
| 92 | run: | |
| 93 | echo "::group::Show dynamic libraries." |
| 94 | if command -v ldd > /dev/null; then |
| 95 | # Linux |
| 96 | ldd $(which haproxy) |
| 97 | else |
| 98 | # macOS |
| 99 | otool -L $(which haproxy) |
| 100 | fi |
| 101 | echo "::endgroup::" |
| 102 | haproxy -vv |
| 103 | echo "::set-output name=version::$(haproxy -v |awk 'NR==1{print $3}')" |
| 104 | - name: Adjust hosts file |
| 105 | # This step can be removed if https://github.com/vtest/VTest/pull/24 is |
| 106 | # fixed. |
| 107 | run: | |
| 108 | cat /etc/hosts |
| 109 | sudo sed -i.bak '/::1/s/^/#/' /etc/hosts |
| 110 | - name: Install problem matcher for VTest |
| 111 | # This allows one to more easily see which tests fail. |
| 112 | run: echo "::add-matcher::.github/vtest.json" |
| 113 | - name: Run VTest for HAProxy ${{ steps.show-version.outputs.version }} |
| 114 | id: vtest |
| 115 | # sudo is required, because macOS fails due to an open files limit. |
| 116 | run: sudo make reg-tests REGTESTS_TYPES=default,bug,devel |
| 117 | - name: Show results |
| 118 | if: ${{ failure() }} |
| 119 | # The chmod / sudo is necessary due to the `sudo` while running the tests. |
| 120 | run: | |
| 121 | sudo chmod a+rX ${TMPDIR}/haregtests-*/ |
| 122 | for folder in ${TMPDIR}/haregtests-*/vtc.*; do |
| 123 | printf "::group::" |
| 124 | cat $folder/INFO |
| 125 | cat $folder/LOG |
| 126 | echo "::endgroup::" |
| 127 | done |
| 128 | shopt -s nullglob |
| 129 | for asan in asan.log*; do |
| 130 | echo "::group::$asan" |
| 131 | sudo cat $asan |
| 132 | echo "::endgroup::" |
| 133 | done |