Skip to content

Commit c157827

Browse files
committed
ci: consolidate integration tests on github runners
GitHub runners support nested virtualization (only on x86_64), so consolidate the integration and unit tests on them to simplify the workflows. Signed-off-by: Sergio Lopez <[email protected]>
1 parent 3d75392 commit c157827

File tree

1 file changed

+62
-12
lines changed

1 file changed

+62
-12
lines changed
Lines changed: 62 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,18 @@
1-
name: Code Quality (rustfmt and clippy)
1+
name: linux-x86_64
22
on: [pull_request, create]
33

44
jobs:
55
build:
66
if: github.event_name == 'pull_request'
7-
name: Code Quality (clippy, rustfmt)
7+
name: Code Quality (fmt, clippy)
88
runs-on: ubuntu-latest
9-
strategy:
10-
matrix:
11-
rust:
12-
- stable
13-
target:
14-
- x86_64-unknown-linux-gnu
159
steps:
1610
- name: Code checkout
1711
uses: actions/checkout@v2
18-
- name: Install Rust toolchain (${{ matrix.rust }})
12+
- name: Install Rust toolchain
1913
uses: actions-rs/toolchain@v1
2014
with:
21-
toolchain: ${{ matrix.rust }}
22-
target: ${{ matrix.target }}
23-
override: true
15+
toolchain: stable
2416
components: rustfmt, clippy
2517

2618
- name: Install packages
@@ -40,3 +32,61 @@ jobs:
4032

4133
- name: Clippy (net+blk+gpu+snd features)
4234
run: cargo clippy --features net,blk,gpu,snd -- -D warnings
35+
36+
unit:
37+
if: github.event_name == 'pull_request'
38+
name: Unit Tests
39+
runs-on: ubuntu-latest
40+
steps:
41+
- name: Code checkout
42+
uses: actions/checkout@v2
43+
- name: Install Rust toolchain
44+
uses: actions-rs/toolchain@v1
45+
with:
46+
toolchain: stable
47+
components: rustfmt, clippy
48+
49+
- name: Enable KVM group perms
50+
run: |
51+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
52+
sudo udevadm control --reload-rules
53+
sudo udevadm trigger --name-match=kvm
54+
sudo usermod -a -G kvm $USER
55+
56+
- name: Install packages
57+
run: sudo apt-get update && sudo apt-get install -y libvirglrenderer-dev libepoxy-dev libdrm-dev libpipewire-0.3-dev
58+
59+
- name: Create a fake init
60+
run: touch init/init
61+
62+
- name: Unit tests
63+
run: cargo test
64+
65+
integration:
66+
if: github.event_name == 'pull_request'
67+
name: Integration Tests
68+
runs-on: ubuntu-latest
69+
steps:
70+
- name: Code checkout
71+
uses: actions/checkout@v2
72+
- name: Install Rust toolchain
73+
uses: actions-rs/toolchain@v1
74+
with:
75+
toolchain: stable
76+
target: x86_64-unknown-linux-musl
77+
78+
- name: Enable KVM group perms
79+
run: |
80+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
81+
sudo udevadm control --reload-rules
82+
sudo udevadm trigger --name-match=kvm
83+
sudo usermod -a -G kvm $USER
84+
85+
- name: Install packages
86+
run: sudo apt-get update && sudo apt-get install -y build-essential patchelf libclang-dev pkg-config net-tools libvirglrenderer-dev libepoxy-dev libdrm-dev libpipewire-0.3-dev
87+
88+
- name: Install libkrunfw
89+
run: curl -L -o /tmp/libkrunfw-4.9.0-x86_64.tgz https://github.com/containers/libkrunfw/releases/download/v4.9.0/libkrunfw-4.9.0-x86_64.tgz && mkdir tmp && tar xf /tmp/libkrunfw-4.9.0-x86_64.tgz -C tmp && sudo mv tmp/lib64/* /lib/x86_64-linux-gnu
90+
91+
- name: Integration tests
92+
run: KRUN_NO_UNSHARE=1 make test

0 commit comments

Comments
 (0)