-
Notifications
You must be signed in to change notification settings - Fork 41
194 lines (160 loc) · 4.92 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
186
187
188
189
190
191
192
193
194
name: CI
on:
push:
branches-ignore:
- "wip*"
tags:
- "v*"
pull_request:
schedule:
# Daily at 5:12
- cron: "12 5 * * *"
workflow_dispatch:
concurrency:
group: ci-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: true
jobs:
list:
runs-on: ubuntu-latest
outputs:
noxenvs: ${{ steps.noxenvs-matrix.outputs.noxenvs }}
steps:
- uses: actions/checkout@v4
- name: Set up nox
uses: wntrblm/[email protected]
- id: noxenvs-matrix
run: |
echo >>$GITHUB_OUTPUT noxenvs=$(
nox --list-sessions --json | jq '[.[].session]'
)
ci:
needs: list
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
noxenv: ${{ fromJson(needs.list.outputs.noxenvs) }}
steps:
- uses: actions/checkout@v4
- 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 podman
if: runner.os == 'macOS'
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: |
3.11
3.12
allow-prereleases: true
- uses: actions/setup-node@v4
with:
node-version-file: frontend/package.json
if: startsWith(matrix.noxenv, 'ui')
- uses: pnpm/action-setup@v4
with:
package_json_file: frontend/package.json
run_install: false
if: startsWith(matrix.noxenv, 'ui')
- name: Set up uv
uses: hynek/setup-cached-uv@v2
- name: Set up nox
uses: wntrblm/[email protected]
- name: Run nox
run: nox -s "${{ matrix.noxenv }}"
containerless:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Set up uv
uses: hynek/setup-cached-uv@v2
- name: Set up nox
uses: wntrblm/[email protected]
- name: Ensure containers don't work
run: sudo apt-get purge docker podman
- name: Run nox
run: nox -s tests-3.12 -- -m 'not containers'
coverage:
runs-on: ubuntu-latest
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
allow-prereleases: true
- name: Set up uv
uses: hynek/setup-cached-uv@v2
- name: Set up nox
uses: wntrblm/[email protected]
- name: Run nox
run: nox -s tests-3.12 -- coverage github
automerge:
needs: ci
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' && github.actor == 'dependabot[bot]'
permissions:
contents: write
pull-requests: write
steps:
- name: Automatically merge allowed PRs
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
packaging:
needs: ci
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.tag }}
environment:
name: PyPI
url: https://pypi.org/p/bowtie-json-schema
permissions:
contents: write
id-token: write
attestations: write
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Set up uv
uses: hynek/setup-cached-uv@v2
- name: Set up nox
uses: wntrblm/[email protected]
- name: Install dependencies
run: uv pip install --system build
- name: Create packages
run: python -m build .
- name: Generate attestation for wheels
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
uses: actions/attest-build-provenance@v1
with:
subject-path: "dist/*.whl"
- name: Publish to PyPI
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
- name: Create a Release
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
- name: Current version
id: version
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
report:
needs: packaging
uses: ./.github/workflows/report.yml
with:
bowtie-version: ${{ needs.packaging.outputs.version }}
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')