-
Notifications
You must be signed in to change notification settings - Fork 176
296 lines (285 loc) · 8.87 KB
/
main.yaml
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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
on:
push:
pull_request:
merge_group:
name: CI
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- '3.9'
- '3.10'
- '3.11'
- '3.12'
- '3.13'
- 'pypy-3.9'
- 'pypy-3.10'
allow-failure:
- false
include:
- python-version: '3.14-dev'
allow-failure: true
continue-on-error: ${{ matrix.allow-failure }}
name: 'test (${{ matrix.python-version }})'
steps:
- name: Check out source code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up PDM
uses: pdm-project/setup-pdm@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys FA8E1301F4D3932C
sudo add-apt-repository 'deb http://ppa.launchpad.net/sri-csl/formal-methods/ubuntu bionic main'
sudo apt-get update
sudo apt-get install yices2
pip install codecov build
pdm install --dev
- name: Cache YoWASP build products
uses: actions/cache@v4
with:
path: ~/.cache/YoWASP
key: YoWASP-${{ runner.os }}-${{ hashFiles('./.venv/**/*.wasm') }}
restore-keys: |
YoWASP-${{ runner.os }}-
- name: Run tests
run: |
pdm run test
- name: Submit code coverage
run: |
codecov
smoketest: # If we plug this into downstream projects, does magic smoke escape?
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
project:
- amaranth-lang/amaranth-boards
- amaranth-lang/amaranth-stdio
- amaranth-lang/amaranth-soc
name: 'smoke (${{ matrix.project }})'
steps:
- name: Check out Amaranth source code
uses: actions/checkout@v4
with:
path: amaranth
fetch-depth: 0
- name: Check out source code
uses: actions/checkout@v4
with:
repository: ${{ matrix.project }}
path: project
fetch-depth: 0
- name: Set up PDM
uses: pdm-project/setup-pdm@v4
- name: Install dependencies
working-directory: project
run: |
pdm install --dev
- name: Use Amaranth HEAD revision
working-directory: project
run: |
pdm add ../amaranth
- name: Cache YoWASP build products
uses: actions/cache@v4
with:
path: ~/.cache/YoWASP
key: YoWASP-${{ runner.os }}-${{ hashFiles('./.venv/**/*.wasm') }}
restore-keys: |
YoWASP-${{ runner.os }}-
- name: Run tests
working-directory: project
run: |
pdm run test
document:
runs-on: ubuntu-latest
steps:
- name: Check out source code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Fetch tags from upstream repository
run: |
git fetch --tags https://github.com/amaranth-lang/amaranth.git
- name: Set up PDM
uses: pdm-project/setup-pdm@v4
with:
python-version: '3.12'
- name: Install dependencies
run: |
pdm install --dev
- name: Build documentation
run: |
pdm run document
- name: Upload documentation archive
uses: actions/upload-artifact@v4
with:
name: docs
path: docs/_build
- name: Extract schemas
run: |
pdm run extract-schemas
- name: Upload schema archive
uses: actions/upload-artifact@v4
with:
name: schema
path: schema
check-links:
runs-on: ubuntu-latest
steps:
- name: Check out source code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up PDM
uses: pdm-project/setup-pdm@v4
with:
python-version: '3.12'
- name: Install dependencies
run: |
pdm install --dev
- name: Check links in documentation
run: |
pdm run document-linkcheck
required: # group all required workflows into one to avoid reconfiguring this in Actions settings
needs:
- test
- document
if: ${{ always() && !contains(needs.*.result, 'cancelled') }}
runs-on: ubuntu-latest
steps:
- run: ${{ contains(needs.*.result, 'failure') && 'false' || 'true' }}
publish-docs:
needs: document
if: ${{ github.repository == 'amaranth-lang/amaranth' }}
runs-on: ubuntu-latest
steps:
- name: Check out source code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download documentation archive
uses: actions/download-artifact@v4
with:
name: docs
path: docs/
- name: Publish development documentation
if: ${{ github.event_name == 'push' && github.event.ref == 'refs/heads/main' }}
uses: JamesIves/github-pages-deploy-action@releases/v4
with:
repository-name: amaranth-lang/amaranth-lang.github.io
ssh-key: ${{ secrets.PAGES_DEPLOY_KEY }}
branch: main
folder: docs/
target-folder: docs/amaranth/latest/
- name: Publish release documentation
if: ${{ github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') && !contains(github.event.ref, 'dev') }}
uses: JamesIves/github-pages-deploy-action@releases/v4
with:
repository-name: amaranth-lang/amaranth-lang.github.io
ssh-key: ${{ secrets.PAGES_DEPLOY_KEY }}
branch: main
folder: docs/
target-folder: docs/amaranth/${{ github.ref_name }}/
publish-docs-dev:
needs: document
if: ${{ github.repository != 'amaranth-lang/amaranth' }}
runs-on: ubuntu-latest
steps:
- name: Check out source code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download documentation archive
uses: actions/download-artifact@v4
with:
name: docs
path: pages/docs/${{ github.ref_name }}/
- name: Disable Jekyll
run: |
touch pages/.nojekyll
- name: Publish documentation for a branch
uses: JamesIves/github-pages-deploy-action@releases/v4
with:
folder: pages/
clean: false
publish-schemas:
needs: [required, publish-docs] # avoid race condition with publish-docs
if: ${{ github.repository == 'amaranth-lang/amaranth' }}
runs-on: ubuntu-latest
steps:
- name: Check out source code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download schema archive
uses: actions/download-artifact@v4
with:
name: schema
path: schema/
- name: Publish schemas
if: ${{ github.event_name == 'push' && github.event.ref == 'refs/heads/main' }}
uses: JamesIves/github-pages-deploy-action@releases/v4
with:
repository-name: amaranth-lang/amaranth-lang.github.io
ssh-key: ${{ secrets.PAGES_DEPLOY_KEY }}
branch: main
folder: schema/
target-folder: schema/amaranth/
publish-package:
needs: required
runs-on: ubuntu-latest
environment: publish
permissions:
id-token: write
steps:
- name: Check out source code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build package
run: |
pip install build
python -m build
- name: Upload package artifact
uses: actions/upload-artifact@v4
with:
name: package
path: dist/
- name: Verify package metadata
run: |
pip install twine
twine check dist/*
- name: Publish package to Test PyPI
if: ${{ github.repository == 'amaranth-lang/amaranth' && github.event_name == 'push' && github.event.ref == 'refs/heads/main' }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
- name: Publish package to PyPI
if: ${{ github.repository == 'amaranth-lang/amaranth' && github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') && !contains(github.event.ref, 'dev') }}
uses: pypa/gh-action-pypi-publish@release/v1
publish-release:
needs: publish-package
if: ${{ github.repository == 'amaranth-lang/amaranth' && github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') && !contains(github.event.ref, 'dev') }}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Determine release metadata
id: metadata
env:
REF_NAME: ${{ github.ref_name }}
run: |
echo name=${REF_NAME/v/} >>$GITHUB_OUTPUT
- name: Create release
uses: comnoco/create-release-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
release_name: ${{ steps.metadata.outputs.name }}