Skip to content

Commit 0d8ea0a

Browse files
committed
github-actions: add action to test python2 support
1 parent 4b34b16 commit 0d8ea0a

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

.github/workflows/test-python2.yaml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Build and test python2
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
test:
7+
name: Test on python2
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v3
11+
12+
- uses: actions/setup-python@v4
13+
name: Install Python2.7
14+
with:
15+
python-version: '2.7'
16+
- name: Run unittests
17+
run: |-
18+
pip install -r ./test-requirements.txt
19+
pytest --import-mode append ./tests/unit -k 'not (test_connection_initialization or test_cloud)'
20+
EVENT_LOOP_MANAGER=gevent pytest --import-mode append ./tests/unit/io/test_geventreactor.py
21+
EVENT_LOOP_MANAGER=eventlet pytest --import-mode append ./tests/unit/io/test_eventletreactor.py
22+
23+
build:
24+
name: Build source/wheel distribution for python2
25+
if: "(!contains(github.event.pull_request.labels.*.name, 'disable-test-build'))|| github.event_name == 'push' && endsWith(github.event.ref, 'scylla')"
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@v3
29+
30+
- uses: actions/setup-python@v4
31+
name: Install Python2.7
32+
with:
33+
python-version: '2.7'
34+
35+
- name: Build sdist
36+
run: python setup.py sdist
37+
38+
- uses: actions/upload-artifact@v2
39+
with:
40+
path: dist/*.tar.gz
41+
42+
upload_pypi:
43+
needs: [build, test]
44+
runs-on: ubuntu-latest
45+
# upload to PyPI on every tag starting with 'v'
46+
if: github.event_name == 'push' && endsWith(github.event.ref, 'scylla')
47+
# alternatively, to publish when a GitHub Release is created, use the following rule:
48+
# if: github.event_name == 'release' && github.event.action == 'published'
49+
steps:
50+
- uses: actions/download-artifact@v2
51+
with:
52+
name: artifact
53+
path: dist
54+
55+
- uses: pypa/gh-action-pypi-publish@master
56+
with:
57+
user: __token__
58+
password: ${{ secrets.PYPI_API_TOKEN }}
59+

0 commit comments

Comments
 (0)