-
-
Notifications
You must be signed in to change notification settings - Fork 2
118 lines (113 loc) · 3.42 KB
/
Copy pathtox.yml
File metadata and controls
118 lines (113 loc) · 3.42 KB
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
name: tox
on:
create: # is used for publishing to PyPI and TestPyPI
tags: # any tag regardless of its name, no branches
push: # only publishes pushes to the main branch to TestPyPI
branches: # any integration branch but not tag
- "master"
tags-ignore:
- "**"
pull_request:
schedule:
- cron: 1 0 * * * # Run daily at 0:01 UTC
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@master
with:
python-version: "3.x"
- name: run lint
run: |
python -m pip install -U tox
tox -e lint
test:
needs: lint
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python: ["3.6", "3.7", "3.8", "3.9"]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@master
with:
python-version: ${{ matrix.python }}
- name: run test
run: |
python -m pip install tox
tox -e py$(printf "${{ matrix.python }}" | tr -d '.')
env:
COVERAGE_FILE: .tox/.coverage.${{ matrix.python }}.db
- name: upload artifacts
uses: actions/upload-artifact@v2
with:
name: coverage-results
path: .tox/.coverage.*
coverage:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@master
with:
python-version: "3.x"
- uses: actions/download-artifact@v2
with:
name: coverage-results
path: .tox
- name: run coverage
run: |
python3 -m pip install tox codecov
python3 -m tox -e coverage
codecov -X pycov -X gcov --root .tox/coverage/log
env:
CODECOV_TOKEN: ${{ secrets.codecov_token }}
publish:
needs: coverage
if: startsWith(github.ref, 'refs/tags/') # Only release during tags
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@master
with:
python-version: "3.x"
- name: build
run: |
python -m pip install -U pip setuptools
pip install -U wheel
python setup.py build sdist bdist_wheel
- name: get tag name
id: get_tag
run: echo ::set-output name=TAG::${GITHUB_REF#refs/tags/}
- name: GitHub Release
uses: ncipollo/release-action@v1
with:
artifacts: dist/*.whl, dist/*.tar.gz
allowUpdates: true
name: Release ${{ steps.get_tag.outputs.TAG }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to test.pypi.org
if: >-
(
github.event_name == 'push' &&
github.ref == format(
'refs/heads/{0}', github.event.repository.default_branch
)
) ||
(
github.event_name == 'create' &&
github.event.ref_type == 'tag'
)
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.testpypi_password }}
repository_url: https://test.pypi.org/legacy/
- name: Publish to pypi.org
if: >- # "create" workflows run separately from "push" & "pull_request"
github.event_name == 'create' &&
github.event.ref_type == 'tag'
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.pypi_password }}