-
Notifications
You must be signed in to change notification settings - Fork 0
136 lines (114 loc) · 3.1 KB
/
ci.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
name: CI
on:
workflow_dispatch:
pull_request:
push:
branches:
- master
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
FORCE_COLOR: 3
jobs:
lint:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: "3.x"
- uses: pre-commit/[email protected]
with:
extra_args: --hook-stage manual --all-files
- name: Run PyLint
run: |
echo "::add-matcher::$GITHUB_WORKSPACE/.github/matchers/pylint.json"
pipx run nox -s pylint
checks:
name: Check Python ${{ matrix.python-version }} on ${{ matrix.runs-on }}
runs-on: ${{ matrix.runs-on }}
needs: [lint]
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.12"]
runs-on: [ubuntu-latest]
include:
- python-version: pypy-3.10
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Install package
run: python -m pip install .[test]
- name: Test package
run: >-
python -m pytest -ra --cov --cov-report=xml --cov-report=term
--durations=20
- name: Upload coverage report
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
docs:
name: Check building docs
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ github.head_ref }}
- uses: wntrblm/[email protected]
with:
python-versions: "3.11"
- name: Linkcheck
run: nox -s docs -- -b linkcheck
- name: Build docs with warnings as errors
run: nox -s docs -- -W
- name: Verify no changes required to API docs
run: |
nox -s build_api_docs
git diff --exit-code
pass:
if: always()
needs: [lint, checks, docs]
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
release:
name: release
runs-on: ubuntu-latest
permissions:
contents: write
needs: [pass]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Semantic Release
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
run: >
npx
--package @semantic-release/github
--package [email protected]
--package [email protected]
semantic-release