@@ -3,16 +3,19 @@ name: testing
33on :
44 push :
55 pull_request :
6+ pull_request_target :
7+ types : [labeled]
68
79jobs :
8- run_tests_linux :
10+ run_tests_ce_linux :
911 # We want to run on external PRs, but not on our own internal
1012 # PRs as they'll be run by the push to the branch.
1113 #
1214 # The main trick is described here:
1315 # https://github.com/Dart-Code/Dart-Code/pull/2375
14- if : github.event_name == 'push' ||
15- github.event.pull_request.head.repo.full_name != github.repository
16+ if : (github.event_name == 'push') ||
17+ (github.event_name == 'pull_request' &&
18+ github.event.pull_request.head.repo.full_name != github.repository)
1619
1720 runs-on : ubuntu-20.04
1821
@@ -97,14 +100,96 @@ jobs:
97100 - name : Run tests
98101 run : make test
99102
100- run_tests_windows :
103+ run_tests_ee_linux :
104+ # The same as for run_tests_ce_linux, but it does not run on pull requests
105+ # from forks by default. Tests will run only when the pull request is
106+ # labeled with `full-ci`. To avoid security problems, the label must be
107+ # reset manually for every run.
108+ #
109+ # We need to use `pull_request_target` because it has access to base
110+ # repository secrets unlike `pull_request`.
111+ if : (github.event_name == 'push') ||
112+ (github.event_name == 'pull_request_target' &&
113+ github.event.pull_request.head.repo.full_name != github.repository &&
114+ github.event.label.name == 'full-ci')
115+
116+ runs-on : ubuntu-20.04
117+
118+ strategy :
119+ fail-fast : false
120+ matrix :
121+ python : ['3.5', '3.6', '3.7', '3.8', '3.9', '3.10']
122+ msgpack-deps :
123+ # latest msgpack will be installed as a part of requirements.txt
124+ - ' '
125+ include :
126+ - tarantool : ' 1.10.11-0-gf0b0e7ecf-r470'
127+ ssl : false
128+ - tarantool : ' 2.8.3-21-g7d35cd2be-r470'
129+ ssl : false
130+ - tarantool : ' 2.10.0-1-gfa775b383-r486-linux-x86_64'
131+ ssl : true
132+
133+ steps :
134+ - name : Clone the connector
135+ uses : actions/checkout@v2
136+ # This is needed for pull_request_target because this event runs in the
137+ # context of the base commit of the pull request. It works fine for
138+ # `push` and `workflow_dispatch` because the default behavior is used
139+ # if `ref` and `repository` are empty.
140+ with :
141+ ref : ${{github.event.pull_request.head.ref}}
142+ repository : ${{github.event.pull_request.head.repo.full_name}}
143+
144+ - name : Install tarantool ${{ matrix.tarantool }}
145+ run : |
146+ ARCHIVE_NAME=tarantool-enterprise-bundle-${{ matrix.tarantool }}.tar.gz
147+ curl -O -L https://${{ secrets.SDK_DOWNLOAD_TOKEN }}@download.tarantool.io/enterprise/${ARCHIVE_NAME}
148+ tar -xzf ${ARCHIVE_NAME}
149+ rm -f ${ARCHIVE_NAME}
150+
151+ - name : Setup Python for tests
152+ uses : actions/setup-python@v2
153+ with :
154+ python-version : ${{ matrix.python }}
155+
156+ - name : Install specific version of msgpack package
157+ if : startsWith(matrix.msgpack-deps, 'msgpack==') == true
158+ run : |
159+ pip install ${{ matrix.msgpack-deps }}
160+
161+ - name : Install specific version of msgpack-python package
162+ # msgpack package is a replacement for deprecated msgpack-python.
163+ # To test compatibility with msgpack-python we must ignore
164+ # requirements.txt install of msgpack package by overwriting it
165+ # with sed.
166+ if : startsWith(matrix.msgpack-deps, 'msgpack-python==') == true
167+ run : |
168+ pip install ${{ matrix.msgpack-deps }}
169+ sed -i -e "s/^msgpack.*$/${{ matrix.msgpack-deps }}/" requirements.txt
170+
171+ - name : Install package requirements
172+ run : pip install -r requirements.txt
173+
174+ - name : Install test requirements
175+ run : pip install -r requirements-test.txt
176+
177+ - name : Run tests
178+ run : |
179+ source tarantool-enterprise/env.sh
180+ make test
181+ env :
182+ TEST_TNT_SSL : ${{matrix.ssl}}
183+
184+ run_tests_ce_windows :
101185 # We want to run on external PRs, but not on our own internal
102186 # PRs as they'll be run by the push to the branch.
103187 #
104188 # The main trick is described here:
105189 # https://github.com/Dart-Code/Dart-Code/pull/2375
106190 if : github.event_name == 'push' ||
107- github.event.pull_request.head.repo.full_name != github.repository
191+ (github.event_name == 'pull_request' &&
192+ github.event.pull_request.head.repo.full_name != github.repository)
108193
109194 runs-on : windows-2022
110195
0 commit comments