-
Notifications
You must be signed in to change notification settings - Fork 10
156 lines (151 loc) · 5.88 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
#------------------------------------------------------------------------------
# QEMU OpenTitan CI
#
# Copyright (c) 2023 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-16 main" &&
sudo apt-get update &&
sudo apt-get install -y git make pkg-config clang-16 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-16 --disable-werror --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 earlgrey -o build-clang/exit_eg.bin
scripts/opentitan/swexit.py -t darjeeling -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-16 main" &&
sudo apt-get update &&
sudo apt-get install -y clang-format-16
- name: Check out QEMU
uses: actions/checkout@v4
- name: Check execution
run: |
clang-format-16 -i \
hw/opentitan/*.c hw/opentitan/*.h include/hw/opentitan/*.h \
hw/riscv/ibex*.c include/hw/riscv/ibex*.h target/riscv/ibex*.c \
hw/riscv/ot_*.c include/hw/riscv/ot_*.h
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-16 main" &&
sudo apt-get update &&
sudo apt-get install -y clang-tidy-16
- 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: |
clang-tidy -p build-clang \
hw/opentitan/*.c \
hw/riscv/ot_*.c \
hw/riscv/ibex*.c \
target/riscv/ibex_csr.c
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 ot-earlgrey &&
./qemu-system-riscv32 -M help | grep ot-darjeeling
- 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,digest=fake,addr=0x8080 -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,digest=fake,addr=0x8080 -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-16 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 --target-list=riscv32-softmmu,riscv64-softmmu)
- name: Build
run: |
ninja -C build-gcc