-
Notifications
You must be signed in to change notification settings - Fork 10
179 lines (173 loc) · 6.53 KB
/
build_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
---
#------------------------------------------------------------------------------
# QEMU OpenTitan CI
#
# Copyright (c) 2023-2024 Rivos, Inc.
# SPDX-License-Identifier: Apache License 2.0
#------------------------------------------------------------------------------
name: Build & Test QEMU OT
on: [pull_request]
jobs:
build-clang:
runs-on: ubuntu-latest
steps:
- name: Install deps
run: |
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key |
sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc &&
sudo add-apt-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main" &&
sudo apt-get update &&
sudo apt-get install -y git make pkg-config clang-18 cmake ninja-build python3 rust-all \
libpixman-1-dev
- name: Check out QEMU
uses: actions/checkout@v4
- name: Configure
run: |
rm -rf build-clang
git clean -dffx subprojects
mkdir build-clang
(cd build-clang &&
../configure --cc=clang-18 --disable-werror --disable-install-blobs \
--target-list=riscv32-softmmu,riscv64-softmmu)
- name: Build
run: |
ninja -C build-clang &&
ninja -C build-clang qemu-img &&
strip build-clang/qemu-system-riscv32
- name: Create minimal test binaries
run: |
scripts/opentitan/swexit.py -t ibexdemo -b 0x0 -o build-clang/exit_id.bin
scripts/opentitan/swexit.py -t earlgrey -b 0x80 -o build-clang/exit_eg.bin
scripts/opentitan/swexit.py -t darjeeling -b 0x80 -o build-clang/exit_dj.bin
- name: Upload QEMU binary artifacts
uses: actions/upload-artifact@v3
with:
name: qemu-bin
path: |
build-clang/qemu-system-riscv32
build-clang/exit_*.bin
retention-days: 1
- name: Pack source artifacts
# GitHub takes ages to retrieve each source file, so pack them
run: |
tar czf qemu-src-artifact.tar.gz \
subprojects/libtomcrypt/src/headers/*.h \
build-clang/*.h \
build-clang/qapi/*.h \
build-clang/trace/*.h \
build-clang/compile_commands.json
- name: Upload QEMU source artifacts
uses: actions/upload-artifact@v3
with:
name: qemu-src
path: qemu-src-artifact.tar.gz
retention-days: 1
format:
runs-on: ubuntu-latest
steps:
- name: Install tools
run: |
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key |
sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc &&
sudo add-apt-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main" &&
sudo apt-get update &&
sudo apt-get install -y clang-format-18
- name: Check out QEMU
uses: actions/checkout@v4
- name: Check C code format
run: |
scripts/opentitan/ot-format.sh --ci -i
lint-python:
runs-on: ubuntu-latest
steps:
- name: Install tools
run: |
sudo apt-get update &&
sudo apt-get install -y python3-pip
# ubuntu "latest" is too old to require --break-system-packages ...
pip3 install pylint
- name: Check out QEMU
uses: actions/checkout@v4
- name: Lint Python code
run: |
pylint --rcfile scripts/opentitan/.pylintrc -d 'duplicate-code' -d 'fixme' \
scripts/opentitan/*.py python/qemu/jtag python/qemu/ot
lint-clang:
runs-on: ubuntu-latest
needs: build-clang
steps:
- name: Install tools
run: |
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key |
sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc &&
sudo add-apt-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main" &&
sudo apt-get update &&
sudo apt-get install -y clang-tidy-18
- name: Check out QEMU
uses: actions/checkout@v4
- name: Download QEMU source artifacts
uses: actions/download-artifact@v3
with:
name: qemu-src
- name: Unpack source artifacts
run: |
tar xzf qemu-src-artifact.tar.gz
- name: Clang tidy
# Expect many warnings/errors (accounted but not reported) from included QEMU files
run: |
scripts/opentitan/ot-tidy.sh --ci -p build-clang
test-clang:
runs-on: ubuntu-latest
needs: build-clang
steps:
- name: Install tools
run: |
sudo apt-get update &&
sudo apt-get install -y libpixman-1-0
- name: Download QEMU binary artifacts
uses: actions/download-artifact@v3
with:
name: qemu-bin
- name: Check machine availability
run: |
chmod +x ./qemu-system-riscv32 &&
./qemu-system-riscv32 -M help | grep ibexdemo &&
./qemu-system-riscv32 -M help | grep ot-earlgrey &&
./qemu-system-riscv32 -M help | grep ot-darjeeling
- name: Check IbexDemo VM execution
run: |
timeout -s KILL 4 ./qemu-system-riscv32 -M ibexdemo -nographic \
-device loader,addr=0x100080,file=exit_id.bin -d in_asm,int
- name: Check EarlGrey VM execution
run: |
timeout -s KILL 4 ./qemu-system-riscv32 -M ot-earlgrey,no_epmp_cfg=true -nographic \
-object ot-rom_img,id=rom,file=exit_eg.bin -d in_asm,int
- name: Check Darjeeling VM execution
run: |
timeout -s KILL 4 ./qemu-system-riscv32 -M ot-darjeeling,no_epmp_cfg=true -nographic \
-global ot-ibex_wrapper-dj.lc-ignore=on \
-object ot-rom_img,id=rom0,file=exit_dj.bin -d in_asm,int
build-gcc:
runs-on: ubuntu-latest
steps:
- name: Install tools
run: |
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key |
sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc &&
sudo add-apt-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main" &&
sudo apt-get update &&
sudo apt-get install -y git make pkg-config gcc cmake ninja-build python3 rust-all \
libpixman-1-dev
- name: Check out QEMU
uses: actions/checkout@v4
- name: Configure
run: |
rm -rf build-gcc
git clean -dffx subprojects
mkdir build-gcc
(cd build-gcc &&
../configure --cc=gcc --enable-werror --disable-install-blobs \
--target-list=riscv32-softmmu,riscv64-softmmu)
- name: Build
run: |
ninja -C build-gcc