-
Notifications
You must be signed in to change notification settings - Fork 0
179 lines (146 loc) · 4.74 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
# SPDX-FileCopyrightText: 2022 Google LLC
#
# SPDX-License-Identifier: Apache-2.0
name: CI
on: [push]
# Updating Rust versions:
#
# When updating to a newer (or older) version of Rust for the main build process
# then the version should be updated in the /rust-toolchain.toml file too.
# That file determines which version gets used locally on developer machines.
jobs:
license-check:
runs-on: ubuntu-22.04
container:
image: ubuntu:22.04
steps:
- uses: actions/checkout@v4
- name: REUSE Compliance Check
uses: fsfe/reuse-action@v2
rust-checks:
name: Rust checks
runs-on: ubuntu-22.04
container:
image: ubuntu:22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies
run: |
apt-get update
apt-get install -y curl build-essential
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.67 # See Note [Updating Rust versions]
profile: minimal
target: riscv32imc-unknown-none-elf
components: clippy, rustfmt
- name: Rust formatting
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --target riscv32imc-unknown-none-elf --all-features
rust-build-programs:
name: Build Programs
runs-on: ubuntu-22.04
container:
image: ubuntu:22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies
run: |
apt-get update
apt-get install -y curl build-essential
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.67.1 # See Note [Updating Rust versions]
profile: minimal
target: riscv32imc-unknown-none-elf
components: clippy, rustfmt
- name: Caching
uses: Swatinem/rust-cache@v2
- name: Build release binaries
uses: actions-rs/cargo@v1
with:
command: build
args: --release
- name: Build debug binaries
uses: actions-rs/cargo@v1
with:
command: build
- name: Archive Integration Test Binaries
run: |
cd clash-vexriscv-sim; sh bundle_test_binaries.sh
- name: Upload Integration Test Binaries
uses: actions/upload-artifact@v3
with:
name: vexriscv-test-binaries
path: clash-vexriscv-sim/vexriscv-test-binaries.tar
vex-riscv:
name: VexRiscv integration
runs-on: ubuntu-22.04
needs: [rust-build-programs]
strategy:
fail-fast: false
matrix:
ghc:
- "9.0.2"
- "9.2.8"
- "9.4.8"
container:
image: ghcr.io/clash-lang/clash-vexriscv-ci:${{ matrix.ghc }}-20240329
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Update Cabal index info
run: |
cp .github/cabal.project cabal.project.local
cabal update
cabal freeze
- name: Cache
uses: actions/cache@v3
with:
path: |
~/.local/state/cabal/store/
key: packages-cachebust-3-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze', 'cabal.project') }}
restore-keys: packages-cachebust-3-${{ matrix.ghc }}
- name: Stash existing VexRiscv.v
run: |
cp clash-vexriscv/example-cpu/VexRiscv.v clash-vexriscv/example-cpu/VexRiscv.v.comitted
- name: Build clash-vexriscv
run: |
export PKG_CONFIG_PATH=/opt/share/pkgconfig/:${PKG_CONFIG_PATH}
cabal build clash-vexriscv
- name: Check whether committed VexRiscv.v corresponds to generated one
run: |
diff -u clash-vexriscv/example-cpu/VexRiscv.v clash-vexriscv/example-cpu/VexRiscv.v.comitted
- name: Build clash-vexriscv-sim
run: |
cabal build clash-vexriscv-sim
- name: Download VexRiscv Integration Tests
uses: actions/download-artifact@v3
with:
name: vexriscv-test-binaries
- name: Work around dubious owner error
run: |
git config --global --add safe.directory "$(pwd)"
- name: Extract VexRiscv Integration Tests
run: |
tar -x -f vexriscv-test-binaries.tar
- name: OpenOCD bin symlink
run: |
ln -s /opt/bin/openocd /opt/bin/openocd-vexriscv
- name: Run `clash-vexriscv` unittests
run: |
cabal run clash-vexriscv:unittests
- name: Run `clash-vexriscv-sim` unittests
run: |
cabal run clash-vexriscv-sim:unittests -- -j2
- name: Run `clash-vexriscv-sim` HDL test
run: |
cabal run clash-vexriscv-sim:hdl-test