-
Notifications
You must be signed in to change notification settings - Fork 10
127 lines (118 loc) · 3.89 KB
/
pythonpackage.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
name: Python package
on: [push, pull_request]
jobs:
lint:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9, "3.10", "3.11"]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install '.[dev]'
- name: Lint with flake8
run: |
pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Sort imports with isort
run: isort --diff --check .
- name: Format using black
run: black --check .
- name: Run mypy
run: mypy --strict aiocouch tests examples
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9, "3.10", "3.11"]
couchdb: ["2.3", "3.1", "3.2"]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install '.[tests]'
- name: Test with pytest
run: |
python -m pytest --cov-report xml --cov aiocouch
env:
COUCHDB_USER: admin
COUCHDB_PASS: password
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
if: ${{ matrix.python-version == '3.9' && matrix.couchdb == '3.1' }}
with:
name: Python ${{ matrix.python-version }}
services:
couchdb:
image: couchdb:${{ matrix.couchdb }}
ports:
- 5984:5984
env:
COUCHDB_USER: admin
COUCHDB_PASSWORD: password
documentation:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v1
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install '.[docs]'
- name: Build documentation
run: make html
working-directory: docs
artifacts:
needs: [lint, documentation, test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v1
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install wheel
pip install .
- name: Build Python distribution
run: python setup.py sdist bdist_wheel
- name: Upload distribution artifacts
uses: actions/upload-artifact@v1
with:
name: distribution-packages
path: dist/
- name: Publish to PyPI
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
- name: Create Release
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false