-
Notifications
You must be signed in to change notification settings - Fork 8
231 lines (231 loc) · 7.98 KB
/
build-and-test.yaml
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
name: Build and test
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Install Dependencies
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y cmake build-essential libfmt-dev
sudo apt-get install -y gperf build-essential bison flex libreadline-dev gawk tcl-dev libffi-dev git graphviz xdot pkg-config python3 libboost-system-dev libboost-python-dev libboost-filesystem-dev zlib1g-dev
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Initialize submodules
run: |
git submodule init
- name: Find out Yosys revision
run: |
{
echo -n "YOSYS_HASH="
git submodule status --cached tests/third_party/yosys | awk '{print $1}'
} >> $GITHUB_ENV
- name: Cache Yosys build
id: cache-yosys
uses: actions/cache@v4
env:
cache-name: cache-yosys
with:
path: tests/third_party/yosys
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.YOSYS_HASH }}-patched
- if: ${{ steps.cache-yosys.outputs.cache-hit != 'true' }}
name: Pull Yosys
run: |
git submodule update --depth 0 -- tests/third_party/yosys
- if: ${{ steps.cache-yosys.outputs.cache-hit != 'true' }}
name: Build Yosys
shell: bash
run: |
cd tests/third_party/yosys
make config-gcc
echo "ENABLE_ABC := 0" >> Makefile.conf
patch -p1 < ../cxxrtl-work-around-issue-3549.patch
make -j6
- name: Install Yosys
shell: bash
run: |
cd tests/third_party/yosys
sudo make install
- name: Find out Slang revision
run: |
{
echo -n "SLANG_HASH="
git submodule status --cached third_party/slang | awk '{print $1}'
} >> $GITHUB_ENV
- name: Find out Makefile revision
run: |
{
echo -n "MAKEFILE_HASH="
git log -n 1 --pretty=format:%H -- Makefile
} >> $GITHUB_ENV
- name: Cache Slang build
id: cache-slang
uses: actions/cache@v4
env:
cache-name: cache-slang
with:
path: build/slang_install
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.SLANG_HASH }}-${{ env.MAKEFILE_HASH }}
- if: ${{ steps.cache-slang.outputs.cache-hit != 'true' }}
name: Pull Slang
run: |
git submodule update --depth 0 -- third_party/slang
- name: Build yosys-slang
run: |
make -j$(nproc)
- name: Pack build
shell: bash
run: |
tar -cvf build.tar build/slang.so tests/third_party/yosys/
- name: Store build artifact
uses: actions/upload-artifact@v4
with:
name: build.tar
path: build.tar
retention-days: 1
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
needs: [build]
steps:
- name: Install Dependencies
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y cmake build-essential libfmt-dev
sudo apt-get install -y gperf build-essential bison flex libreadline-dev gawk tcl-dev libffi-dev git graphviz xdot pkg-config python3 libboost-system-dev libboost-python-dev libboost-filesystem-dev zlib1g-dev
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Initialize submodules
run: |
git submodule init
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: build.tar
- name: Unpack build
shell: bash
run:
tar -xvf build.tar
- name: Install Yosys
shell: bash
run: |
cd tests/third_party/yosys
sudo make install
- name: Run tests
run: |
tests/run.sh
test-croc-boot:
runs-on: ubuntu-latest
strategy:
fail-fast: false
needs: [build]
env:
# bender -d . script flist-plus --relative-path > croc.f
# /patch absolute paths in croc.f/
# tar --exclude='.git' --exclude='*/libs.doc/*' -cvf ../croc-checkout-250109-846ce38.tar .
CROC_CHECKOUT: 'croc-checkout-250109-846ce38.tar.gz'
CROC_CHECKOUT_HASH: 'd86fbfdd9105b1849a62565b3b9cdfe63d2c856eaef2a460b409d9ce0c970d38 croc-checkout-250109-846ce38.tar.gz'
steps:
- name: Install Dependencies
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y cmake build-essential libfmt-dev
sudo apt-get install -y gperf build-essential bison flex libreadline-dev gawk tcl-dev libffi-dev git graphviz xdot pkg-config python3 libboost-system-dev libboost-python-dev libboost-filesystem-dev zlib1g-dev
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Initialize submodules
run: |
git submodule init
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: build.tar
- name: Unpack build
shell: bash
run:
tar -xvf build.tar
- name: Install Yosys
shell: bash
run: |
cd tests/third_party/yosys
sudo make install
- name: Cache Croc checkout
id: cache-croc
uses: actions/cache@v4
env:
cache-name: cache-croc
with:
path: tests/third_party/croc
key: ${{ env.CROC_CHECKOUT }}
- if: ${{ steps.cache-yosys.outputs.cache-hit != 'true' }}
name: Unpack Croc
run: |
wget https://cutebit.org/$CROC_CHECKOUT
echo "$CROC_CHECKOUT_HASH" | sha256sum --check
tar -xvf $CROC_CHECKOUT -C tests/third_party/croc/
- name: Install OpenOCD
run: |
wget https://github.com/xpack-dev-tools/openocd-xpack/releases/download/v0.12.0-4/xpack-openocd-0.12.0-4-linux-x64.tar.gz
sudo tar xvf xpack-openocd-0.12.0-4-linux-x64.tar.gz -C /opt
echo "/opt/xpack-openocd-0.12.0-4/bin" >> $GITHUB_PATH
- name: Run OpenOCD once
run: |
openocd -v
- name: Run tests
run: |
tests/croc_boot/run.sh
test-compat:
runs-on: ubuntu-latest
strategy:
matrix:
ip: [black-parrot, bsc-core_tile, cv32e40p, ibex, opentitan, rsd]
fail-fast: false
needs: [build]
steps:
- name: Install Dependencies
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y cmake build-essential libfmt-dev
sudo apt-get install -y gperf build-essential bison flex libreadline-dev gawk tcl-dev libffi-dev git graphviz xdot pkg-config python3 libboost-system-dev libboost-python-dev libboost-filesystem-dev zlib1g-dev
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: build.tar
- name: Unpack build
shell: bash
run:
tar -xvf build.tar
- name: Install Yosys
shell: bash
run: |
cd tests/third_party/yosys
sudo make install
- name: Pull IP sources
run: |
git clone https://github.com/povik/yosys-slang-compat-suite/ compat-suite --depth 1
cd compat-suite
git submodule init ${{ matrix.ip }}
git submodule update --init --recursive --depth 1 ${{ matrix.ip }}
- if: ${{ matrix.ip == 'opentitan' }}
run: |
# https://stackoverflow.com/questions/77490435/attributeerror-cython-sources
echo "cython<3" > /tmp/constraint.txt
sudo apt-get install libxml2-dev libxslt-dev
PIP_CONSTRAINT=/tmp/constraint.txt pip3 install --user -r compat-suite/opentitan/python-requirements.txt --require-hashes
- name: Run script
run: |
cd compat-suite
yosys -m ../build/slang.so ${{ matrix.ip }}.tcl