forked from lowRISC/opentitan
-
Notifications
You must be signed in to change notification settings - Fork 0
242 lines (228 loc) · 8.34 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
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
# Copyright lowRISC contributors (OpenTitan project).
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
name: CI
on:
pull_request:
push:
branches-ignore:
- "backport-*"
tags:
- "*"
permissions:
contents: read
# Needed for workload identity federation
id-token: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
VIVADO_VERSION: "2021.1"
jobs:
quick_lint:
name: Lint (quick)
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Required so we can lint commit messages.
- name: Prepare environment
uses: ./.github/actions/prepare-env
- name: Show environment
run: ./ci/scripts/show-env.sh
- name: Commit metadata
run: ./ci/scripts/lint-commits.sh "$GITHUB_BASE_REF"
if: ${{ github.event_name == 'pull_request' }}
- name: License headers
run: ./ci/scripts/check-licence-headers.sh "$GITHUB_BASE_REF"
if: ${{ github.event_name == 'pull_request' }}
- name: Executable bits
run: ./ci/scripts/exec-check.sh
- name: Non-ASCII characters
run: ./ci/scripts/check-ascii.sh
- name: Python (flake8)
run: ./ci/scripts/python-lint.sh "$GITHUB_BASE_REF"
if: ${{ github.event_name == 'pull_request' }}
- name: Python (mypy)
run: ./ci/scripts/mypy.sh
- name: Validate testplans with schema
run: ./ci/scripts/validate_testplans.sh
- name: C/C++ formatting
run: ./bazelisk.sh test //quality:clang_format_check
- name: Rust formatting
run: ./bazelisk.sh test //quality:rustfmt_check
- name: Shellcheck
run: ./bazelisk.sh test //quality:shellcheck_check
- name: Header guards
run: ./ci/scripts/include-guard.sh "$GITHUB_BASE_REF"
if: ${{ github.event_name == 'pull_request' }}
- name: Trailing whitespace
run: ./ci/scripts/whitespace.sh "$GITHUB_BASE_REF"
if: ${{ github.event_name == 'pull_request' }}
- name: Broken links
run: ./ci/scripts/check-links.sh
- name: Generated documentation
run: ./ci/scripts/check-cmdgen.sh
slow_lint:
name: Lint (slow)
runs-on: ubuntu-20.04
needs: quick_lint
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Bitstream cache requires all commits.
- name: Prepare environment
uses: ./.github/actions/prepare-env
- name: Countermeasures implemented (earlgrey)
run: ./ci/scripts/check-countermeasures.sh earlgrey
continue-on-error: true
- name: Countermeasures implemented (englishbreakfast)
run: ./ci/scripts/check-countermeasures.sh englishbreakfast
continue-on-error: true
- name: Bazel test suite tags
run: ./ci/scripts/check_bazel_test_suites.py
continue-on-error: true
# See #21973: disabled until Verilator tags are fixed.
# - name: Check Bazel tags
# run: ./ci/scripts/check-bazel-tags.sh
# continue-on-error: true
- name: Banned Bazel rules
run: ./ci/scripts/check-bazel-banned-rules.sh
- name: Bazel target names
run: ./ci/scripts/check_bazel_target_names.py
continue-on-error: true
- name: DV software images
run: ./ci/scripts/check_dv_sw_images.sh
continue-on-error: true
- name: Build documentation
run: ./ci/scripts/build-docs.sh
- name: Generated files
run: ./ci/scripts/check-generated.sh
env:
OT_DESTRUCTIVE: 1 # Required by the script to clean up.
- name: Buildifier
run: ./bazelisk.sh test //quality:buildifier_check
- name: Vendored files
run: ./ci/scripts/check-vendoring.sh
- name: Verible RTL
run: ./ci/scripts/verible-lint.sh rtl
- name: Verible DV
run: ./ci/scripts/verible-lint.sh dv
- name: Verible FPV
run: ./ci/scripts/verible-lint.sh fpv
airgapped_build:
name: Airgapped build
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Bitstream cache requires all commits.
- name: Prepare environment
uses: ./.github/actions/prepare-env
with:
configure-bazel: false
- name: Free disk space
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be
- name: Check disk space
run: |
df -h
- name: Prepare airgapped environment
run: ./util/prep-bazel-airgapped-build.sh
- name: Check disk space
run: |
df -h
- name: Build in the airgapped environment
run: ./ci/scripts/test-airgapped-build.sh
verible_lint:
name: Verible lint
runs-on: ubuntu-24.04
needs: quick_lint
if: ${{ github.event_name == 'pull_request' }}
env:
verible_config: hw/lint/tools/veriblelint/lowrisc-styleguide.rules.verible_lint
verible_version: v0.0-3430-g060bde0f
steps:
- uses: actions/checkout@v4
- name: Prepare Verible config
run: |
echo "Concatenating Verible waivers"
find . -type f -name '*.vbl' -exec cat {} \; >> verible_waiver
echo "::group::Verible config"
cat "$verible_config"
echo "::endgroup::"
echo "::group::Verible waiver"
cat "verible_waiver"
echo "::endgroup::"
- name: Run Verible linter action
uses: chipsalliance/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
verible_version: ${{ env.verible_version }}
reviewdog_reporter: 'github-pr-check'
suggest_fixes: 'false'
config_file: ${{ env.verible_config }}
extra_args: "--waiver_files=verible_waiver"
verilator_englishbreakfast:
name: Verilated English Breakfast
runs-on: ubuntu-20.04
needs: quick_lint
steps:
- uses: actions/checkout@v4
- name: Prepare environment
uses: ./.github/actions/prepare-env
- name: Build simulator with Verilator
run: ./ci/scripts/build-chip-verilator.sh englishbreakfast
- name: Upload binary
uses: actions/upload-artifact@v4
with:
name: verilated_englishbreakfast
path: build-bin/hw/top_englishbreakfast/Vchip_englishbreakfast_verilator
overwrite: true
- name: Test
run: ./ci/scripts/run-english-breakfast-verilator-tests.sh
# Build CW305 variant of the English Breakfast toplevel design using Vivado
chip_englishbreakfast_cw305:
name: CW305's Bitstream
runs-on: ubuntu-22.04-bitstream
needs: quick_lint
steps:
- uses: actions/checkout@v4
- name: Prepare environment
uses: ./.github/actions/prepare-env
- name: Build bitstream
run: |
# Build CW305 test rom required by `build-bitstream-vivado.sh`
rom_path="sw/device/lib/testing/test_rom"
./bazelisk.sh build "//${rom_path}:test_rom_fpga_cw305" \
--features=-rv32_bitmanip \
--copt=-DOT_IS_ENGLISH_BREAKFAST_REDUCED_SUPPORT_FOR_INTERNAL_USE_ONLY_
vmem="$(./bazelisk.sh cquery --output=files "//${rom_path}:test_rom_fpga_cw305" \
--features=-rv32_bitmanip \
--copt=-DOT_IS_ENGLISH_BREAKFAST_REDUCED_SUPPORT_FOR_INTERNAL_USE_ONLY_
)"
mkdir -p "build-bin/${rom_path}"
cp "$vmem" "build-bin/${rom_path}"
module load "xilinx/vivado/${VIVADO_VERSION}"
ci/scripts/build-bitstream-vivado.sh top_englishbreakfast cw305
- name: Upload bitstream
uses: actions/upload-artifact@v4
with:
name: chip_englishbreakfast_cw305
path: build-bin/hw/top_englishbreakfast/lowrisc_systems_chip_englishbreakfast_cw305_0.1.bit
overwrite: true
build_docker_containers:
name: Build Docker Containers
runs-on: ubuntu-20.04
needs: quick_lint
steps:
- uses: actions/checkout@v4
- name: Build Developer Utility Container
uses: docker/build-push-action@v6
with:
context: .
file: util/container/Dockerfile
continue-on-error: true
- name: Build Documentation Redirector Container
uses: docker/build-push-action@v6
with:
context: site/redirector/landing