-
Notifications
You must be signed in to change notification settings - Fork 50
213 lines (199 loc) · 6.79 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
# Copyright 2020 ETH Zurich and University of Bologna.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
# Run functional regression checks
name: ci
on: [push, pull_request]
jobs:
##########################
# Build Docker Container #
##########################
build-docker:
name: Deploy Docker image
runs-on: ubuntu-22.04
if: >
github.event_name != 'pull_request' ||
github.event.pull_request.head.repo.full_name != github.repository
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
docker-images: false
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- name: GHCR Log-in
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
cache-from: type=gha
cache-to: type=gha,mode=max`
file: util/container/Dockerfile
push: true
tags: ghcr.io/pulp-platform/snitch_cluster:${{ github.ref_name }}
########
# Docs #
########
build-docs:
name: Build documentation
runs-on: ubuntu-22.04
needs: build-docker
if: >
github.event_name != 'pull_request' ||
github.event.pull_request.head.repo.full_name != github.repository
container:
image: ghcr.io/pulp-platform/snitch_cluster:${{ github.ref_name }}
steps:
- uses: actions/checkout@v2
- name: Build docs
run: make docs
deploy-docs:
name: Deploy documentation
runs-on: ubuntu-22.04
needs: build-docker
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
container:
image: ghcr.io/pulp-platform/snitch_cluster:${{ github.ref_name }}
steps:
- uses: actions/checkout@v2
# For some reason, the checkout is done by a different user,
# than that deploying to Github (root, possibly due to Docker).
# So we need to set the repository as a safe directory.
- name: Git config safe.directory
run: |
git config --global --add safe.directory $GITHUB_WORKSPACE
- name: Generate documentation sources
run: |
make doc-srcs
make doxygen-docs
- name: Build and deploy documentation
run: mkdocs gh-deploy --force
#####################
# Python unit tests #
#####################
pytest:
name: Python unit tests
runs-on: ubuntu-22.04
needs: build-docker
if: >
github.event_name != 'pull_request' ||
github.event.pull_request.head.repo.full_name != github.repository
container:
image: ghcr.io/pulp-platform/snitch_cluster:${{ github.ref_name }}
steps:
- uses: actions/checkout@v2
- name: Run pytest
run: pytest
##############################################
# Simulate SW on Snitch Cluster w/ Verilator #
##############################################
sw-snitch-cluster-vlt:
name: Simulate SW on Snitch Cluster w/ Verilator
runs-on: ubuntu-22.04
needs: build-docker
if: >
github.event_name != 'pull_request' ||
github.event.pull_request.head.repo.full_name != github.repository
container:
image: ghcr.io/pulp-platform/snitch_cluster:${{ github.ref_name }}
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Hash Verilator prerequisites
id: verilator-hash
uses: colluca/[email protected]
with:
working-directory: target/snitch_cluster
target: bin/snitch_cluster.vlt
flags: --recursive
- name: Set up cache for Verilator build
id: verilator-cache
uses: actions/cache@v3
with:
path: target/snitch_cluster/bin
key: verilator-${{ steps.verilator-hash.outputs.hash }}
restore-keys: |
verilator-
- name: Build Hardware
if: steps.verilator-cache.outputs.cache-hit != 'true'
working-directory: target/snitch_cluster
run: |
make CFG_OVERRIDE=cfg/github-ci.hjson VLT_JOBS=1 bin/snitch_cluster.vlt
- name: Build Software
working-directory: target/snitch_cluster
run: |
make CFG_OVERRIDE=cfg/github-ci.hjson sw
- name: Run Tests
working-directory: target/snitch_cluster
run: |
./util/run.py sw/run.yaml --simulator verilator -j
./util/run.py sw/fdiv.yaml --simulator verilator -j
- name: Annotate traces
working-directory: target/snitch_cluster
run: |
make SIM_DIR=./runs/simple annotate -j
# #########################################
# # Build SW on Snitch Cluster w/ Banshee #
# #########################################
# sw-snitch-cluster-banshee:
# name: Simulate SW on Snitch Cluster w/ Banshee
# runs-on: ubuntu-22.04
# needs: build-docker
# if: >
# github.event_name != 'pull_request' ||
# github.event.pull_request.head.repo.full_name != github.repository
# container:
# image: ghcr.io/pulp-platform/snitch_cluster:${{ github.ref_name }}
# steps:
# - uses: actions/checkout@v2
# with:
# submodules: 'recursive'
# - name: Build Software
# run: |
# bender vendor init
# make -C target/snitch_cluster SELECT_RUNTIME=banshee sw
# - name: Run Tests
# env:
# SNITCH_LOG: info
# working-directory: target/snitch_cluster
# run: |
# ./util/run.py sw/run.yaml --simulator banshee -j
######################
# Sources Up-to-Date #
######################
sources-up-to-date:
name: Check Sources Up-to-Date
runs-on: ubuntu-22.04
needs: build-docker
if: >
github.event_name != 'pull_request' ||
github.event.pull_request.head.repo.full_name != github.repository
container:
image: ghcr.io/pulp-platform/snitch_cluster:${{ github.ref_name }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Generate opcodes
run: |
./util/generate-opcodes.sh
- name: Generate RTL sources
working-directory: target/snitch_cluster
run: |
make rtl
# For some reason, the checkout is done by a different user,
# than that running `git diff` (root, possibly due to Docker).
# So we need to set the repository as a safe directory.
- name: Git config safe.directory
run: |
git config --global --add safe.directory $GITHUB_WORKSPACE
- name: Diff porcelain
uses: mmontes11/[email protected]
with:
message: Found differences, please update all sources