-
-
Notifications
You must be signed in to change notification settings - Fork 183
126 lines (119 loc) · 3.23 KB
/
python-package.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
name: CI
on:
push:
branches:
- 'master'
tags: [ '[0-9]+.[0-9]+.[0-9]+' ]
pull_request:
branches:
- 'master'
- '[0-9].[0-9]+.[0-9]+'
env:
FORCE_COLOR: 1
jobs:
test:
name: Test Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
include:
- aiohttp-version: '==3.7.4.post0'
- aiohttp-version: '<4.0.0'
python-version: '3.11'
fail-fast: false
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
- name: Setup Python ${{ matrix.pyver }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Lock and sync dependencies
env:
AIOHTTP_VERSION: ${{ matrix.aiohttp-version }}
run: |
python -c "import sys; print(f'Python version: {sys.version}')"
python -m pip install -U setuptools pip codecov wheel pip-tools
time pip-compile requirements-dev.in
time pip-sync requirements-dev.txt
- name: Run flake
if: matrix.python-version == '3.11'
run: |
make flake
- name: Run unittests
env:
COLOR: 'yes'
run: |
make mototest
- name: Upload coverage to Codecov
if: matrix.python-version == '3.11'
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
files: ./coverage.xml
flags: unittests # optional
name: codecov-umbrella # optional
fail_ci_if_error: true # optional (default = false)
path_to_write_report: ./codecov_report.txt
verbose: true # optional (default = false)
pre-deploy:
name: Pre-Deploy
runs-on: ubuntu-latest
needs: test
# Run only on pushing a tag
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
steps:
- name: Dummy
run: |
echo "Predeploy step"
build-tarball:
name: Tarball
runs-on: ubuntu-latest
needs: pre-deploy
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
- name: Setup Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Make distributions (sdist and wheel)
run: |
python -c "import sys; print(f'Python version: {sys.version}')"
python -m pip install -U setuptools pip wheel
python setup.py sdist bdist_wheel
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: dist
path: dist
deploy:
name: Deploy
needs: [build-tarball]
runs-on: ubuntu-latest
steps:
- name: Setup Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install twine
run: |
python -m pip install twine
- name: Download dists
uses: actions/download-artifact@v3
with:
name: dist
path: dist
- name: PyPI upload
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
twine upload dist/*