-
-
Notifications
You must be signed in to change notification settings - Fork 36
185 lines (144 loc) · 4.67 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
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
180
181
182
183
184
185
name: CI
on:
push:
branches:
- main
tags:
- '**'
pull_request:
types: [opened, synchronize]
jobs:
test:
name: test ${{ matrix.python-version }} on ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu, macos]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
# test pypy on ubuntu only to speed up CI, no reason why macos X pypy should fail separately
include:
- os: 'ubuntu'
python-version: 'pypy-3.9'
- os: 'ubuntu'
python-version: 'pypy-3.10'
runs-on: ${{ matrix.os }}-latest
env:
PYTHON: ${{ matrix.python-version }}
OS: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: set up python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- run: pip install -r requirements/tests.txt -r requirements/pyproject.txt
- run: make test
- run: coverage xml
- uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
env_vars: PYTHON,OS
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- run: pip install -r requirements/linting.txt
- uses: pre-commit/action@v3.0.0
with:
extra_args: --all-files
env:
SKIP: no-commit-to-branch
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: set up python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: install
run: pip install -r requirements/docs.txt
- name: install mkdocs-material-insiders
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')
run: pip install https://files.scolvin.com/${MKDOCS_TOKEN}/mkdocs_material-9.4.2+insiders.4.42.0-py3-none-any.whl
env:
MKDOCS_TOKEN: ${{ secrets.mkdocs_token }}
- name: build site
run: mkdocs build --strict
- name: store docs site
uses: actions/upload-artifact@v3
with:
name: docs
path: site
check: # This job does nothing and is only used for the branch protection
if: always()
needs: [lint, test, docs]
runs-on: ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
id: all-green
with:
jobs: ${{ toJSON(needs) }}
publish_docs:
needs: [check]
if: "success() && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/'))"
runs-on: ubuntu-latest
steps:
- name: checkout docs-site
uses: actions/checkout@v4
with:
ref: docs-site
- uses: actions/checkout@v4
- name: set up python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: install
run: pip install -r requirements/docs.txt
- name: install mkdocs-material-insiders
run: pip install https://files.scolvin.com/${MKDOCS_TOKEN}/mkdocs_material-9.4.2+insiders.4.42.0-py3-none-any.whl
env:
MKDOCS_TOKEN: ${{ secrets.mkdocs_token }}
- name: Set git credentials
run: |
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
- run: mike deploy -b docs-site dev --push
if: github.ref == 'refs/heads/main'
- name: check version
if: "startsWith(github.ref, 'refs/tags/')"
id: check-version
uses: samuelcolvin/check-python-version@v3.2
with:
version_file_path: 'dirty_equals/version.py'
- run: mike deploy -b docs-site ${{ steps.check-version.outputs.VERSION_MAJOR_MINOR }} latest --update-aliases --push
if: "startsWith(github.ref, 'refs/tags/') && !fromJSON(steps.check-version.outputs.IS_PRERELEASE)"
deploy:
needs: [check]
if: "success() && startsWith(github.ref, 'refs/tags/')"
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- name: set up python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: install
run: pip install -U build
- name: check version
id: check-version
uses: samuelcolvin/check-python-version@v3.2
with:
version_file_path: 'dirty_equals/version.py'
- name: build
run: python -m build
- name: Upload package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1