forked from kuznia-rdzeni/coreblocks
-
Notifications
You must be signed in to change notification settings - Fork 0
362 lines (307 loc) · 11 KB
/
main.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
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
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
name: CI
on:
push:
branches:
- master
- 'feature/**'
pull_request:
branches:
- master
- 'feature/**'
workflow_dispatch:
jobs:
build-core:
name: Synthesize full core
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install Coreblocks dependencies
run: |
python3 -m venv venv
. venv/bin/activate
python3 -m pip install --upgrade pip
python3 -m pip install -r requirements.txt
- name: Generate Verilog
run: |
. venv/bin/activate
PYTHONHASHSEED=0 TRANSACTRON_VERBOSE=1 ./scripts/gen_verilog.py --verbose --config full
- uses: actions/upload-artifact@v4
with:
name: "verilog-full-core"
path: |
core.v
core.v.json
build-riscof-tests:
name: Build regression tests (riscv-arch-test)
runs-on: ubuntu-latest
container: ghcr.io/kuznia-rdzeni/riscv-toolchain:2024.12.07
timeout-minutes: 10
env:
PYENV_ROOT: "/root/.pyenv"
LC_ALL: "C.UTF8"
LANG: "C.UTF8"
defaults:
run:
working-directory: test/external/riscof/
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get submodules HEAD hash
working-directory: .
run: |
# ownership workaround
git config --global --add safe.directory /__w/coreblocks/coreblocks
# paths in command are relative!
git submodule > .gitmodules-hash
- name: Cache compiled and reference riscv-arch-test
id: cache-riscv-arch-test
uses: actions/cache@v4
env:
cache-name: cache-riscv-arch-test
with:
path: |
test/external/riscof/riscv-arch-test/**/*.elf
test/external/riscof/riscof_work/**/*.signature
test/external/riscof/**/*Makefile*
key: ${{ env.cache-name }}-${{ runner.os }}-${{ hashFiles(
'**/test/external/riscof/coreblocks/**',
'**/test/external/riscof/spike_simple/**',
'**/test/external/riscof/config.ini',
'**/.gitmodules-hash',
'**/docker/riscv-toolchain.Dockerfile',
'**/.github/workflows/main.yml'
) }}
lookup-only: true
- if: ${{ steps.cache-riscv-arch-test.outputs.cache-hit != 'true' }}
name: Checkout with submodules
uses: actions/checkout@v4
with:
submodules: recursive
- if: ${{ steps.cache-riscv-arch-test.outputs.cache-hit != 'true' }}
name: Setup PATH
run: echo "/.pyenv/bin" >> $GITHUB_PATH
- if: ${{ steps.cache-riscv-arch-test.outputs.cache-hit != 'true' }}
name: Setup pyenv python
run: |
eval "$(pyenv init --path)"
pyenv global 3.6.15
. /venv3.6/bin/activate
- if: ${{ steps.cache-riscv-arch-test.outputs.cache-hit != 'true' }}
name: Setup arch test suite
run: |
. /venv3.6/bin/activate
riscof testlist --config=config.ini --suite=riscv-arch-test/riscv-test-suite/ --env=riscv-arch-test/riscv-test-suite/env
- if: ${{ steps.cache-riscv-arch-test.outputs.cache-hit != 'true' }}
name: Build and run tests on reference and generate Makefiles
run: |
. /venv3.6/bin/activate
riscof run --config=config.ini --suite=riscv-arch-test/riscv-test-suite/ --env=riscv-arch-test/riscv-test-suite/env
- if: ${{ steps.cache-riscv-arch-test.outputs.cache-hit != 'true' }}
name: Build tests for Coreblocks
run: |
MAKEFILE_PATH=riscof_work/Makefile.build-DUT-coreblocks ../../../ci/riscof_run_makefile.sh
- if: ${{ steps.cache-riscv-arch-test.outputs.cache-hit != 'true' }}
name: Upload compiled and reference tests artifact
uses: actions/upload-artifact@v4
with:
name: "riscof-tests"
path: |
test/external/riscof/riscv-arch-test/**/*.elf
test/external/riscof/riscof_work/**/*.signature
test/external/riscof/**/*Makefile*
run-riscof-tests:
name: Run regression tests (riscv-arch-test)
runs-on: ubuntu-latest
container: ghcr.io/kuznia-rdzeni/verilator:v5.008-2023.11.19_v
needs: [ build-riscof-tests, build-core ]
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get submodules HEAD hash
run: |
git config --global --add safe.directory /__w/coreblocks/coreblocks
git submodule > .gitmodules-hash
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install Coreblocks dependencies
run: |
python3 -m venv venv
. venv/bin/activate
python3 -m pip install --upgrade pip
python3 -m pip install -r requirements-dev.txt
- uses: actions/download-artifact@v4
name: Download full verilog core
with:
name: "verilog-full-core"
path: .
- uses: actions/cache@v4
name: Download tests from cache
env:
cache-name: cache-riscv-arch-test
with:
path: |
test/external/riscof/riscv-arch-test/**/*.elf
test/external/riscof/riscof_work/**/*.signature
test/external/riscof/**/*Makefile*
key: ${{ env.cache-name }}-${{ runner.os }}-${{ hashFiles(
'**/test/external/riscof/coreblocks/**',
'**/test/external/riscof/spike_simple/**',
'**/test/external/riscof/config.ini',
'**/.gitmodules-hash',
'**/docker/riscv-toolchain.Dockerfile',
'**/.github/workflows/main.yml'
) }}
fail-on-cache-miss: true
- name: Run tests on Coreblocks
run: |
. venv/bin/activate
MAKEFILE_PATH=test/external/riscof/riscof_work/Makefile.run-DUT-coreblocks NPROC=1 ./ci/riscof_run_makefile.sh
- name: Compare signatures (test results)
run: MAKEFILE_PATH=test/external/riscof/riscof_work/Makefile.run-DUT-coreblocks ./ci/riscof_compare.sh
build-regression-tests:
name: Build regression tests (riscv-tests)
runs-on: ubuntu-latest
container: ghcr.io/kuznia-rdzeni/riscv-toolchain:2024.12.07
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get submodules HEAD hash
run: |
git config --global --add safe.directory /__w/coreblocks/coreblocks
git submodule > .gitmodules-hash
- name: Cache regression-tests
id: cache-regression
uses: actions/cache@v4
env:
cache-name: cache-regression-tests
with:
path: test/external/riscv-tests/test-*
key: ${{ env.cache-name }}-${{ runner.os }}-${{ hashFiles(
'**/test/external/riscv-tests/environment/custom/**',
'**/test/external/riscv-tests/Makefile',
'**/.gitmodules-hash',
'**/docker/riscv-toolchain.Dockerfile',
'**/.github/workflows/main.yml'
) }}
lookup-only: true
- if: ${{ steps.cache-regression.outputs.cache-hit != 'true' }}
name: Checkout with submodules
uses: actions/checkout@v4
with:
submodules: recursive
- if: ${{ steps.cache-regression.outputs.cache-hit != 'true' }}
run: cd test/external/riscv-tests && make
- if: ${{ steps.cache-regression.outputs.cache-hit != 'true' }}
name: Upload riscv-tests
uses: actions/upload-artifact@v4
with:
path: test/external/riscv-tests
run-regression-tests:
name: Run regression tests (riscv-tests)
runs-on: ubuntu-latest
timeout-minutes: 10
container: ghcr.io/kuznia-rdzeni/verilator:v5.008-2023.11.19_v
needs: [ build-regression-tests, build-core ]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get submodules HEAD hash
run: |
git config --global --add safe.directory /__w/coreblocks/coreblocks
git submodule > .gitmodules-hash
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python3 -m venv venv
. venv/bin/activate
python3 -m pip install --upgrade pip
python3 -m pip install -r requirements-dev.txt
- uses: actions/download-artifact@v4
name: Download full verilog core
with:
name: "verilog-full-core"
path: .
- uses: actions/cache@v4
name: Download tests from cache
env:
cache-name: cache-regression-tests
with:
path: test/external/riscv-tests/test-*
key: ${{ env.cache-name }}-${{ runner.os }}-${{ hashFiles(
'**/test/external/riscv-tests/environment/custom/**',
'**/test/external/riscv-tests/Makefile',
'**/.gitmodules-hash',
'**/docker/riscv-toolchain.Dockerfile',
'**/.github/workflows/main.yml'
) }}
fail-on-cache-miss: true
- name: Run tests
run: |
. venv/bin/activate
scripts/run_tests.py -a regression
- name: Check regression with pysim
run: |
. venv/bin/activate
./scripts/run_tests.py -c 1 -a -b pysim regression
unit-test:
name: Run unit tests
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
cache-dependency-path: |
requirements.txt
requirements-dev.txt
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip3 install -r requirements-dev.txt
sudo apt-get install -y binutils-riscv64-unknown-elf
- name: Run tests
run: ./scripts/run_tests.py -v
- name: Check traces and profiles
run: ./scripts/run_tests.py -t -p -c 1 TestCore
- name: Check listing tests
run: ./scripts/run_tests.py -l
lint:
name: Check code formatting and typing
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
cache-dependency-path: |
requirements.txt
requirements-dev.txt
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip3 install -r requirements-dev.txt
- name: Check format
run: ./scripts/lint.sh check_format
- name: Check types
run: ./scripts/lint.sh check_types