Skip to content

Commit 90197b4

Browse files
committed
Add Github Actions
Signed-off-by: Bernát Gábor <[email protected]>
1 parent d129ae7 commit 90197b4

File tree

1 file changed

+94
-0
lines changed

1 file changed

+94
-0
lines changed

.github/workflows/check.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: check
2+
on:
3+
push:
4+
pull_request:
5+
6+
jobs:
7+
lint:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v2
12+
- uses: actions/setup-python@v2
13+
- uses: pre-commit/[email protected]
14+
15+
test:
16+
name: ${{ matrix.py }}
17+
runs-on: Ubuntu-latest
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
py:
22+
- 3.9
23+
- 3.8
24+
- 3.7
25+
- 3.6
26+
- pypy3
27+
28+
steps:
29+
- uses: actions/checkout@v2
30+
- name: setup python for tox
31+
uses: actions/setup-python@v2
32+
with:
33+
python-version: 3.9
34+
- name: install tox
35+
run: python -m pip install tox
36+
- name: setup python for test ${{ matrix.py }}
37+
uses: actions/setup-python@v2
38+
with:
39+
python-version: ${{ matrix.py }}
40+
- name: Pick environment to run
41+
run: |
42+
import platform; import os; import sys; import codecs
43+
cpy = platform.python_implementation() == "CPython"
44+
base =("{}{}{}" if cpy else "{}{}").format("py" if cpy else "pypy", *sys.version_info[0:2])
45+
env = "TOXENV={}\n".format(base)
46+
print("Picked:\n{}for{}".format(env, sys.version))
47+
with codecs.open(os.environ["GITHUB_ENV"], "a", "utf-8") as file_handler:
48+
file_handler.write(env)
49+
shell: python
50+
- name: setup test suite for ${{ matrix.py }}
51+
run: tox -vv --notest
52+
- name: run test suite for ${{ matrix.py }}
53+
run: tox --skip-pkg-install
54+
55+
check:
56+
name: check ${{ matrix.tox_env }}
57+
runs-on: Ubuntu-latest
58+
strategy:
59+
fail-fast: false
60+
matrix:
61+
tox_env:
62+
- pkg_desc
63+
64+
steps:
65+
- uses: actions/checkout@v2
66+
- name: setup Python 3.9
67+
uses: actions/setup-python@v2
68+
with:
69+
python-version: 3.9
70+
- name: install tox
71+
run: python -m pip install tox
72+
- name: run check for ${{ matrix.tox_env }}
73+
run: python -m tox -e ${{ matrix.tox_env }}
74+
75+
publish:
76+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
77+
needs: [ check, test, lint ]
78+
runs-on: ubuntu-latest
79+
steps:
80+
- name: setup python to build package
81+
uses: actions/setup-python@v2
82+
with:
83+
python-version: 3.9
84+
- name: install build
85+
run: python -m pip install build
86+
- uses: actions/checkout@v2
87+
- name: build package
88+
run: python -m build --sdist --wheel . -o dist
89+
- name: publish to PyPi
90+
uses: pypa/gh-action-pypi-publish@master
91+
with:
92+
skip_existing: true
93+
user: __token__
94+
password: ${{ secrets.pypi_password }}

0 commit comments

Comments
 (0)