Skip to content

Commit 667d117

Browse files
committed
Setup github ci
1 parent 3caaa62 commit 667d117

File tree

2 files changed

+150
-0
lines changed

2 files changed

+150
-0
lines changed

.github/workflows/ci.yml

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- ?.?* # matches to backport branches, e.g. 3.6
8+
tags: [ 'v*' ]
9+
pull_request:
10+
branches:
11+
- master
12+
- ?.?*
13+
schedule:
14+
- cron: '0 6 * * *' # Daily 6AM UTC build
15+
16+
17+
jobs:
18+
19+
lint:
20+
name: Linter
21+
runs-on: ubuntu-latest
22+
timeout-minutes: 5
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v2
26+
- name: Setup Python 3.8
27+
uses: actions/setup-python@v2
28+
with:
29+
python-version: 3.8
30+
- name: Cache PyPI
31+
uses: actions/cache@v2
32+
with:
33+
key: pip-lint-${{ hashFiles('requirements/*.txt') }}
34+
path: ~/.cache/pip
35+
restore-keys: |
36+
pip-lint-
37+
- name: Install dependencies
38+
uses: py-actions/py-dependency-install@v2
39+
with:
40+
path: requirements/flake.txt
41+
- name: Install itself
42+
run: |
43+
python setup.py install
44+
- name: Run flake8
45+
run: |
46+
make flake8
47+
- name: Run isort-check
48+
run: |
49+
make isort-check
50+
- name: Run mypy checker
51+
run: |
52+
make mypy
53+
- name: Install spell checker
54+
run: |
55+
sudo apt install libenchant-dev
56+
pip install -r requirements/doc-spelling.txt
57+
pip install -r requirements/towncrier.txt
58+
- name: Run docs spelling
59+
run: |
60+
towncrier --yes
61+
make doc-spelling
62+
- name: Prepare twine checker
63+
run: |
64+
pip install -U twine wheel
65+
python setup.py sdist bdist_wheel
66+
env:
67+
FROZENLIST_NO_EXTENSIONS: 1
68+
- name: Run twine checker
69+
run: |
70+
twine check dist/*
71+
- name: Make sure that CONTRIBUTORS.txt remains sorted
72+
run: |
73+
LC_ALL=C sort -c CONTRIBUTORS.txt
74+
75+
test:
76+
name: Test
77+
needs: lint
78+
strategy:
79+
matrix:
80+
pyver: [3.6, 3.7, 3.8, 3.9]
81+
os: [ubuntu, macos, windows]
82+
include:
83+
- pyver: pypy3
84+
os: ubuntu
85+
fail-fast: false
86+
runs-on: ${{ matrix.os }}-latest
87+
timeout-minutes: 15
88+
steps:
89+
- name: Checkout
90+
uses: actions/checkout@v2
91+
- name: Setup Python ${{ matrix.pyver }}
92+
uses: actions/setup-python@v2
93+
with:
94+
python-version: ${{ matrix.pyver }}
95+
- name: Get pip cache dir
96+
id: pip-cache
97+
run: |
98+
echo "::set-output name=dir::$(pip cache dir)" # - name: Cache
99+
- name: Cache PyPI
100+
uses: actions/cache@v2
101+
with:
102+
key: pip-ci-${{ runner.os }}-${{ matrix.pyver }}-${{ hashFiles('requirements/*.txt') }}
103+
path: ${{ steps.pip-cache.outputs.dir }}
104+
restore-keys: |
105+
pip-ci-${{ runner.os }}-${{ matrix.pyver }}-
106+
- name: Install dependencies
107+
uses: py-actions/py-dependency-install@v2
108+
with:
109+
path: requirements/dev.txt
110+
- name: Run unittests
111+
env:
112+
COLOR: 'yes'
113+
run: |
114+
python -m pytest tests -vv
115+
python -m coverage xml
116+
- name: Upload coverage
117+
uses: codecov/codecov-action@v1
118+
with:
119+
token: ${{ secrets.CODECOV_TOKEN }}
120+
file: ./coverage.xml
121+
flags: unit
122+
fail_ci_if_error: false
123+
124+
deploy:
125+
name: Deploy
126+
runs-on: ubuntu-latest
127+
needs: test
128+
# Run only on pushing a tag
129+
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
130+
steps:
131+
- name: Checkout
132+
uses: actions/checkout@v2
133+
- name: Setup Python 3.8
134+
uses: actions/setup-python@v2
135+
with:
136+
python-version: 3.8
137+
- name: Install dependencies
138+
run:
139+
python -m pip install --update pip wheel twine
140+
- name: Make dists
141+
run:
142+
python setup.py sdist bdist_wheel
143+
- name: PyPI upload
144+
env:
145+
TWINE_USERNAME: __token__
146+
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
147+
run: |
148+
twine upload dist/*

setup.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ def read(f):
4040
'Programming Language :: Python :: 3',
4141
'Programming Language :: Python :: 3.6',
4242
'Programming Language :: Python :: 3.7',
43+
'Programming Language :: Python :: 3.8',
44+
'Programming Language :: Python :: 3.9',
4345
'Development Status :: 5 - Production/Stable',
4446
'Operating System :: POSIX',
4547
'Operating System :: MacOS :: MacOS X',

0 commit comments

Comments
 (0)