|
| 1 | +name: testing |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + pull_request: |
| 6 | + pull_request_target: |
| 7 | + types: [labeled] |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +jobs: |
| 11 | + run-tests-ee: |
| 12 | + # Does not run on pull requests from forks and on forks by default. |
| 13 | + # Tests from forks will run only when the pull request is labeled with |
| 14 | + # `full-ci`. To avoid security problems, the label must be reset manually |
| 15 | + # for every run. |
| 16 | + # |
| 17 | + # We need to use `pull_request_target` because it has access to base |
| 18 | + # repository secrets unlike `pull_request`. |
| 19 | + if: | |
| 20 | + github.repository == 'tarantool/go-tlsdialer' && |
| 21 | + (github.event_name == 'push' || |
| 22 | + (github.event_name == 'pull_request_target' && |
| 23 | + github.event.pull_request.head.repo.full_name != github.repository && |
| 24 | + github.event.label.name == 'full-ci')) || |
| 25 | + github.event_name == 'workflow_dispatch' |
| 26 | +
|
| 27 | + runs-on: ubuntu-latest |
| 28 | + |
| 29 | + strategy: |
| 30 | + fail-fast: false |
| 31 | + matrix: |
| 32 | + sdk-path: |
| 33 | + - 'release/linux/x86_64/1.10/' |
| 34 | + sdk-version: |
| 35 | + - 'sdk-1.10.15-0-r598' |
| 36 | + coveralls: [ false ] |
| 37 | + fuzzing: [ false ] |
| 38 | + ssl: [ false ] |
| 39 | + include: |
| 40 | + - sdk-path: 'release/linux/x86_64/2.10/' |
| 41 | + sdk-version: 'sdk-gc64-2.10.8-0-r598.linux.x86_64' |
| 42 | + coveralls: false |
| 43 | + ssl: true |
| 44 | + - sdk-path: 'release/linux/x86_64/2.11/' |
| 45 | + sdk-version: 'sdk-gc64-2.11.1-0-r598.linux.x86_64' |
| 46 | + coveralls: true |
| 47 | + ssl: true |
| 48 | + |
| 49 | + steps: |
| 50 | + - name: Clone the connector |
| 51 | + # `ref` as merge request is needed for pull_request_target because this |
| 52 | + # target runs in the context of the base commit of the pull request. |
| 53 | + uses: actions/checkout@v3 |
| 54 | + if: github.event_name == 'pull_request_target' |
| 55 | + with: |
| 56 | + ref: refs/pull/${{ github.event.pull_request.number }}/merge |
| 57 | + |
| 58 | + - name: Clone the connector |
| 59 | + if: github.event_name != 'pull_request_target' |
| 60 | + uses: actions/checkout@v3 |
| 61 | + |
| 62 | + - name: Setup Tarantool ${{ matrix.sdk-version }} |
| 63 | + run: | |
| 64 | + ARCHIVE_NAME=tarantool-enterprise-${{ matrix.sdk-version }}.tar.gz |
| 65 | + curl -O -L https://${{ secrets.SDK_DOWNLOAD_TOKEN }}@download.tarantool.io/enterprise/${{ matrix.sdk-path }}${ARCHIVE_NAME} |
| 66 | + tar -xzf ${ARCHIVE_NAME} |
| 67 | + rm -f ${ARCHIVE_NAME} |
| 68 | +
|
| 69 | + - name: Setup golang for the connector and tests |
| 70 | + uses: actions/setup-go@v3 |
| 71 | + with: |
| 72 | + go-version: 1.13 |
| 73 | + |
| 74 | + - name: Run regression tests |
| 75 | + run: go test -v -shuffle=on -coverprofile=module-coverage.txt -coverpkg=./... ./... |
| 76 | + env: |
| 77 | + TEST_TNT_SSL: ${{matrix.ssl}} |
| 78 | + |
| 79 | + - name: Collect coverage files |
| 80 | + shell: bash |
| 81 | + run: echo "COVERAGES=$(find . -type f -name 'module-coverage.txt' | tr -s '\n' ',' | sed 's/,$//')" >> $GITHUB_ENV |
| 82 | + - name: Upload coverage to Codecov |
| 83 | + uses: codecov/codecov-action@81cd2dc8148241f03f5839d295e000b8f761e378 # v3.1.0 |
| 84 | + with: |
| 85 | + files: '${{ env.COVERAGES }}' |
| 86 | + env_vars: OS=${{ matrix.os }}, GO=${{ matrix.go }} |
| 87 | + |
| 88 | + testing_mac_os: |
| 89 | + # We want to run on external PRs, but not on our own internal |
| 90 | + # PRs as they'll be run by the push to the branch. |
| 91 | + # |
| 92 | + # The main trick is described here: |
| 93 | + # https://github.com/Dart-Code/Dart-Code/pull/2375 |
| 94 | + if: (github.event_name == 'push') || |
| 95 | + (github.event_name == 'pull_request' && |
| 96 | + github.event.pull_request.head.repo.full_name != github.repository) || |
| 97 | + (github.event_name == 'workflow_dispatch') |
| 98 | + |
| 99 | + strategy: |
| 100 | + fail-fast: false |
| 101 | + matrix: |
| 102 | + golang: |
| 103 | + - 1.13 |
| 104 | + runs-on: |
| 105 | + - macos-11 |
| 106 | + - macos-12 |
| 107 | + tarantool: |
| 108 | + - brew |
| 109 | + - 1.10.15 |
| 110 | + |
| 111 | + env: |
| 112 | + # Make sense only for non-brew jobs. |
| 113 | + # |
| 114 | + # Set as absolute paths to avoid any possible confusion |
| 115 | + # after changing a current directory. |
| 116 | + T_VERSION: ${{ matrix.tarantool }} |
| 117 | + T_SRCDIR: ${{ format('{0}/tarantool-{1}', github.workspace, matrix.tarantool) }} |
| 118 | + T_TARDIR: ${{ format('{0}/tarantool-{1}-build', github.workspace, matrix.tarantool) }} |
| 119 | + SRCDIR: ${{ format('{0}/{1}', github.workspace, github.repository) }} |
| 120 | + |
| 121 | + runs-on: ${{ matrix.runs-on }} |
| 122 | + steps: |
| 123 | + - name: Clone the connector |
| 124 | + uses: actions/checkout@v3 |
| 125 | + with: |
| 126 | + path: ${{ env.SRCDIR }} |
| 127 | + |
| 128 | + - name: Restore cache of tarantool ${{ env.T_VERSION }} |
| 129 | + uses: actions/cache@v3 |
| 130 | + id: cache |
| 131 | + with: |
| 132 | + path: ${{ env.T_TARDIR }} |
| 133 | + key: ${{ matrix.runs-on }}-${{ matrix.tarantool }} |
| 134 | + if: matrix.tarantool != 'brew' |
| 135 | + |
| 136 | + - name: Install latest tarantool from brew |
| 137 | + run: brew install tarantool |
| 138 | + if: matrix.tarantool == 'brew' |
| 139 | + |
| 140 | + - name: Clone tarantool ${{ env.T_VERSION }} |
| 141 | + uses: actions/checkout@v3 |
| 142 | + with: |
| 143 | + repository: tarantool/tarantool |
| 144 | + ref: ${{ env.T_VERSION }} |
| 145 | + path: ${{ env.T_TARDIR }} |
| 146 | + submodules: true |
| 147 | + # fetch-depth is 1 by default and it is okay for |
| 148 | + # building from a tag. However we have master in |
| 149 | + # the version list. |
| 150 | + fetch-depth: 0 |
| 151 | + if: matrix.tarantool != 'brew' && steps.cache.outputs.cache-hit != 'true' |
| 152 | + |
| 153 | + - name: Build tarantool ${{ env.T_VERSION }} from sources |
| 154 | + run: | |
| 155 | + cd "${T_TARDIR}" |
| 156 | + # Set RelWithDebInfo just to disable -Werror. |
| 157 | + # |
| 158 | + # There are tarantool releases on which AppleClang |
| 159 | + # complains about the problem that was fixed later in |
| 160 | + # https://github.com/tarantool/tarantool/commit/7e8688ff8885cc7813d12225e03694eb8886de29 |
| 161 | + # |
| 162 | + # Set OpenSSL root directory for linking tarantool with OpenSSL of version 1.1 |
| 163 | + # This is related to #49. There are too much deprecations which affect the build and tests. |
| 164 | + # Must be revisited after fixing https://github.com/tarantool/tarantool/issues/6477 |
| 165 | + cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_DIST=ON -DOPENSSL_ROOT_DIR=/usr/local/opt/[email protected] -DOPENSSL_LIBRARIES=/usr/local/opt/[email protected]/lib |
| 166 | + # {{{ Workaround Mac OS build failure (gh-6076) |
| 167 | + # |
| 168 | + # https://github.com/tarantool/tarantool/issues/6076 |
| 169 | + # |
| 170 | + # In brief: when "src/lib/small" is in include paths, |
| 171 | + # `#include <version>` from inside Mac OS SDK headers |
| 172 | + # attempts to include "src/lib/small/VERSION" as a |
| 173 | + # header file that leads to a syntax error. |
| 174 | + # |
| 175 | + # It was fixed in the following commits: |
| 176 | + # |
| 177 | + # * 1.10.10-24-g7bce4abd1 |
| 178 | + # * 2.7.2-44-gbb1d32903 |
| 179 | + # * 2.8.1-56-ga6c29c5af |
| 180 | + # * 2.9.0-84-gc5ae543f3 |
| 181 | + # |
| 182 | + # However applying the workaround for all versions looks |
| 183 | + # harmless. |
| 184 | + # |
| 185 | + # Added -f just in case: I guess we'll drop this useless |
| 186 | + # obsoleted VERSION file from the git repository sooner |
| 187 | + # or later. |
| 188 | + rm -f src/lib/small/VERSION |
| 189 | + # The same as above, but for the VERSION file generated |
| 190 | + # by tarantool's CMake script. |
| 191 | + rm VERSION |
| 192 | + # }}} Workaround Mac OS build failure (gh-6076) |
| 193 | + # Continue the build. |
| 194 | + make -j$(sysctl -n hw.logicalcpu) |
| 195 | + make install |
| 196 | + if: matrix.tarantool != 'brew' && steps.cache.outputs.cache-hit != 'true' |
| 197 | + |
| 198 | + - name: Install tarantool |
| 199 | + run: | |
| 200 | + cd "${T_TARDIR}" |
| 201 | + make install |
| 202 | + if: matrix.tarantool != 'brew' && steps.cache.outputs.cache-hit == 'true' |
| 203 | + |
| 204 | + - name: Verify tarantool version |
| 205 | + run: | |
| 206 | + # Workaround https://github.com/tarantool/tarantool/issues/4983 |
| 207 | + # Workaround https://github.com/tarantool/tarantool/issues/5040 |
| 208 | + tarantool -e "require('fiber').sleep(0) assert(_TARANTOOL:startswith('${T_VERSION}'), _TARANTOOL) os.exit()" |
| 209 | + if: matrix.tarantool != 'brew' && matrix.tarantool != 'master' |
| 210 | + |
| 211 | + - name: Setup golang for the connector and tests |
| 212 | + uses: actions/setup-go@v3 |
| 213 | + with: |
| 214 | + go-version: ${{ matrix.golang }} |
| 215 | + |
| 216 | + # Workaround for Mac OS 12 testrace failure |
| 217 | + # https://github.com/golang/go/issues/49138 |
| 218 | + - name: disable MallocNanoZone for macos-12 |
| 219 | + run: echo "MallocNanoZone=0" >> $GITHUB_ENV |
| 220 | + if: matrix.runs-on == 'macos-12' |
| 221 | + |
| 222 | + # Workaround issue https://github.com/tarantool/tt/issues/640 |
| 223 | + - name: Fix tt rocks |
| 224 | + if: matrix.tarantool == 'brew' |
| 225 | + run: | |
| 226 | + brew ls --verbose tarantool | grep macosx.lua | xargs rm -f |
| 227 | +
|
| 228 | + - name: Run regression tests |
| 229 | + run: go test -v -shuffle=on -coverprofile=module-coverage.txt -coverpkg=./... ./... |
0 commit comments