-
-
Notifications
You must be signed in to change notification settings - Fork 29
179 lines (148 loc) · 4.58 KB
/
tests.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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# Run scriv CI
name: "Test Suite"
on:
push:
pull_request:
workflow_dispatch:
defaults:
run:
shell: bash
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
env:
PIP_DISABLE_PIP_VERSION_CHECK: 1
PANDOC_VER: 2.18
jobs:
tests:
name: "${{ matrix.python-version }} on ${{ matrix.os }}"
runs-on: "${{ matrix.os }}-latest"
strategy:
fail-fast: false
matrix:
os:
- ubuntu
- macos
- windows
python-version:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "pypy-3.9"
steps:
- name: "Check out the repo"
uses: "actions/checkout@v3"
- name: "Set up Python"
uses: "actions/setup-python@v4"
with:
python-version: "${{ matrix.python-version }}"
cache: pip
cache-dependency-path: 'requirements/*.txt'
- name: "Install dependencies"
run: |
python -m pip install -U setuptools
python -m pip install -r requirements/tox.txt
- name: "Install pandoc on Linux"
# sudo apt-get pandoc: will install a version from 2018!
if: runner.os == 'Linux'
run: |
wget -nv -O pandoc.deb https://github.com/jgm/pandoc/releases/download/${PANDOC_VER}/pandoc-${PANDOC_VER}-1-amd64.deb
sudo apt install ./pandoc.deb
- name: "Install pandoc on Mac"
if: runner.os == 'macOS'
run: |
brew install pandoc
- name: "Install pandoc on Windows"
if: runner.os == 'Windows'
run: |
choco install -y -r --no-progress pandoc
- name: "Run tox for ${{ matrix.python-version }}"
run: |
python -m tox
- name: "Upload coverage data"
uses: actions/upload-artifact@v3
with:
name: covdata
path: .coverage.*
coverage:
name: Coverage
needs: tests
runs-on: ubuntu-latest
steps:
- name: "Check out the repo"
uses: "actions/checkout@v3"
- name: "Set up Python"
uses: "actions/setup-python@v4"
with:
python-version: "3.11"
cache: pip
cache-dependency-path: 'requirements/*.txt'
- name: "Install dependencies"
run: |
python -m pip install -U setuptools
python -m pip install -r requirements/tox.txt
- name: "Download coverage data"
uses: actions/download-artifact@v3
with:
name: covdata
- name: "Combine and report"
run: |
python -m tox -e coverage
export TOTAL=$(python -c "import json;print(json.load(open('coverage.json'))['totals']['percent_covered_display'])")
echo "total=$TOTAL" >> $GITHUB_ENV
echo "### Total coverage: ${TOTAL}%" >> $GITHUB_STEP_SUMMARY
- name: "Make badge"
if: (github.repository == 'nedbat/scriv') && (github.ref == 'refs/heads/main')
# https://gist.github.com/nedbat/5a304c1c779d4bcc57be95f847e9327f
uses: schneegans/[email protected]
with:
# GIST_TOKEN is a GitHub personal access token with scope "gist".
# https://github.com/settings/tokens/969369418
auth: ${{ secrets.GIST_TOKEN }}
gistID: 5a304c1c779d4bcc57be95f847e9327f
filename: covbadge.json
label: Coverage
message: ${{ env.total }}%
minColorRange: 50
maxColorRange: 90
valColorRange: ${{ env.total }}
docs:
name: Docs
runs-on: ubuntu-latest
steps:
- name: "Check out the repo"
uses: "actions/checkout@v3"
- name: "Set up Python"
uses: "actions/setup-python@v4"
with:
python-version: "3.7"
cache: pip
cache-dependency-path: 'requirements/*.txt'
- name: "Install dependencies"
run: |
python -m pip install -U setuptools
python -m pip install -r requirements/tox.txt
- name: "Build docs"
run: |
python -m tox -e docs
quality:
name: Linters etc
runs-on: ubuntu-latest
steps:
- name: "Check out the repo"
uses: "actions/checkout@v3"
- name: "Set up Python"
uses: "actions/setup-python@v4"
with:
python-version: "3.7"
cache: pip
cache-dependency-path: 'requirements/*.txt'
- name: "Install dependencies"
run: |
python -m pip install -U setuptools
python -m pip install -r requirements/tox.txt
- name: "Linters etc"
run: |
python -m tox -e quality