|
| 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 | + env: |
| 30 | + COVERAGE_FILE: 'coverage.out' |
| 31 | + |
| 32 | + strategy: |
| 33 | + fail-fast: false |
| 34 | + matrix: |
| 35 | + golang: |
| 36 | + - '1.20' |
| 37 | + - 'stable' |
| 38 | + sdk-path: |
| 39 | + - 'release/linux/x86_64/2.10/' |
| 40 | + sdk-version: |
| 41 | + - 'sdk-gc64-2.10.8-0-r598.linux.x86_64' |
| 42 | + coveralls: [ false ] |
| 43 | + include: |
| 44 | + - golang: '1.20' |
| 45 | + sdk-path: 'release/linux/x86_64/2.11/' |
| 46 | + sdk-version: 'sdk-gc64-2.11.1-0-r598.linux.x86_64' |
| 47 | + coveralls: false |
| 48 | + - golang: 'stable' |
| 49 | + sdk-path: 'release/linux/x86_64/2.11/' |
| 50 | + sdk-version: 'sdk-gc64-2.11.1-0-r598.linux.x86_64' |
| 51 | + coveralls: false |
| 52 | + - golang: '1.20' |
| 53 | + sdk-path: 'release/linux/x86_64/3.0/' |
| 54 | + sdk-version: 'sdk-gc64-3.0.0-0-gf58f7d82a-r23.linux.x86_64' |
| 55 | + coveralls: false |
| 56 | + - golang: 'stable' |
| 57 | + sdk-path: 'release/linux/x86_64/3.0/' |
| 58 | + sdk-version: 'sdk-gc64-3.0.0-0-gf58f7d82a-r23.linux.x86_64' |
| 59 | + coveralls: true |
| 60 | + |
| 61 | + steps: |
| 62 | + - uses: actions/checkout@v3 |
| 63 | + |
| 64 | + - name: Setup Tarantool ${{ matrix.sdk-version }} |
| 65 | + run: | |
| 66 | + ARCHIVE_NAME=tarantool-enterprise-${{ matrix.sdk-version }}.tar.gz |
| 67 | + curl -O -L https://${{ secrets.SDK_DOWNLOAD_TOKEN }}@download.tarantool.io/enterprise/${{ matrix.sdk-path }}${ARCHIVE_NAME} |
| 68 | + tar -xzf ${ARCHIVE_NAME} |
| 69 | + rm -f ${ARCHIVE_NAME} |
| 70 | +
|
| 71 | + - name: Setup golang for the connector and tests |
| 72 | + uses: actions/setup-go@v3 |
| 73 | + with: |
| 74 | + go-version: ${{matrix.golang}} |
| 75 | + |
| 76 | + - name: Run regression tests |
| 77 | + run: | |
| 78 | + source tarantool-enterprise/env.sh |
| 79 | + go test -v -count=1 -shuffle=on ./... |
| 80 | + go test -race -v -count=1 -shuffle=on ./... |
| 81 | +
|
| 82 | + - name: Run tests, collect code coverage data and send to Coveralls |
| 83 | + if: ${{ matrix.coveralls }} |
| 84 | + env: |
| 85 | + COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 86 | + run: | |
| 87 | + source tarantool-enterprise/env.sh |
| 88 | + go clean -testcache |
| 89 | + go get golang.org/x/tools/cmd/cover |
| 90 | + go test ./... -v -count=1 -shuffle=on -covermode=atomic -coverprofile=${COVERAGE_FILE} |
| 91 | + go tool cover -func=${COVERAGE_FILE} |
| 92 | + go get github.com/mattn/goveralls |
| 93 | + go install github.com/mattn/goveralls |
| 94 | + goveralls -coverprofile=${COVERAGE_FILE} -service=github |
| 95 | +
|
| 96 | + testing_mac_os: |
| 97 | + # We want to run on external PRs, but not on our own internal |
| 98 | + # PRs as they'll be run by the push to the branch. |
| 99 | + # |
| 100 | + # The main trick is described here: |
| 101 | + # https://github.com/Dart-Code/Dart-Code/pull/2375 |
| 102 | + if: | |
| 103 | + github.repository == 'tarantool/go-tlsdialer' && |
| 104 | + (github.event_name == 'push' || |
| 105 | + (github.event_name == 'pull_request_target' && |
| 106 | + github.event.pull_request.head.repo.full_name != github.repository && |
| 107 | + github.event.label.name == 'full-ci')) || |
| 108 | + github.event_name == 'workflow_dispatch' |
| 109 | +
|
| 110 | + strategy: |
| 111 | + fail-fast: false |
| 112 | + matrix: |
| 113 | + golang: |
| 114 | + - '1.20' |
| 115 | + - 'stable' |
| 116 | + runs-on: |
| 117 | + - macos-11 |
| 118 | + - macos-12 |
| 119 | + tarantool-ee: |
| 120 | + - 'gc64-2.11.2-0-r613' |
| 121 | + |
| 122 | + env: |
| 123 | + # Set as absolute paths to avoid any possible confusion |
| 124 | + # after changing a current directory. |
| 125 | + SRCDIR: ${{ format('{0}/{1}', github.workspace, github.repository) }} |
| 126 | + |
| 127 | + runs-on: ${{ matrix.runs-on }} |
| 128 | + steps: |
| 129 | + - name: Clone the connector |
| 130 | + uses: actions/checkout@v3 |
| 131 | + with: |
| 132 | + path: ${{ env.SRCDIR }} |
| 133 | + |
| 134 | + - name: Install latest tt from brew |
| 135 | + run: brew install tt |
| 136 | + |
| 137 | + - name: Install tarantool |
| 138 | + env: |
| 139 | + TT_CLI_EE_USERNAME: ${{ secrets.TT_EE_USERNAME }} |
| 140 | + TT_CLI_EE_PASSWORD: ${{ secrets.TT_EE_PASSWORD }} |
| 141 | + run: | |
| 142 | + tt init |
| 143 | + tt -V install tarantool-ee ${{ matrix.tarantool-ee }} |
| 144 | + # Delete the tt config so that it does not affect the test environment. |
| 145 | + rm -f tt.yaml |
| 146 | +
|
| 147 | + - name: Add Tarantool to Path |
| 148 | + run: | |
| 149 | + echo "${GITHUB_WORKSPACE}/bin" >> $GITHUB_PATH |
| 150 | +
|
| 151 | + - name: Set Tarantool include directory to the environment |
| 152 | + run: | |
| 153 | + echo "TT_CLI_TARANTOOL_PREFIX=${GITHUB_WORKSPACE}/include/" >> $GITHUB_ENV |
| 154 | +
|
| 155 | + - name: Setup golang for the connector and tests |
| 156 | + uses: actions/setup-go@v3 |
| 157 | + with: |
| 158 | + go-version: ${{ matrix.golang }} |
| 159 | + |
| 160 | + # Workaround for Mac OS 12 testrace failure |
| 161 | + # https://github.com/golang/go/issues/49138 |
| 162 | + - name: disable MallocNanoZone for macos-12 |
| 163 | + run: echo "MallocNanoZone=0" >> $GITHUB_ENV |
| 164 | + if: matrix.runs-on == 'macos-12' |
| 165 | + |
| 166 | + - name: Install test dependencies |
| 167 | + run: | |
| 168 | + brew install tt |
| 169 | +
|
| 170 | + - name: Run regression tests |
| 171 | + run: | |
| 172 | + cd "${SRCDIR}" |
| 173 | + go test -v -count=1 -shuffle=on ./... |
| 174 | + go test -race -v -count=1 -shuffle=on ./... |
0 commit comments