Skip to content

Commit 4158ad1

Browse files
committed
build: 增加 ci
Signed-off-by: YdrMaster <ydrml@hotmail.com>
1 parent 665a8f4 commit 4158ad1

File tree

2 files changed

+70
-1
lines changed

2 files changed

+70
-1
lines changed

.github/workflows/workflow.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
env:
8+
qemu_version: 7.0.0
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-20.04
13+
steps:
14+
- uses: actions/checkout@v3
15+
- uses: actions-rs/toolchain@v1
16+
with:
17+
profile: minimal
18+
toolchain: nightly
19+
components: rustfmt, clippy
20+
target: riscv64imac-unknown-none-elf
21+
- name: Check format
22+
uses: actions-rs/cargo@v1
23+
with:
24+
command: fmt
25+
args: --all -- --check
26+
- name: Clippy
27+
uses: actions-rs/cargo@v1
28+
with:
29+
command: clippy
30+
31+
test:
32+
runs-on: ubuntu-20.04
33+
steps:
34+
- uses: actions/checkout@v3
35+
- uses: actions-rs/toolchain@v1
36+
with:
37+
profile: minimal
38+
toolchain: nightly
39+
components: llvm-tools-preview
40+
target: riscv64imac-unknown-none-elf
41+
42+
- name: Cache QEMU
43+
id: cache-qemu
44+
uses: actions/cache@v3
45+
with:
46+
path: qemu-${{ env.qemu_version }}
47+
key: qemu-${{ env.qemu_version }}
48+
49+
- name: Install ninja-build
50+
run: sudo apt-get update && sudo apt-get install -y ninja-build
51+
52+
- name: Download and Compile QEMU
53+
if: steps.cache-qemu.outputs.cache-hit != 'true'
54+
run: |
55+
wget https://download.qemu.org/qemu-${{ env.qemu_version }}.tar.xz
56+
tar xf qemu-${{ env.qemu_version }}.tar.xz
57+
cd qemu-${{ env.qemu_version }}
58+
./configure --target-list=riscv64-softmmu
59+
make -j
60+
61+
- name: Install QEMU
62+
run: |
63+
cd qemu-${{ env.qemu_version }} && sudo make install
64+
qemu-system-riscv64 --version
65+
66+
- name: Test
67+
uses: actions-rs/cargo@v1
68+
with:
69+
command: test

xtask/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ impl AsmArgs {
143143
} else {
144144
self.build.dir().join("rustsbi-qemu")
145145
};
146-
let out = PROJECT_DIR.join(self.output.clone().unwrap_or(format!(
146+
let out = PROJECT_DIR.join(self.output.unwrap_or(format!(
147147
"{}.asm",
148148
bin.file_stem().unwrap().to_string_lossy()
149149
)));

0 commit comments

Comments
 (0)