Skip to content

Commit 7300658

Browse files
authored
Merge pull request #34 from duskmoon314/test-multi-version
ci: use rustsbi/qemu to test multiple version
2 parents 2704f3c + 2be0e00 commit 7300658

File tree

1 file changed

+21
-32
lines changed

1 file changed

+21
-32
lines changed

.github/workflows/workflow.yml

Lines changed: 21 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
on:
44
push:
55
pull_request:
6-
7-
env:
8-
qemu_version: 7.0.0
6+
workflow_dispatch:
97

108
jobs:
119
build:
@@ -29,41 +27,32 @@ jobs:
2927
command: clippy
3028

3129
test:
30+
needs: build
3231
runs-on: ubuntu-20.04
32+
strategy:
33+
matrix:
34+
base-img: [slim]
35+
qemu-version: [6.2.0, 7.0.0, 7.1.0]
3336
steps:
3437
- 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
4138

42-
- name: Cache QEMU
43-
id: cache-qemu
44-
uses: actions/cache@v3
39+
- name: Login to GitHub Container Registry
40+
uses: docker/login-action@v2
4541
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
42+
registry: ghcr.io
43+
username: ${{ github.repository_owner }}
44+
password: ${{ secrets.GITHUB_TOKEN }}
5145

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
46+
- name: Pull image
47+
run: docker pull ghcr.io/rustsbi/qemu:${{ matrix.base-img }}-${{ matrix.qemu-version }}-rv64
6548

6649
- name: Test
67-
uses: actions-rs/cargo@v1
50+
uses: addnab/docker-run-action@v3
6851
with:
69-
command: test
52+
image: ghcr.io/rustsbi/qemu:${{ matrix.base-img }}-${{ matrix.qemu-version }}-rv64
53+
options: -v ${{ github.workspace }}:/work
54+
run: |
55+
rustup component add llvm-tools-preview
56+
rustup target add riscv64imac-unknown-none-elf
57+
cd /work
58+
cargo test

0 commit comments

Comments
 (0)