-
Notifications
You must be signed in to change notification settings - Fork 0
112 lines (94 loc) · 2.86 KB
/
test.yaml
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
on:
push:
paths:
- '**.py'
- '.github/workflows/**.yaml'
- 'setup.cfg'
- 'pyproject.toml'
pull_request:
paths:
- '**.py'
- '.github/workflows/**.yaml'
- 'setup.cfg'
- 'pyproject.toml'
workflow_dispatch:
jobs:
lint:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Installing Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Installing tools and dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install .[dev,test]
- name: Linting
run: |
python -m black --check calct tests
python -m isort --check-only calct tests
python -m mypy -p calct -p tests
python -m flake8 calct tests
python -m pylint calct tests
test:
needs: lint
strategy:
matrix:
os: [ubuntu-22.04, ubuntu-20.04, windows-latest, macos-latest]
python-version: ["3.9", "3.10", "3.11", "pypy3.9"]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Installing Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Installing tools and dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install .[dev,test]
- name: Executing tests
run: python -m pytest -v --cov-report=html:./coverage_html
- name: Uploading coverage
uses: actions/upload-artifact@v3
with:
name: coverage_${{ matrix.python-version }}_${{ matrix.os }}
path: ./coverage_html
release:
needs: test
runs-on: ubuntu-22.04
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Installing Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Installing tools and dependencies
run: |
python -m pip install --upgrade pip setuptools wheel twine build
- name: Build
run: |
python -m build
- name: Install wheel
run: |
python -m pip install $(find -wholename ./dist/*.whl)[test]
- name: Executing tests on build
run: |
python -m pytest -v --no-cov
- name: Releasing to GitHub
uses: softprops/action-gh-release@v1
with:
files: './dist/*'
fail_on_unmatched_files: true
generate_release_notes: true
- name: Deploying to PyPI
run: |
python -m twine upload ./dist/* -u '__token__' -p "${{ secrets.PYPI_TOKEN }}"