forked from riscv/riscv-arch-test
-
Notifications
You must be signed in to change notification settings - Fork 0
333 lines (277 loc) · 11.6 KB
/
Copy pathregress.yml
File metadata and controls
333 lines (277 loc) · 11.6 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
326
327
328
329
330
331
332
333
# jcarlin@hmc.edu 19 Nov 2025
# SPDX-License-Identifier: Apache-2.0
name: ACT Regression
on:
push:
pull_request:
# Only run CI on the latest commit if a PR is updated
concurrency:
group: "${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}"
cancel-in-progress: true
env:
SAIL_VERSION: "0.13"
RISCV_TOOLCHAIN_VERSION: "2026.07.15"
LLVM_VERSION: "22"
jobs:
lint:
name: Pre-commit (prek) check
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Set up tools
uses: ./.github/actions/setup-tools
- name: Run prek
uses: j178/prek-action@e98a699c41eb69ab013a45817a0406469a748f8d # v2.0.5
# Data-driven regression.
# Configs are auto-discovered from the config directory.
# Simulator/core wide setup is in config/<simulator>/ci.yaml.
# The config-specific execution command is in config/<simulator>/<config>/run_cmd.txt.
# To add a new simulator or config, just add the config files — no workflow changes needed.
discover-configs:
name: Discover CI Configs
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.discover.outputs.matrix }}
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Set up tools
uses: ./.github/actions/setup-tools
with:
udb-gems: "true"
# The act build cache is content-hash based and self-validating, so a
# stale restore is safe: only configs whose UDB yaml changed rebuild.
# Gemfile.lock stays in the primary prefix (not just restore-keys)
# because the build cache hashes commands, not tool binaries — a udb
# gem update must drop these caches entirely.
- name: Cache UDB outputs
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: work/ci-config
key: ci-config-udb-${{ hashFiles('framework/src/act/data/Gemfile.lock') }}-${{ hashFiles('config/**/*.yaml') }}
restore-keys: |
ci-config-udb-${{ hashFiles('framework/src/act/data/Gemfile.lock') }}-
# Generated tests (e.g. priv) are not checked in but count toward the
# suite weights used for shard bin-packing, so generate them first.
- name: Generate tests
run: make tests --jobs $(nproc)
- name: Discover CI configs
id: discover
run: .github/scripts/ci_config.py
regress:
name: ${{ matrix.simulator }} (${{ matrix.config }})${{ matrix.shard_suffix }}
needs: discover-configs
runs-on: ubuntu-latest
strategy:
matrix: ${{ fromJson(needs.discover-configs.outputs.matrix) }}
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Set up tools
uses: ./.github/actions/setup-tools
with:
udb-gems: "true"
- name: Report shard assignment
run: |
if [ -z "${{ matrix.extensions }}" ]; then
echo "::notice::Shard $((${{ matrix.shard_index }} + 1))/${{ matrix.shard_total }} for ${{ matrix.config }} is empty after exclusions; skipping heavy steps."
else
echo "Shard $((${{ matrix.shard_index }} + 1))/${{ matrix.shard_total }} extensions: ${{ matrix.extensions }}"
fi
- name: Install sail-riscv model
if: matrix.extensions != ''
run: |
sudo mkdir -p /usr/local
curl --location https://github.com/riscv/sail-riscv/releases/download/${SAIL_VERSION}/sail-riscv-$(uname)-$(arch).tar.gz \
| sudo tar xvz --directory=/usr/local --strip-components=1
- name: Install RISC-V GCC toolchain
if: matrix.extensions != ''
run: |
curl --location https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/${RISCV_TOOLCHAIN_VERSION}/riscv64-elf-ubuntu-24.04-gcc.tar.xz \
| sudo tar xvJ --directory=/usr/local --strip-components=1
- name: Install Clang
if: matrix.extensions != ''
run: |
retry() {
local max_attempts="$1"
shift
local attempt=1
while ! "$@"; do
if [ "$attempt" -ge "$max_attempts" ]; then
echo "Command failed after ${attempt} attempts: $*"
return 1
fi
local backoff=$((attempt * 10))
echo "Attempt ${attempt} failed: $*"
echo "Retrying in ${backoff}s..."
sleep "$backoff"
attempt=$((attempt + 1))
done
}
curl --fail --location --retry 5 --retry-all-errors --retry-delay 5 \
https://apt.llvm.org/llvm.sh \
--output /tmp/llvm.sh
chmod +x /tmp/llvm.sh
retry 3 sudo bash /tmp/llvm.sh "$LLVM_VERSION"
retry 3 sudo apt-get update
retry 3 sudo apt-get install -y -o Acquire::Retries=3 \
clang-$LLVM_VERSION lld-$LLVM_VERSION llvm-$LLVM_VERSION
for tool in clang clang++ lld llvm-objdump llvm-as llvm-ar llvm-nm llvm-readelf; do
sudo ln -sf /usr/bin/${tool}-$LLVM_VERSION /usr/bin/${tool}
done
- name: Install runtime dependencies
if: matrix.extensions != '' && matrix.apt_packages != ''
run: |
sudo apt-get update
sudo apt-get install -y ${{ matrix.apt_packages }}
- name: Restore cached simulator
if: matrix.extensions != '' && matrix.cache_key != ''
id: cache-restore
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: ${{ github.workspace }}/${{ matrix.simulator }}
key: ${{ matrix.cache_key }}
- name: Install simulator
if: matrix.extensions != '' && matrix.install_script != '' && steps.cache-restore.outputs.cache-hit != 'true'
run: bash ${{ matrix.install_script }} ${{ github.workspace }}/${{ matrix.simulator }}
- name: Save cached simulator
if: matrix.extensions != '' && matrix.cache_key != '' && steps.cache-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: ${{ github.workspace }}/${{ matrix.simulator }}
key: ${{ matrix.cache_key }}
- name: Add simulator to PATH
if: matrix.extensions != '' && matrix.install_script != ''
run: echo "$GITHUB_WORKSPACE/${{ matrix.simulator }}/bin" >> $GITHUB_PATH
- name: Run setup script
if: matrix.extensions != '' && matrix.setup_script != ''
run: bash ${{ matrix.setup_script }} ${{ github.workspace }}/${{ matrix.simulator }}
- name: Generate tests and coverpoints
if: matrix.extensions != ''
run: EXTENSIONS=${{ matrix.extensions }} make tests --jobs $(nproc)
- name: Build ELFs
if: matrix.extensions != ''
run: |
FAST=True \
EXTENSIONS=${{ matrix.extensions }} \
EXCLUDE_EXTENSIONS=${{ matrix.exclude_extensions }} \
CONFIG_FILES=${{ matrix.config_file }} \
make elfs --jobs $(nproc)
- name: Run tests
if: matrix.extensions != '' && matrix.run_cmd != ''
run: |
./run_tests.py "${{ matrix.run_cmd }}" \
work/${{ matrix.config }}/elfs
- name: Upload logs
if: always() && matrix.extensions != ''
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: ${{ matrix.config }}${{ matrix.shard_suffix }}-logs
path: work/${{ matrix.config }}/logs
vector-testgen:
name: Vector Testgen
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Set up tools
uses: ./.github/actions/setup-tools
- name: Generate vector tests
run: make vector-tests --jobs $(nproc)
ctp-build:
name: Build CTP
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Set up tools
uses: ./.github/actions/setup-tools
- run: git submodule update --init docs/docs-resources
- name: Build CTP
run: cd docs/ctp && make docker-pull-latest && make -j6
crd-build:
name: Build CRD
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- run: git submodule update --init docs/docs-resources
- name: Build CRD
run: cd docs/crd && make docker-pull-latest && make -j6
check-tests:
name: Check generated tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Set up tools
uses: ./.github/actions/setup-tools
- name: Regenerate tests and coverpoints
run: make clean-tests tests
- name: Check for differences
run: |
dirs="tests/rv32i tests/rv32e tests/rv64i tests/rv64e coverpoints/unpriv coverpoints/coverage"
changed=$(git diff --name-only -- $dirs)
untracked=$(git ls-files --others --exclude-standard -- $dirs)
if [ -n "$changed" ] || [ -n "$untracked" ]; then
echo "::error::Checked-in generated files are out of sync with the generators. Run 'make tests' and commit the results."
[ -n "$changed" ] && echo "Changed files:" && git diff -- $dirs
[ -n "$untracked" ] && echo "New files:" && echo "$untracked"
exit 1
fi
echo "Checked-in generated files are up to date."
# Test testgen and framework with oldest supported Python version
python-versions:
name: Python ${{ matrix.python-version }} (uv)
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10"]
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Pin Python version for this job
run: echo "${{ matrix.python-version }}" > .python-version
- name: Set up tools
uses: ./.github/actions/setup-tools
with:
udb-gems: "true"
- name: Verify Python version
run: uv run python --version
- name: Install sail-riscv model
run: |
sudo mkdir -p /usr/local
curl --location https://github.com/riscv/sail-riscv/releases/download/${SAIL_VERSION}/sail-riscv-$(uname)-$(arch).tar.gz \
| sudo tar xvz --directory=/usr/local --strip-components=1
- name: Install RISC-V GCC toolchain
run: |
curl --location https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/${RISCV_TOOLCHAIN_VERSION}/riscv64-elf-ubuntu-24.04-gcc.tar.xz \
| sudo tar xvJ --directory=/usr/local --strip-components=1
- name: Build ELFs (exercises full act build DAG)
run: |
FAST=True \
EXTENSIONS=I \
make
# This is here so that the "Status checks that are required" Github
# option doesn't need to list all of the matrix jobs (it doesn't seem
# to work if you just specify the job ID of the matrix itself).
ci_pass:
runs-on: ubuntu-latest
needs:
[
lint,
regress,
vector-testgen,
check-tests,
python-versions,
ctp-build,
crd-build,
]
if: "${{ always() }}"
steps:
- name: Job status check
env:
RESULTS: ${{ join(needs.*.result, ' ') }}
run: |
for result in $RESULTS; do
[[ "$result" == "success" ]] || exit 1
done