Skip to content

Commit f55c7da

Browse files
Set up CI through GitHub Actions (#125)
Try out GitHub Actions for CI * Install cargo-xbuild * Use nightly Rust * Add extra Rust components * Add code to checkout OVMF * Install qemu * Run tests headless and add rustfmt and clippy
1 parent 079ac7e commit f55c7da

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed

.github/workflows/rust.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Rust
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
build_and_test:
11+
name: Build and run tests
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout sources
15+
uses: actions/checkout@v2
16+
17+
- name: Download OVMF
18+
run: |
19+
# Save the current branch
20+
git branch travis-temp
21+
# Checkout the firmware branch
22+
git fetch origin ovmf:ovmf
23+
git checkout ovmf
24+
# Download it with Git LFS
25+
git lfs pull
26+
# Copy it to the local directory
27+
cp -v x86_64/*.fd .
28+
# Checkout the original repo back
29+
git checkout travis-temp
30+
# Move the firmware files to the right directory
31+
mv -v *.fd uefi-test-runner
32+
33+
- name: Install qemu
34+
run: sudo apt-get install qemu -y
35+
36+
- name: Install latest nightly
37+
uses: actions-rs/toolchain@v1
38+
with:
39+
toolchain: nightly
40+
override: true
41+
components: rust-src
42+
# TODO: cache Rust binaries
43+
44+
- name: Install cargo-xbuild
45+
run: hash cargo-xbuild || cargo install cargo-xbuild
46+
# TODO: cache the built cargo-xbuild binary
47+
48+
- name: Build
49+
run: ./build.py build
50+
working-directory: ./uefi-test-runner
51+
52+
- name: Run tests
53+
run: ./build.py run --headless
54+
working-directory: ./uefi-test-runner
55+
56+
lints:
57+
name: Lints
58+
runs-on: ubuntu-latest
59+
steps:
60+
- name: Checkout sources
61+
uses: actions/checkout@v2
62+
63+
- name: Install latest nightly
64+
uses: actions-rs/toolchain@v1
65+
with:
66+
toolchain: nightly
67+
override: true
68+
components: rustfmt, clippy
69+
70+
- name: Run cargo fmt
71+
uses: actions-rs/cargo@v1
72+
with:
73+
command: fmt
74+
args: --all -- --check
75+
76+
- name: Run cargo clippy
77+
uses: actions-rs/cargo@v1
78+
with:
79+
command: clippy
80+
args: -- -D warnings

0 commit comments

Comments
 (0)