|
| 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