-
-
Notifications
You must be signed in to change notification settings - Fork 622
161 lines (147 loc) · 5.05 KB
/
ci.yml
File metadata and controls
161 lines (147 loc) · 5.05 KB
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
name: CI
on:
push:
branches-ignore:
- "wip*"
tags:
- "v*"
pull_request:
schedule:
# Daily at 3:21
- cron: "21 3 * * *"
workflow_dispatch:
permissions: {}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
list:
name: List nox sessions
runs-on: ubuntu-latest
outputs:
noxenvs: ${{ steps.noxenvs-matrix.outputs.noxenvs }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- name: Set up uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b
with:
enable-cache: ${{ github.ref_type != 'tag' }} # zizmor: ignore[cache-poisoning]
- id: noxenvs-matrix
run: |
echo >>$GITHUB_OUTPUT noxenvs=$(
uvx nox --list-sessions --json | jq '[.[].session]'
)
ci:
name: Test
needs: list
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
noxenv: ${{ fromJson(needs.list.outputs.noxenvs) }}
posargs: [""]
include:
- os: ubuntu-latest
noxenv: "tests-3.14(format)"
posargs: coverage github
- os: ubuntu-latest
noxenv: "tests-3.14(no-extras)"
posargs: coverage github
exclude:
- os: macos-latest
noxenv: "docs(dirhtml)"
- os: macos-latest
noxenv: "docs(doctest)"
- os: macos-latest
noxenv: "docs(linkcheck)"
- os: macos-latest
noxenv: "docs(man)"
- os: macos-latest
noxenv: "docs(spelling)"
- os: macos-latest
noxenv: "docs(style)"
- os: windows-latest
noxenv: "docs(dirhtml)"
- os: windows-latest
noxenv: "docs(doctest)"
- os: windows-latest
noxenv: "docs(linkcheck)"
- os: windows-latest
noxenv: "docs(spelling)"
- os: windows-latest
noxenv: "docs(style)"
- os: windows-latest
noxenv: "tests-3.14(no-extras)"
- os: windows-latest
noxenv: "tests-3.14(format)"
- os: windows-latest
noxenv: "tests-3.14(format-nongpl)"
- os: windows-latest
noxenv: "tests-3.14t(no-extras)"
- os: windows-latest
noxenv: "tests-3.14t(format)"
- os: windows-latest
noxenv: "tests-3.14t(format-nongpl)"
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y libenchant-2-dev
if: runner.os == 'Linux' && startsWith(matrix.noxenv, 'docs')
- name: Install dependencies
run: brew install enchant
if: runner.os == 'macOS' && startsWith(matrix.noxenv, 'docs')
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
with:
python-version: |
3.10
3.11
3.12
3.13
3.14
3.14t
pypy-3.11-v7.3.22
allow-prereleases: true
- name: Enable UTF-8 on Windows
run: echo "PYTHONUTF8=1" >> $env:GITHUB_ENV
if: runner.os == 'Windows' && startsWith(matrix.noxenv, 'tests')
- name: Set up uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b
with:
enable-cache: ${{ github.ref_type != 'tag' }} # zizmor: ignore[cache-poisoning]
- name: Run nox
run: uvx nox -s "${{ matrix.noxenv }}" -- ${{ matrix.posargs }} # zizmor: ignore[template-injection]
packaging:
name: Build and publish
needs: ci
runs-on: ubuntu-latest
environment:
name: PyPI
url: https://pypi.org/p/jsonschema
permissions:
contents: write # for creating GitHub releases via `gh release create`
id-token: write # for trusted publishing to PyPI
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
persist-credentials: false
- name: Set up uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b
with:
enable-cache: ${{ github.ref_type != 'tag' }} # zizmor: ignore[cache-poisoning]
- name: Build our distributions
run: uv run --frozen --with 'build[uv]' -m build --installer=uv
- name: Publish to PyPI
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b
- name: Create a GitHub Release
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
env:
GH_TOKEN: ${{ github.token }}
run: gh release create "${GITHUB_REF_NAME}" dist/* --generate-notes