-
Notifications
You must be signed in to change notification settings - Fork 21
120 lines (112 loc) · 4.64 KB
/
ci.yml
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
name: CI
on:
pull_request:
merge_group:
env:
GH_TOKEN: ${{ github.token }}
RUSTFLAGS: -Dwarnings
RUSTDOCFLAGS: -Dwarnings
defaults:
run:
shell: bash
jobs:
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Clippy
run: cargo xtask clippy
fmt:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- name: Check Formatting
run: cargo fmt -- --check
run:
name: Run
strategy:
matrix:
target: [x86_64, aarch64, riscv64]
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- target: x86_64
os: ubuntu-latest
flags: --accel --sudo
runs-on: ${{ matrix.os }}
steps:
- name: Install QEMU (ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install qemu-system-x86 qemu-system-arm qemu-system-misc
- name: Install QEMU (macos)
if: matrix.os == 'macos-latest'
run: |
brew update
brew install qemu
- name: Install QEMU (windows)
if: matrix.os == 'windows-latest'
run: |
choco install qemu
echo "C:\Program Files\qemu" >> $GITHUB_PATH
- name: Install firecracker
run: |
# https://github.com/firecracker-microvm/firecracker/blob/v1.5.1/docs/getting-started.md#getting-a-firecracker-binary
ARCH="$(uname -m)"
release_url="https://github.com/firecracker-microvm/firecracker/releases"
latest=$(basename $(curl -fsSLI -o /dev/null -w %{url_effective} ${release_url}/latest))
curl -L ${release_url}/download/${latest}/firecracker-${latest}-${ARCH}.tgz \
| tar -xz
mkdir -p $HOME/.local/bin
mv release-${latest}-$(uname -m)/firecracker-${latest}-${ARCH} $HOME/.local/bin/firecracker
echo $HOME/.local/bin >> $GITHUB_PATH
$HOME/.local/bin/firecracker --version
if: matrix.os == 'ubuntu-latest' && matrix.target == 'x86_64'
- uses: actions/checkout@v4
with:
lfs: true
- name: Install stable Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Dowload OpenSBI
if: matrix.target == 'riscv64'
run: |
gh release download v1.5.1 --repo riscv-software-src/opensbi --pattern 'opensbi-*-rv-bin.tar.xz'
tar -xvf opensbi-*-rv-bin.tar.xz opensbi-1.5.1-rv-bin/share/opensbi/lp64/generic/firmware/fw_jump.bin
- name: Run VM (hello_world, dev)
run: cargo xtask ci qemu ${{ matrix.flags }} --target ${{ matrix.target }}
- name: Run VM (hello_world, release)
run: cargo xtask ci qemu ${{ matrix.flags }} --target ${{ matrix.target }} --release
- name: Run VM (hello_world, uefi, dev)
run: cargo xtask ci qemu ${{ matrix.flags }} --target ${{ matrix.target }}-uefi
if: matrix.target == 'x86_64'
- name: Run VM (hello_world, uefi, release)
run: cargo xtask ci qemu ${{ matrix.flags }} --target ${{ matrix.target }}-uefi --release
if: matrix.target == 'x86_64'
- name: Run VM (hello_world-microvm, dev)
if: matrix.target == 'x86_64' && matrix.os == 'ubuntu-latest'
run: cargo xtask ci qemu ${{ matrix.flags }} --target ${{ matrix.target }} --microvm
- name: Run VM (hello_world-microvm, release)
if: matrix.target == 'x86_64' && matrix.os == 'ubuntu-latest'
run: cargo xtask ci qemu ${{ matrix.flags }} --target ${{ matrix.target }} --microvm --release
- name: Run VM (hello_c, dev)
if: matrix.target == 'x86_64'
run: cargo xtask ci qemu ${{ matrix.flags }} --target ${{ matrix.target }} --image hello_c
- name: Run VM (hello_c, release)
if: matrix.target == 'x86_64'
run: cargo xtask ci qemu ${{ matrix.flags }} --target ${{ matrix.target }} --image hello_c --release
- name: Run VM (hello_world-microvm, fc, release)
run: FIRECRACKER=$HOME/.local/bin/firecracker cargo xtask ci firecracker --target ${{ matrix.target }}-fc --sudo
if: matrix.os == 'ubuntu-latest' && matrix.target == 'x86_64'
- name: Run VM (hello_world-microvm, fc, release)
run: FIRECRACKER=$HOME/.local/bin/firecracker cargo xtask ci firecracker --target ${{ matrix.target }}-fc --sudo --release
if: matrix.os == 'ubuntu-latest' && matrix.target == 'x86_64'