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: |
Tim Duesterhus | 5f4ddb5 | 2022-04-09 22:08:41 +0200 | [diff] [blame] | 26 | - uses: actions/checkout@v3 |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 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 | e9efc3a | 2022-01-15 14:23:37 +0500 | [diff] [blame] | 45 | OT_CPP_VERSION: 1.6.0 |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 46 | steps: |
Tim Duesterhus | 5f4ddb5 | 2022-04-09 22:08:41 +0200 | [diff] [blame] | 47 | - uses: actions/checkout@v3 |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 48 | with: |
| 49 | fetch-depth: 100 |
Ilya Shipitsin | 27df87c | 2022-01-22 00:00:44 +0500 | [diff] [blame] | 50 | # |
| 51 | # Github Action cache key cannot contain comma, so we calculate it based on job name |
| 52 | # |
| 53 | - name: Generate cache key |
| 54 | id: generate-cache-key |
| 55 | run: | |
Tim Duesterhus | b87ecbb | 2022-10-14 19:46:07 +0200 | [diff] [blame] | 56 | echo "key=$(echo ${{ matrix.name }} | sha256sum | awk '{print $1}')" >> $GITHUB_OUTPUT |
Ilya Shipitsin | 27df87c | 2022-01-22 00:00:44 +0500 | [diff] [blame] | 57 | |
| 58 | - name: Cache SSL libs |
| 59 | if: ${{ matrix.ssl && matrix.ssl != 'stock' && matrix.ssl != 'BORINGSSL=yes' && matrix.ssl != 'QUICTLS=yes' }} |
| 60 | id: cache_ssl |
Tim Duesterhus | 538d8fe | 2022-04-09 22:08:42 +0200 | [diff] [blame] | 61 | uses: actions/cache@v3 |
Ilya Shipitsin | 27df87c | 2022-01-22 00:00:44 +0500 | [diff] [blame] | 62 | with: |
| 63 | path: '~/opt/' |
| 64 | key: ssl-${{ steps.generate-cache-key.outputs.key }} |
| 65 | |
Ilya Shipitsin | b9e3fb7 | 2022-01-13 11:36:28 +0500 | [diff] [blame] | 66 | - name: Cache OpenTracing |
| 67 | if: ${{ contains(matrix.FLAGS, 'USE_OT=1') }} |
| 68 | id: cache_ot |
Tim Duesterhus | 538d8fe | 2022-04-09 22:08:42 +0200 | [diff] [blame] | 69 | uses: actions/cache@v3 |
Ilya Shipitsin | b9e3fb7 | 2022-01-13 11:36:28 +0500 | [diff] [blame] | 70 | with: |
| 71 | path: '~/opt-ot/' |
| 72 | key: ot-${{ matrix.CC }}-${{ env.OT_CPP_VERSION }}-${{ contains(matrix.name, 'ASAN') }} |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 73 | - name: Install apt dependencies |
| 74 | if: ${{ startsWith(matrix.os, 'ubuntu-') }} |
| 75 | run: | |
Ilya Shipitsin | e48853a | 2020-11-21 13:42:19 +0500 | [diff] [blame] | 76 | sudo apt-get update |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 77 | sudo apt-get install -y \ |
| 78 | liblua5.3-dev \ |
| 79 | libpcre2-dev \ |
| 80 | libsystemd-dev \ |
| 81 | ninja-build \ |
| 82 | socat |
| 83 | - name: Install brew dependencies |
| 84 | if: ${{ startsWith(matrix.os, 'macos-') }} |
| 85 | run: | |
| 86 | brew install socat |
| 87 | brew install lua |
| 88 | - name: Install VTest |
| 89 | run: | |
Ilya Shipitsin | 0b03895 | 2021-05-15 11:46:15 +0500 | [diff] [blame] | 90 | scripts/build-vtest.sh |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 91 | - name: Install SSL ${{ matrix.ssl }} |
Ilya Shipitsin | 27df87c | 2022-01-22 00:00:44 +0500 | [diff] [blame] | 92 | 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] | 93 | run: env ${{ matrix.ssl }} scripts/build-ssl.sh |
Ilya Shipitsin | 75c95aa | 2021-05-18 09:46:43 +0000 | [diff] [blame] | 94 | - name: Install OpenTracing libs |
Ilya Shipitsin | b9e3fb7 | 2022-01-13 11:36:28 +0500 | [diff] [blame] | 95 | if: ${{ contains(matrix.FLAGS, 'USE_OT=1') && steps.cache_ot.outputs.cache-hit != 'true' }} |
| 96 | run: | |
Ilya Shipitsin | e9efc3a | 2022-01-15 14:23:37 +0500 | [diff] [blame] | 97 | OT_PREFIX=${HOME}/opt-ot scripts/build-ot.sh |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 98 | - name: Build WURFL |
| 99 | if: ${{ contains(matrix.FLAGS, 'USE_WURFL=1') }} |
Willy Tarreau | 57610c6 | 2021-04-02 16:39:44 +0200 | [diff] [blame] | 100 | run: make -C addons/wurfl/dummy |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 101 | - name: Compile HAProxy with ${{ matrix.CC }} |
| 102 | run: | |
Willy Tarreau | a051816 | 2022-11-14 11:03:18 +0100 | [diff] [blame^] | 103 | echo "::group::Show compiler's version" |
| 104 | echo | ${{ matrix.CC }} -v |
| 105 | echo "::endgroup::" |
Willy Tarreau | 4673c5e | 2021-11-26 15:45:41 +0100 | [diff] [blame] | 106 | echo "::group::Show platform specific defines" |
| 107 | echo | ${{ matrix.CC }} -dM -xc -E - |
| 108 | echo "::endgroup::" |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 109 | make -j$(nproc) all \ |
| 110 | ERR=1 \ |
| 111 | TARGET=${{ matrix.TARGET }} \ |
| 112 | CC=${{ matrix.CC }} \ |
Willy Tarreau | a0a6911 | 2022-02-23 17:58:46 +0100 | [diff] [blame] | 113 | DEBUG="-DDEBUG_STRICT -DDEBUG_MEMORY_POOLS -DDEBUG_POOL_INTEGRITY" \ |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 114 | ${{ join(matrix.FLAGS, ' ') }} \ |
| 115 | ADDLIB="-Wl,-rpath,/usr/local/lib/ -Wl,-rpath,$HOME/opt/lib/" |
| 116 | sudo make install |
| 117 | - name: Show HAProxy version |
| 118 | id: show-version |
| 119 | run: | |
| 120 | echo "::group::Show dynamic libraries." |
| 121 | if command -v ldd > /dev/null; then |
| 122 | # Linux |
| 123 | ldd $(which haproxy) |
| 124 | else |
| 125 | # macOS |
| 126 | otool -L $(which haproxy) |
| 127 | fi |
| 128 | echo "::endgroup::" |
| 129 | haproxy -vv |
Tim Duesterhus | b87ecbb | 2022-10-14 19:46:07 +0200 | [diff] [blame] | 130 | echo "version=$(haproxy -v |awk 'NR==1{print $3}')" >> $GITHUB_OUTPUT |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 131 | - name: Install problem matcher for VTest |
| 132 | # This allows one to more easily see which tests fail. |
| 133 | run: echo "::add-matcher::.github/vtest.json" |
| 134 | - name: Run VTest for HAProxy ${{ steps.show-version.outputs.version }} |
| 135 | id: vtest |
Tim Duesterhus | 8a91fa4 | 2021-06-13 15:02:24 +0200 | [diff] [blame] | 136 | run: | |
| 137 | # This is required for macOS which does not actually allow to increase |
| 138 | # the '-n' soft limit to the hard limit, thus failing to run. |
| 139 | ulimit -n 5000 |
| 140 | make reg-tests VTEST_PROGRAM=../vtest/vtest REGTESTS_TYPES=default,bug,devel |
Ilya Shipitsin | 2ef4c7c | 2021-12-25 13:53:04 +0500 | [diff] [blame] | 141 | - name: Show VTest results |
| 142 | if: ${{ failure() && steps.vtest.outcome == 'failure' }} |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 143 | run: | |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 144 | for folder in ${TMPDIR}/haregtests-*/vtc.*; do |
| 145 | printf "::group::" |
| 146 | cat $folder/INFO |
| 147 | cat $folder/LOG |
| 148 | echo "::endgroup::" |
| 149 | done |
| 150 | shopt -s nullglob |
| 151 | for asan in asan.log*; do |
| 152 | echo "::group::$asan" |
Tim Duesterhus | 8a91fa4 | 2021-06-13 15:02:24 +0200 | [diff] [blame] | 153 | cat $asan |
Tim Duesterhus | 288c077 | 2020-07-28 23:00:35 +0200 | [diff] [blame] | 154 | echo "::endgroup::" |
| 155 | done |