-
Notifications
You must be signed in to change notification settings - Fork 4
91 lines (87 loc) · 2.77 KB
/
test.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
name: Test
on:
- push
- pull_request
jobs:
test:
name: Test (${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- python-version: '2.7'
package-features: 'tar.xz,iso'
- python-version: '3.5'
package-features: 'tar.xz,iso'
- python-version: '3.6'
package-features: 'tar.xz,iso,7z'
- python-version: '3.7'
package-features: 'tar.xz,iso,7z'
- python-version: '3.8'
package-features: 'tar.xz,iso,7z'
- python-version: '3.9'
package-features: 'tar.xz,iso,7z'
- python-version: '3.10'
package-features: 'tar.xz,iso,7z'
steps:
- name: Checkout code
uses: actions/checkout@v1
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Update pip
run: python -m pip install -U pip wheel setuptools
- name: Install test dependencies
run: python -m pip install -U -r tests/requirements.txt
- name: Install local code
run: python -m pip install '.[${{ matrix.package-features }}]'
- name: Test with coverage
run: python -m coverage run -m unittest discover -vv
- name: Report coverage
run: python -m coverage report
- name: Export coverage statistics
run: python -m coverage xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
flags: ${{ matrix.python-version }},${{ matrix.package-features }}
name: test-python-${{ matrix.python-version }}
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
package:
environment: PyPI
runs-on: ubuntu-latest
name: Deploy (PyPI)
needs: test
if: "startsWith(github.ref, 'refs/tags/v')"
steps:
- name: Checkout code
uses: actions/checkout@v1
- name: Set up Python 3.10
uses: actions/setup-python@v1
with:
python-version: '3.10'
- name: Install build package
run: python -m pip install -U build
- name: Build a wheel and source tarball
run: python -m build --sdist --wheel --outdir dist
- name: Publish distributions to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
release:
environment: GitHub Releases
runs-on: ubuntu-latest
needs: package
if: "startsWith(github.ref, 'refs/tags/v')"
name: Release
steps:
- name: Checkout code
uses: actions/checkout@v1
- name: Release a Changelog
uses: rasmus-saks/[email protected]
with:
github-token: '${{ secrets.GITHUB_TOKEN }}'