-
Notifications
You must be signed in to change notification settings - Fork 114
134 lines (114 loc) · 3.61 KB
/
build_and_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
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
128
129
130
131
132
133
134
---
name: build_and_test
on: # yamllint disable-line rule:truthy
pull_request:
branches:
- master
push:
branches:
- master
jobs:
# Only lint in one platform to save compute time
linter:
runs-on: ${{ matrix.platform }}
strategy:
matrix:
platform: [ubuntu-latest]
python-version: ["3.10"]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
shell: bash
- name: Linter
run: |
python -m pip install flake8
flake8 .
build_and_test:
name: Build & Test
runs-on: ${{ matrix.platform }}
needs: [linter]
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.7, 3.8, 3.9, "3.10"]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install --upgrade bump2version twine
python -m pip install --upgrade coverage
- name: Build
run: |
python --version
python setup.py sdist bdist_wheel
twine check dist/*.whl
twine check dist/*.tar.gz
bump2version --dry-run --verbose --allow-dirty patch
bump2version --dry-run --verbose --allow-dirty minor
bump2version --dry-run --verbose --allow-dirty major
- name: Install pdb-tools
run: |
python -m pip install .
- name: Test on Linux
run: |
script -q -e -c "coverage run -p setup.py test"
shell: bash
if: matrix.os == 'ubuntu-latest'
- name: Test on MacOS / Windows
run: |
coverage run -p setup.py test
shell: bash
if: matrix.os != 'ubuntu-latest'
env:
SKIP_TTY_TESTS: true
# Store coverage data for later
# https://hynek.me/articles/ditch-codecov-python/
- name: Store coverage data
uses: actions/upload-artifact@v3
with:
name: coverage-data
path: .coverage.*
if-no-files-found: ignore
retention-days: 2
# Combine and analyze coverage
# https://hynek.me/articles/ditch-codecov-python/
coverage:
name: Combine & Check coverage.
runs-on: ubuntu-latest
needs: [build_and_test]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.10"
- run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install --upgrade coverage
- name: Download coverage data.
uses: actions/download-artifact@v2
with:
name: coverage-data
# We should update the threshold as we write more tests.
# It should be the minimum we are comfortable with.
- name: Combine coverage & fail if it's < threshold %.
run: |
python -m coverage combine
python -m coverage html --skip-covered --skip-empty
python -m coverage report --fail-under=80
- name: Upload HTML report if check failed.
uses: actions/upload-artifact@v2
with:
name: html-report
path: htmlcov
if: ${{ failure() }}