Skip to content

Commit 6044d4b

Browse files
ci: setup GitHub Actions testing pipeline
Before this patch, tarantool/tarantool-python CI was based on Travis CI (Linux runs) and Appveyor (Windows runs). This PR introduces GitHub Actions workflow files for both Linux and Windows test runs. Pipelines run for different supported tarantool, Python and msgpack package versions to ensure compatibility. tarantool instance is started in each Windows pipeline under WSL to run tests instead of using an external server (like in Appveyor). Since we start a new tarantool instance for each run, clean() procedure was removed. (The main reason to remove it was failing with "ER_DROP_FUNCTION: Can't drop function 1: function is SQL built-in" error on newer 2.x on bootstrap.) Testing pipeline for tarantool artifacts was also updated. Travis CI and Appveyor badges were replaced with GitHub Actions badge. Closes #182
1 parent 9226f91 commit 6044d4b

File tree

2 files changed

+171
-5
lines changed

2 files changed

+171
-5
lines changed

Diff for: .github/workflows/testing.yml

+169
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
name: testing
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
run_tests_linux:
9+
# We want to run on external PRs, but not on our own internal
10+
# PRs as they'll be run by the push to the branch.
11+
#
12+
# The main trick is described here:
13+
# 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+
17+
runs-on: ubuntu-20.04
18+
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
tarantool:
23+
- '1.10'
24+
- '2.8'
25+
- '2.9'
26+
- '2.x-latest'
27+
python:
28+
- '2.7'
29+
- '3.5'
30+
- '3.6'
31+
- '3.7'
32+
- '3.8'
33+
- '3.9'
34+
- '3.10'
35+
msgpack-deps:
36+
# latest msgpack will be installed as a part of requirements.txt
37+
- ''
38+
39+
# Adding too many elements to three-dimentional matrix results in
40+
# too many test cases. It causes GitHub webpages to fail with
41+
# "This page is taking too long to load." error. Thus we use
42+
# pairwise testing.
43+
include:
44+
- tarantool: '2.8'
45+
python: '3.10'
46+
msgpack-deps: 'msgpack-python==0.4.0'
47+
- tarantool: '2.8'
48+
python: '3.10'
49+
msgpack-deps: 'msgpack==0.5.0'
50+
- tarantool: '2.8'
51+
python: '3.10'
52+
msgpack-deps: 'msgpack==0.6.2'
53+
- tarantool: '2.8'
54+
python: '3.10'
55+
msgpack-deps: 'msgpack==1.0.0'
56+
57+
steps:
58+
- name: Clone the connector
59+
uses: actions/checkout@v2
60+
61+
- name: Install tarantool ${{ matrix.tarantool }}
62+
if: matrix.tarantool != '2.x-latest'
63+
uses: tarantool/setup-tarantool@v1
64+
with:
65+
tarantool-version: ${{ matrix.tarantool }}
66+
67+
- name: Install latest tarantool 2.x
68+
if: matrix.tarantool == '2.x-latest'
69+
run: |
70+
curl -L https://tarantool.io/pre-release/2/installer.sh | sudo bash
71+
sudo apt install -y tarantool tarantool-dev
72+
73+
- name: Setup Python for tests
74+
uses: actions/setup-python@v2
75+
with:
76+
python-version: ${{ matrix.python }}
77+
78+
- name: Install connection requirements (msgpack package)
79+
if: startsWith(matrix.msgpack-deps, 'msgpack-python==') == false
80+
run: |
81+
pip install ${{ matrix.msgpack-deps }}
82+
pip install -r requirements.txt
83+
84+
85+
- name: Install connection requirements (msgpack-python package)
86+
# msgpack package is a replacement for deprecated msgpack-python.
87+
# To test compatibility with msgpack-python we must ignore
88+
# requirements.txt install of msgpack package by overwriting it
89+
# with sed.
90+
if: startsWith(matrix.msgpack-deps, 'msgpack-python==') == true
91+
run: |
92+
pip install ${{ matrix.msgpack-deps }}
93+
sed -i -e "s/^msgpack.*$/${{ matrix.msgpack-deps }}/" requirements.txt
94+
pip install -r requirements.txt
95+
96+
- name: Install test requirements
97+
run: pip install -r requirements-test.txt
98+
99+
- name: Run tests
100+
run: make test
101+
102+
run_tests_windows:
103+
# We want to run on external PRs, but not on our own internal
104+
# PRs as they'll be run by the push to the branch.
105+
#
106+
# The main trick is described here:
107+
# https://github.com/Dart-Code/Dart-Code/pull/2375
108+
if: github.event_name == 'push' ||
109+
github.event.pull_request.head.repo.full_name != github.repository
110+
111+
runs-on: windows-2022
112+
113+
strategy:
114+
fail-fast: false
115+
matrix:
116+
tarantool:
117+
- '1.10'
118+
- '2.8'
119+
python:
120+
- '2.7'
121+
- '3.10'
122+
123+
steps:
124+
- name: Clone the connector
125+
uses: actions/checkout@v2
126+
127+
- name: Setup Python for tests
128+
uses: actions/setup-python@v2
129+
with:
130+
python-version: ${{ matrix.python }}
131+
132+
- name: Install connector requirements
133+
run: pip install -r requirements.txt
134+
135+
- name: Install test requirements
136+
run: pip install -r requirements-test.txt
137+
138+
- name: Setup WSL for tarantool
139+
uses: Vampire/setup-wsl@v1
140+
with:
141+
distribution: Ubuntu-20.04
142+
143+
- name: Install tarantool ${{ matrix.tarantool }} for WSL
144+
if: matrix.tarantool != '2.x-latest'
145+
shell: wsl-bash_Ubuntu-20.04 {0}
146+
run: |
147+
curl -L https://tarantool.io/installer.sh | VER=${{ matrix.tarantool }} bash -s -- --type "release"
148+
sudo apt install -y tarantool tarantool-dev
149+
150+
- name: Setup test tarantool instance
151+
shell: wsl-bash_Ubuntu-20.04 {0}
152+
run: |
153+
rm -f ./tarantool.pid ./tarantool.log
154+
TNT_PID=$(tarantool ./test/suites/lib/tarantool_python_ci.lua > tarantool.log 2>&1 & echo $!)
155+
touch tarantool.pid
156+
echo $TNT_PID > ./tarantool.pid
157+
158+
- name: Run tests
159+
env:
160+
REMOTE_TARANTOOL_HOST: localhost
161+
REMOTE_TARANTOOL_CONSOLE_PORT: 3302
162+
run: make test
163+
164+
- name: Stop test tarantool instance
165+
if: ${{ always() }}
166+
shell: wsl-bash_Ubuntu-20.04 {0}
167+
run: |
168+
cat tarantool.log || true
169+
kill $(cat tarantool.pid) || true

Diff for: README.rst

+2-5
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,8 @@ This package is a pure-python client library for `Tarantool`_.
1111
.. _`GitHub`: https://github.com/tarantool/tarantool-python
1212
.. _`Issue tracker`: https://github.com/tarantool/tarantool-python/issues
1313

14-
.. image:: https://travis-ci.org/tarantool/tarantool-python.svg?branch=master
15-
:target: https://travis-ci.org/tarantool/tarantool-python
16-
17-
.. image:: https://ci.appveyor.com/api/projects/status/github/tarantool/tarantool-python?branch=master
18-
:target: https://ci.appveyor.com/project/tarantool/tarantool-python
14+
.. image:: https://github.com/tarantool/tarantool-python/actions/workflows/testing.yml/badge.svg?branch=master
15+
:target: https://github.com/tarantool/tarantool-python/actions/workflows/testing.yml
1916

2017
Download and Install
2118
--------------------

0 commit comments

Comments
 (0)