diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml new file mode 100644 index 000000000..f8f7f609a --- /dev/null +++ b/.github/workflows/rust.yml @@ -0,0 +1,80 @@ +name: Rust + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build_and_test: + name: Build and run tests + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v2 + + - name: Download OVMF + run: | + # Save the current branch + git branch travis-temp + # Checkout the firmware branch + git fetch origin ovmf:ovmf + git checkout ovmf + # Download it with Git LFS + git lfs pull + # Copy it to the local directory + cp -v x86_64/*.fd . + # Checkout the original repo back + git checkout travis-temp + # Move the firmware files to the right directory + mv -v *.fd uefi-test-runner + + - name: Install qemu + run: sudo apt-get install qemu -y + + - name: Install latest nightly + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + override: true + components: rust-src + # TODO: cache Rust binaries + + - name: Install cargo-xbuild + run: hash cargo-xbuild || cargo install cargo-xbuild + # TODO: cache the built cargo-xbuild binary + + - name: Build + run: ./build.py build + working-directory: ./uefi-test-runner + + - name: Run tests + run: ./build.py run --headless + working-directory: ./uefi-test-runner + + lints: + name: Lints + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v2 + + - name: Install latest nightly + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + override: true + components: rustfmt, clippy + + - name: Run cargo fmt + uses: actions-rs/cargo@v1 + with: + command: fmt + args: --all -- --check + + - name: Run cargo clippy + uses: actions-rs/cargo@v1 + with: + command: clippy + args: -- -D warnings