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 | |
Tim Duesterhus | 89c9d0a | 2021-10-16 18:10:26 +0200 | [diff] [blame] | 14 | permissions: |
| 15 | contents: read |
| 16 | |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 17 | jobs: |
| 18 | # The generate-matrix job generates the build matrix using JSON output |
| 19 | # generated by .github/matrix.py. |
| 20 | generate-matrix: |
| 21 | name: Generate Build Matrix |
| 22 | runs-on: ubuntu-latest |
| 23 | outputs: |
| 24 | matrix: ${{ steps.set-matrix.outputs.matrix }} |
| 25 | steps: |
| 26 | - uses: actions/checkout@v2 |
| 27 | - name: Generate Build Matrix |
| 28 | id: set-matrix |
Tim Duesterhus | 8d173e1 | 2020-11-20 00:16:00 +0100 | [diff] [blame] | 29 | run: python3 .github/matrix.py "${{ github.event_name }}" |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 30 | |
| 31 | # The Test job actually runs the tests. |
| 32 | Test: |
| 33 | name: ${{ matrix.name }} |
| 34 | needs: generate-matrix |
| 35 | runs-on: ${{ matrix.os }} |
| 36 | strategy: |
| 37 | matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }} |
| 38 | fail-fast: false |
| 39 | env: |
| 40 | # Configure a short TMPDIR to prevent failures due to long unix socket |
| 41 | # paths. |
| 42 | TMPDIR: /tmp |
| 43 | # Force ASAN output into asan.log to make the output more readable. |
| 44 | ASAN_OPTIONS: log_path=asan.log |
Ilya Shipitsin | b9e3fb7 | 2022-01-13 11:36:28 +0500 | [diff] [blame^] | 45 | OT_CPP_VERSION: 1.5.0 |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 46 | steps: |
| 47 | - uses: actions/checkout@v2 |
| 48 | with: |
| 49 | fetch-depth: 100 |
Ilya Shipitsin | b9e3fb7 | 2022-01-13 11:36:28 +0500 | [diff] [blame^] | 50 | - name: Cache OpenTracing |
| 51 | if: ${{ contains(matrix.FLAGS, 'USE_OT=1') }} |
| 52 | id: cache_ot |
| 53 | uses: actions/cache@v2 |
| 54 | with: |
| 55 | path: '~/opt-ot/' |
| 56 | key: ot-${{ matrix.CC }}-${{ env.OT_CPP_VERSION }}-${{ contains(matrix.name, 'ASAN') }} |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 57 | - name: Install apt dependencies |
| 58 | if: ${{ startsWith(matrix.os, 'ubuntu-') }} |
| 59 | run: | |
Ilya Shipitsin | e48853a | 2020-11-21 13:42:19 +0500 | [diff] [blame] | 60 | sudo apt-get update |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 61 | sudo apt-get install -y \ |
| 62 | liblua5.3-dev \ |
| 63 | libpcre2-dev \ |
| 64 | libsystemd-dev \ |
| 65 | ninja-build \ |
| 66 | socat |
| 67 | - name: Install brew dependencies |
| 68 | if: ${{ startsWith(matrix.os, 'macos-') }} |
| 69 | run: | |
| 70 | brew install socat |
| 71 | brew install lua |
| 72 | - name: Install VTest |
| 73 | run: | |
Ilya Shipitsin | 0b03895 | 2021-05-15 11:46:15 +0500 | [diff] [blame] | 74 | scripts/build-vtest.sh |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 75 | - name: Install SSL ${{ matrix.ssl }} |
| 76 | if: ${{ matrix.ssl && matrix.ssl != 'stock' }} |
| 77 | run: env ${{ matrix.ssl }} scripts/build-ssl.sh |
Ilya Shipitsin | 75c95aa | 2021-05-18 09:46:43 +0000 | [diff] [blame] | 78 | - name: Install OpenTracing libs |
Ilya Shipitsin | b9e3fb7 | 2022-01-13 11:36:28 +0500 | [diff] [blame^] | 79 | if: ${{ contains(matrix.FLAGS, 'USE_OT=1') && steps.cache_ot.outputs.cache-hit != 'true' }} |
| 80 | run: | |
| 81 | wget https://github.com/opentracing/opentracing-cpp/archive/v${OT_CPP_VERSION}.tar.gz |
| 82 | tar xf v${OT_CPP_VERSION}.tar.gz |
| 83 | cd opentracing-cpp-${OT_CPP_VERSION} |
| 84 | mkdir build |
| 85 | cd build |
| 86 | cmake -DCMAKE_INSTALL_PREFIX=${HOME}/opt-ot -DBUILD_STATIC_LIBS=OFF -DBUILD_MOCKTRACER=OFF -DBUILD_TESTING=OFF .. |
| 87 | make -j$(nproc) |
| 88 | make install |
| 89 | git clone https://github.com/haproxytech/opentracing-c-wrapper.git |
| 90 | cd opentracing-c-wrapper |
| 91 | ./scripts/bootstrap |
| 92 | ./configure --prefix=${HOME}/opt-ot --with-opentracing=${HOME}/opt-ot |
| 93 | make -j$(nproc) |
| 94 | make install |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 95 | - name: Build WURFL |
| 96 | if: ${{ contains(matrix.FLAGS, 'USE_WURFL=1') }} |
Willy Tarreau | 57610c6 | 2021-04-02 16:39:44 +0200 | [diff] [blame] | 97 | run: make -C addons/wurfl/dummy |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 98 | - name: Compile HAProxy with ${{ matrix.CC }} |
| 99 | run: | |
Willy Tarreau | 4673c5e | 2021-11-26 15:45:41 +0100 | [diff] [blame] | 100 | echo "::group::Show platform specific defines" |
| 101 | echo | ${{ matrix.CC }} -dM -xc -E - |
| 102 | echo "::endgroup::" |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 103 | make -j$(nproc) all \ |
| 104 | ERR=1 \ |
| 105 | TARGET=${{ matrix.TARGET }} \ |
| 106 | CC=${{ matrix.CC }} \ |
Tim Duesterhus | 9fee7e0 | 2020-11-21 18:08:00 +0100 | [diff] [blame] | 107 | DEBUG=-DDEBUG_STRICT=1 \ |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 108 | ${{ join(matrix.FLAGS, ' ') }} \ |
| 109 | ADDLIB="-Wl,-rpath,/usr/local/lib/ -Wl,-rpath,$HOME/opt/lib/" |
| 110 | sudo make install |
| 111 | - name: Show HAProxy version |
| 112 | id: show-version |
| 113 | run: | |
| 114 | echo "::group::Show dynamic libraries." |
| 115 | if command -v ldd > /dev/null; then |
| 116 | # Linux |
| 117 | ldd $(which haproxy) |
| 118 | else |
| 119 | # macOS |
| 120 | otool -L $(which haproxy) |
| 121 | fi |
| 122 | echo "::endgroup::" |
| 123 | haproxy -vv |
| 124 | echo "::set-output name=version::$(haproxy -v |awk 'NR==1{print $3}')" |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 125 | - name: Install problem matcher for VTest |
| 126 | # This allows one to more easily see which tests fail. |
| 127 | run: echo "::add-matcher::.github/vtest.json" |
| 128 | - name: Run VTest for HAProxy ${{ steps.show-version.outputs.version }} |
| 129 | id: vtest |
Tim Duesterhus | 8a91fa4 | 2021-06-13 15:02:24 +0200 | [diff] [blame] | 130 | run: | |
| 131 | # This is required for macOS which does not actually allow to increase |
| 132 | # the '-n' soft limit to the hard limit, thus failing to run. |
| 133 | ulimit -n 5000 |
| 134 | make reg-tests VTEST_PROGRAM=../vtest/vtest REGTESTS_TYPES=default,bug,devel |
Ilya Shipitsin | 2ef4c7c | 2021-12-25 13:53:04 +0500 | [diff] [blame] | 135 | - name: Show VTest results |
| 136 | if: ${{ failure() && steps.vtest.outcome == 'failure' }} |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 137 | run: | |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 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" |
Tim Duesterhus | 8a91fa4 | 2021-06-13 15:02:24 +0200 | [diff] [blame] | 147 | cat $asan |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 148 | echo "::endgroup::" |
| 149 | done |