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: |
Tim Duesterhus | 4bb778b | 2022-04-09 22:08:41 +0200 | [diff] [blame] | 23 | - uses: actions/checkout@v3 |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 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 |
Ilya Shipitsin | ef86b47 | 2022-01-13 11:36:28 +0500 | [diff] [blame] | 42 | OT_CPP_VERSION: 1.5.0 |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 43 | steps: |
Tim Duesterhus | 4bb778b | 2022-04-09 22:08:41 +0200 | [diff] [blame] | 44 | - uses: actions/checkout@v3 |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 45 | with: |
| 46 | fetch-depth: 100 |
Ilya Shipitsin | 81189f6 | 2022-01-22 00:00:44 +0500 | [diff] [blame] | 47 | # |
| 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 |
Tim Duesterhus | 075dcae | 2022-04-09 22:08:42 +0200 | [diff] [blame] | 58 | uses: actions/cache@v3 |
Ilya Shipitsin | 81189f6 | 2022-01-22 00:00:44 +0500 | [diff] [blame] | 59 | with: |
| 60 | path: '~/opt/' |
| 61 | key: ssl-${{ steps.generate-cache-key.outputs.key }} |
| 62 | |
Ilya Shipitsin | ef86b47 | 2022-01-13 11:36:28 +0500 | [diff] [blame] | 63 | - name: Cache OpenTracing |
| 64 | if: ${{ contains(matrix.FLAGS, 'USE_OT=1') }} |
| 65 | id: cache_ot |
Tim Duesterhus | 075dcae | 2022-04-09 22:08:42 +0200 | [diff] [blame] | 66 | uses: actions/cache@v3 |
Ilya Shipitsin | ef86b47 | 2022-01-13 11:36:28 +0500 | [diff] [blame] | 67 | with: |
| 68 | path: '~/opt-ot/' |
| 69 | key: ot-${{ matrix.CC }}-${{ env.OT_CPP_VERSION }}-${{ contains(matrix.name, 'ASAN') }} |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 70 | - name: Install apt dependencies |
| 71 | if: ${{ startsWith(matrix.os, 'ubuntu-') }} |
| 72 | run: | |
Ilya Shipitsin | e48853a | 2020-11-21 13:42:19 +0500 | [diff] [blame] | 73 | sudo apt-get update |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 74 | 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 Duesterhus | 2ca0bbc | 2021-03-02 19:18:59 +0100 | [diff] [blame] | 87 | 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] | 88 | mkdir VTest |
| 89 | tar xvf VTest.tar.gz -C VTest --strip-components=1 |
Tim Duesterhus | b38b5c3 | 2021-05-12 21:08:49 +0200 | [diff] [blame] | 90 | make -C VTest -j$(nproc) FLAGS="-O2 -s -Wall" |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 91 | sudo install -m755 VTest/vtest /usr/local/bin/vtest |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 92 | - name: Install SSL ${{ matrix.ssl }} |
Ilya Shipitsin | 81189f6 | 2022-01-22 00:00:44 +0500 | [diff] [blame] | 93 | if: ${{ matrix.ssl && matrix.ssl != 'stock' && steps.cache_ssl.outputs.cache-hit != 'true' }} |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 94 | run: env ${{ matrix.ssl }} scripts/build-ssl.sh |
Ilya Shipitsin | 73c3ed9 | 2021-05-18 09:46:43 +0000 | [diff] [blame] | 95 | - name: Install OpenTracing libs |
Ilya Shipitsin | ef86b47 | 2022-01-13 11:36:28 +0500 | [diff] [blame] | 96 | 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 Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 112 | - name: Build WURFL |
| 113 | if: ${{ contains(matrix.FLAGS, 'USE_WURFL=1') }} |
Willy Tarreau | 57610c6 | 2021-04-02 16:39:44 +0200 | [diff] [blame] | 114 | run: make -C addons/wurfl/dummy |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 115 | - name: Compile HAProxy with ${{ matrix.CC }} |
| 116 | run: | |
Willy Tarreau | 06bed61 | 2021-11-26 15:45:41 +0100 | [diff] [blame] | 117 | echo "::group::Show platform specific defines" |
| 118 | echo | ${{ matrix.CC }} -dM -xc -E - |
| 119 | echo "::endgroup::" |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 120 | make -j$(nproc) all \ |
| 121 | ERR=1 \ |
| 122 | TARGET=${{ matrix.TARGET }} \ |
| 123 | CC=${{ matrix.CC }} \ |
Willy Tarreau | 16bfd73 | 2022-02-23 17:58:46 +0100 | [diff] [blame] | 124 | DEBUG="-DDEBUG_STRICT -DDEBUG_MEMORY_POOLS -DDEBUG_POOL_INTEGRITY" \ |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 125 | ${{ 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 Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 142 | - 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 |