Skip to content

Commit fd48227

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 fa087e9 commit fd48227

File tree

2 files changed

+170
-5
lines changed

2 files changed

+170
-5
lines changed

Diff for: .github/workflows/testing.yml

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