-
Notifications
You must be signed in to change notification settings - Fork 14
325 lines (272 loc) · 10.1 KB
/
Copy pathci.yaml
File metadata and controls
325 lines (272 loc) · 10.1 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
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
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
name: risc-v CI
on:
pull_request:
push:
branches:
- main
permissions:
contents: read
packages: write
jobs:
build_ci_image:
# do this during a push to a branch (e.g. to main) or on a non-fork PR
if: >
github.event_name == 'push' ||
github.event.pull_request.head.repo.full_name == github.repository
uses: ./.github/workflows/docker-image.yml
with:
image-name: ghcr.io/utoss/risc-v
dockerfile: ./Dockerfile.ci
tag-prefix: ci-
secrets: inherit
# we have both internal and external collaborators, and we need to differentiate which CI image
# thier pipelines use; this is because internaly, every PR builds and caches (via docker push) a
# new CI image; this helps reduce friction when adding new dependencies to the CI image but
# requires write access to the GHCR repo for the org, which only org members have; to address
# this, this job selects `ci-branch-main` image for external collaborators so that they don't need
# to write anythign to GHCR; there is a chance that PR might diverge from the `ci-branch-main` tag
# and might cause issues for the contributor, but we'll see if that ever happens first
select_ci_image:
runs-on: ubuntu-latest
needs: build_ci_image
if: always() # dont skip if build_ci_image is skipped
outputs:
image-tag: ${{ steps.image.outputs.tag }}
steps:
- id: image
run: |
if [ "${{ github.event.pull_request.head.repo.full_name }}" == "${{ github.repository }}" ]; then
echo "tag=${{ needs.build_ci_image.outputs.image-primary-tag }}" >> $GITHUB_OUTPUT
else
echo "tag=ghcr.io/utoss/risc-v:ci-branch-main" >> $GITHUB_OUTPUT
fi
build_devcontainer_image:
# do this during a push to a branch (e.g. to main) or on a non-fork PR
if: >
github.event_name == 'push' ||
github.event.pull_request.head.repo.full_name == github.repository
uses: ./.github/workflows/docker-image.yml
with:
image-name: ghcr.io/utoss/risc-v-devcontainer
dockerfile: .devcontainer/Dockerfile
tag-prefix: ""
secrets: inherit
svlint:
needs: select_ci_image
if: always() # dont skip if build_ci_image is skipped
runs-on: ubuntu-latest
container:
image: ${{ needs.select_ci_image.outputs.image-tag }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: lint sources
run: make svlint
- name: lint testbench
run: make svlint_tb
- name: lint DE1-SoC environment files
run: make svlint ENV=de1-soc
build_and_test:
timeout-minutes: 30
needs: select_ci_image
# dont skip if build_ci_image is skipped
if: always()
runs-on: ubuntu-latest
container:
image: ${{ needs.select_ci_image.outputs.image-tag }}
strategy:
matrix: &utoss-risc-v-matrix
config:
- RV32I
- RV32IB
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build top
id: build-top
run: make build_top UTOSS_RISCV_CONFIG=${{ matrix.config }}
- name: Build testbench
id: build-testbench
run: make build_tb UTOSS_RISCV_CONFIG=${{ matrix.config }}
- name: Run testbench
run: make run_tb
- name: Upload VCD files
uses: actions/upload-artifact@v4
if: steps.build-testbench.outcome == 'success'
with:
name: vcd-files-${{ matrix.config }}
path: test/vcd/*.vcd
retention-days: 7
- name: Upload VVP files
uses: actions/upload-artifact@v4
if: steps.build-top.outcome == 'success'
with:
name: vvp-files-${{ matrix.config }}
path: out/*.vvp
retention-days: 7
riscof:
timeout-minutes: 30
needs: select_ci_image
# dont skip if build_ci_image is skipped
if: always()
runs-on: ubuntu-latest
container:
image: ${{ needs.select_ci_image.outputs.image-tag }}
strategy:
matrix: *utoss-risc-v-matrix
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build DUT
run: make riscof_build_dut UTOSS_RISCV_CONFIG=${{ matrix.config }}
- name: Validate YAML
run: make riscof_validateyaml UTOSS_RISCV_CONFIG=${{ matrix.config }}
- name: Clone arch-test
run: make riscof_clone_archtest
- name: Run RISCOF
run: make riscof_run UTOSS_RISCV_CONFIG=${{ matrix.config }}
- name: Upload RISCOF report
if: always()
uses: actions/upload-artifact@v4
with:
name: riscof-report-${{ matrix.config }}
path: |
riscof/riscof_work/report.html
riscof/riscof_work/style.css
retention-days: 7
de1-soc:
timeout-minutes: 30
needs:
- select_ci_image
- build_and_test
# dont skip if build_ci_image is skipped; need explicit check for needs' success
if: always() && needs.build_and_test.result == 'success'
runs-on: ubuntu-latest
container:
image: ${{ needs.select_ci_image.outputs.image-tag }}
strategy:
matrix: *utoss-risc-v-matrix
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build PoC
id: build-poc
run: cd envs/de1-soc/poc && make
- name: Build and run DE1-SoC testbench
run: cd envs/de1-soc && make
- name: Synthesize
id: synthesize
run: cd envs/de1-soc/quartus && make synthesize UTOSS_RISCV_CONFIG=${{ matrix.config }}
- name: Gather metrics
run: cd envs/de1-soc/quartus && make pretty-metrics
- name: Upload VCD file
uses: actions/upload-artifact@v4
if: steps.build-poc.outcome == 'success'
with:
name: de1-soc-tb-vcd-${{ matrix.config }}
path: envs/de1-soc/top_tb.vcd
retention-days: 7
- name: Upload SOF
uses: actions/upload-artifact@v4
if: steps.synthesize.outcome == 'success'
with:
name: de1-soc-sof-${{ matrix.config }}
path: envs/de1-soc/quartus/output_files/utoss-risc-v.sof
- name: Upload Quartus reports
uses: actions/upload-artifact@v4
if: steps.synthesize.outcome == 'success'
with:
name: de1-soc-quartus-reports-${{ matrix.config }}
path: |
envs/de1-soc/quartus/output_files/utoss-risc-v.sta.summary
envs/de1-soc/quartus/output_files/utoss-risc-v.fit.summary
envs/de1-soc/quartus/metrics/fitter_utilization.csv
envs/de1-soc/quartus/metrics/fitter_utilization.pretty.txt
retention-days: 7
de1-soc-synthesis-metrics-diff:
timeout-minutes: 10
needs: de1-soc
# dont run this on fork PRs; this will fail to permission issues when posting a comment; i don't
# understand exactly the permission mechanism that prohibits this so will need to look into this
# further down the road;
if: >
github.event.pull_request.head.repo.full_name == github.repository &&
github.event_name == 'pull_request'
runs-on: ubuntu-latest
permissions:
pull-requests: write
strategy:
matrix: *utoss-risc-v-matrix
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download PR Quartus reports
uses: actions/download-artifact@v4
with:
name: de1-soc-quartus-reports-${{ matrix.config }}
path: pr-reports
- name: Download base branch Quartus reports
uses: dawidd6/action-download-artifact@v3
continue-on-error: true
id: download-base
with:
workflow: ci.yaml
branch: ${{ github.base_ref }}
name: de1-soc-quartus-reports-${{ matrix.config }}
path: base-reports
check_artifacts: true
search_artifacts: true
- name: Initialize metrics diff files
run: |
mkdir -p metric-diff
- name: Compare Fitter Summary
run: >
.github/scripts/de1-soc-synthesis-metrics-diff/compare_metrics_diff.sh
"base-reports/output_files/utoss-risc-v.fit.summary"
"pr-reports/output_files/utoss-risc-v.fit.summary"
> metric-diff/fitter_summary.md
- name: Compare Fitter Resource Utilization by Entity
run: >
.github/scripts/de1-soc-synthesis-metrics-diff/compare_metrics_diff.sh
"base-reports/metrics/fitter_utilization.pretty.txt"
"pr-reports/metrics/fitter_utilization.pretty.txt"
> metric-diff/fitter_by_entity.md
- name: Compare Timing Analysis Summary
run: >
.github/scripts/de1-soc-synthesis-metrics-diff/compare_metrics_diff.sh
"base-reports/output_files/utoss-risc-v.sta.summary"
"pr-reports/output_files/utoss-risc-v.sta.summary"
> metric-diff/timing_summary.md
- name: Upload per-config metrics diff
uses: actions/upload-artifact@v4
with:
name: de1-soc-synthesis-metrics-diff-${{ matrix.config }}
path: metric-diff/*.md
retention-days: 7
de1-soc-synthesis-metrics-diff-aggregate:
timeout-minutes: 10
needs: de1-soc-synthesis-metrics-diff
if: >
github.event.pull_request.head.repo.full_name == github.repository &&
github.event_name == 'pull_request'
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download per-config metrics diff artifacts
uses: actions/download-artifact@v4
with:
pattern: de1-soc-synthesis-metrics-diff-*
path: metrics-diff
- name: Build combined comparison report
run: bash .github/scripts/de1-soc-synthesis-metrics-diff/aggregate_metrics.sh metrics-diff comparison.md
- name: Publish comparison to job summary
run: cat comparison.md >> "$GITHUB_STEP_SUMMARY"
- name: Post comment on PR
uses: actions/github-script@v7
with:
script: |
const script = require('./.github/scripts/de1-soc-synthesis-metrics-diff/post_comment.js');
await script({github, context, comparisonFile: 'comparison.md'});