|  | 
|  | 1 | +name: Rust | 
|  | 2 | + | 
|  | 3 | +on: | 
|  | 4 | +  push: | 
|  | 5 | +    branches: | 
|  | 6 | +      - main | 
|  | 7 | +      - version-* | 
|  | 8 | +  pull_request: | 
|  | 9 | +    branches: | 
|  | 10 | +      - main | 
|  | 11 | +      - version-* | 
|  | 12 | +  schedule: | 
|  | 13 | +    - cron:  '0 0 * * 0-6' | 
|  | 14 | + | 
|  | 15 | +jobs: | 
|  | 16 | +  test_aarch64: | 
|  | 17 | +    name: Build and run tests on AArch64 | 
|  | 18 | +    runs-on: ubuntu-latest | 
|  | 19 | +    steps: | 
|  | 20 | +    - name: Checkout sources | 
|  | 21 | +      uses: actions/checkout@v2 | 
|  | 22 | + | 
|  | 23 | +    - name: Install qemu and OVMF | 
|  | 24 | +      run: | | 
|  | 25 | +        # Ubuntu 20.04 provides qemu 4.2, which crashes on exit in this | 
|  | 26 | +        # test. Add a PPA to provide a more recent version of qemu. | 
|  | 27 | +        sudo add-apt-repository ppa:canonical-server/server-backports | 
|  | 28 | +        sudo apt-get update | 
|  | 29 | +        sudo apt-get install qemu-system-arm qemu-efi-aarch64 -y | 
|  | 30 | +
 | 
|  | 31 | +    - name: Build | 
|  | 32 | +      run: cargo xtask build --target aarch64 | 
|  | 33 | + | 
|  | 34 | +    - name: Run VM tests | 
|  | 35 | +      run: cargo xtask run --target aarch64 --headless --ci | 
|  | 36 | +      timeout-minutes: 2 | 
|  | 37 | + | 
|  | 38 | +  test_x86_64: | 
|  | 39 | +    name: Build and run tests on x86_64 | 
|  | 40 | +    runs-on: ubuntu-latest | 
|  | 41 | +    steps: | 
|  | 42 | +    - name: Checkout sources | 
|  | 43 | +      uses: actions/checkout@v2 | 
|  | 44 | + | 
|  | 45 | +    - name: Install qemu and OVMF | 
|  | 46 | +      run: | | 
|  | 47 | +        sudo apt-get update | 
|  | 48 | +        sudo apt-get install qemu-system-x86 ovmf -y | 
|  | 49 | +
 | 
|  | 50 | +    - name: Build | 
|  | 51 | +      run: cargo xtask build --target x86_64 | 
|  | 52 | + | 
|  | 53 | +    - name: Run VM tests | 
|  | 54 | +      run: cargo xtask run --target x86_64 --headless --ci | 
|  | 55 | +      timeout-minutes: 2 | 
|  | 56 | + | 
|  | 57 | +  test_ia32: | 
|  | 58 | +    name: Build and run tests on IA32 | 
|  | 59 | +    runs-on: ubuntu-latest | 
|  | 60 | +    steps: | 
|  | 61 | +    - name: Checkout sources | 
|  | 62 | +      uses: actions/checkout@v2 | 
|  | 63 | + | 
|  | 64 | +    - name: Install qemu | 
|  | 65 | +      run: | | 
|  | 66 | +        # Ubuntu 20.04 provides qemu 4.2, which crashes on exit in this | 
|  | 67 | +        # test. Add a PPA to provide a more recent version of qemu. | 
|  | 68 | +        sudo add-apt-repository ppa:canonical-server/server-backports | 
|  | 69 | +        sudo apt-get update | 
|  | 70 | +        sudo apt-get install qemu-system-x86 -y | 
|  | 71 | +
 | 
|  | 72 | +    # Starting in ubuntu 21.04 there's an `ovmf-ia32` package, but the | 
|  | 73 | +    # github runners are on ubuntu 20.04. For now, install the OVMF | 
|  | 74 | +    # files from a repo that provides unofficial nightly builds: | 
|  | 75 | +    # https://github.com/retrage/edk2-nightly | 
|  | 76 | +    - name: Install OVMF | 
|  | 77 | +      env: | 
|  | 78 | +        # Pin to a specific commit in the retrage/edk2-nightly repo to | 
|  | 79 | +        # guard against external changes breaking the CI. | 
|  | 80 | +        EDK2_NIGHTLY_COMMIT: 'ebb83e5475d49418afc32857f66111949928bcdc' | 
|  | 81 | +      run: | | 
|  | 82 | +        curl -o OVMF32_CODE.fd https://raw.githubusercontent.com/retrage/edk2-nightly/${EDK2_NIGHTLY_COMMIT}/bin/RELEASEIa32_OVMF_CODE.fd | 
|  | 83 | +        curl -o OVMF32_VARS.fd https://raw.githubusercontent.com/retrage/edk2-nightly/${EDK2_NIGHTLY_COMMIT}/bin/RELEASEIa32_OVMF_VARS.fd | 
|  | 84 | +
 | 
|  | 85 | +    - name: Build | 
|  | 86 | +      run: cargo xtask build --target ia32 | 
|  | 87 | + | 
|  | 88 | +    - name: Run VM tests | 
|  | 89 | +      run: cargo xtask run --target ia32 --headless --ci --ovmf-code OVMF32_CODE.fd --ovmf-vars OVMF32_VARS.fd | 
|  | 90 | +      timeout-minutes: 2 | 
|  | 91 | + | 
|  | 92 | +  test: | 
|  | 93 | +    name: Run tests and documentation tests | 
|  | 94 | +    runs-on: ubuntu-latest | 
|  | 95 | +    steps: | 
|  | 96 | +      - name: Checkout sources | 
|  | 97 | +        uses: actions/checkout@v2 | 
|  | 98 | + | 
|  | 99 | +      - name: Run cargo test | 
|  | 100 | +        run: cargo xtask test | 
|  | 101 | + | 
|  | 102 | +  lints: | 
|  | 103 | +    name: Lints | 
|  | 104 | +    runs-on: ubuntu-latest | 
|  | 105 | +    steps: | 
|  | 106 | +      - name: Checkout sources | 
|  | 107 | +        uses: actions/checkout@v2 | 
|  | 108 | + | 
|  | 109 | +      - name: Run cargo fmt | 
|  | 110 | +        run: | | 
|  | 111 | +          rustup component add rustfmt | 
|  | 112 | +          cargo fmt --all -- --check | 
|  | 113 | +
 | 
|  | 114 | +      - name: Run clippy | 
|  | 115 | +        run: | | 
|  | 116 | +          rustup component add clippy | 
|  | 117 | +          cargo xtask clippy --warnings-as-errors | 
|  | 118 | +
 | 
|  | 119 | +      - name: Run cargo doc | 
|  | 120 | +        run: cargo xtask doc --warnings-as-errors | 
|  | 121 | + | 
|  | 122 | +  miri: | 
|  | 123 | +    name: Run unit tests and doctests under Miri | 
|  | 124 | +    runs-on: ubuntu-latest | 
|  | 125 | +    steps: | 
|  | 126 | +      - name: Checkout sources | 
|  | 127 | +        uses: actions/checkout@v2 | 
|  | 128 | + | 
|  | 129 | +      - name: Run miri | 
|  | 130 | +        run: | | 
|  | 131 | +          rustup component add miri | 
|  | 132 | +          cargo xtask miri | 
|  | 133 | +
 | 
|  | 134 | +  # This job tests that the template app builds successfully with the | 
|  | 135 | +  # released versions of the libraries on crates.io. | 
|  | 136 | +  # | 
|  | 137 | +  # Since a nightly toolchain is currently required to build uefi-rs, | 
|  | 138 | +  # the released versions can suddenly stop building when a new nightly | 
|  | 139 | +  # compiler with a breaking change is released. This job provides an | 
|  | 140 | +  # alert when this situation occurs. | 
|  | 141 | +  test_latest_release: | 
|  | 142 | +    name: Build the template against the released version of uefi-rs | 
|  | 143 | +    runs-on: ubuntu-latest | 
|  | 144 | +    steps: | 
|  | 145 | +    - name: Checkout sources | 
|  | 146 | +      uses: actions/checkout@v2 | 
|  | 147 | + | 
|  | 148 | +    - name: Build | 
|  | 149 | +      run: cargo xtask test-latest-release | 
|  | 150 | + | 
|  | 151 | +  windows: | 
|  | 152 | +    name: Check that the build works on a Windows target | 
|  | 153 | +    runs-on: windows-latest | 
|  | 154 | +    steps: | 
|  | 155 | +      - name: Checkout sources | 
|  | 156 | +        uses: actions/checkout@v2 | 
|  | 157 | + | 
|  | 158 | +      - name: Build | 
|  | 159 | +        run: cargo xtask build | 
|  | 160 | + | 
|  | 161 | +  # Run the build with our current nightly MSRV (specified in | 
|  | 162 | +  # ./msrv_toolchain.toml). This serves to check that we don't | 
|  | 163 | +  # accidentally start relying on a new feature without intending | 
|  | 164 | +  # to. Having a test for this makes it easier for us to be intentional | 
|  | 165 | +  # about making changes that require a newer version. | 
|  | 166 | +  build_msrv: | 
|  | 167 | +    name: Check that the build works on our nightly MSRV | 
|  | 168 | +    runs-on: ubuntu-latest | 
|  | 169 | +    steps: | 
|  | 170 | +    - name: Checkout sources | 
|  | 171 | +      uses: actions/checkout@v2 | 
|  | 172 | + | 
|  | 173 | +    - name: Set toolchain | 
|  | 174 | +      run: cp .github/workflows/msrv_toolchain.toml rust-toolchain.toml | 
|  | 175 | + | 
|  | 176 | +    - name: Build | 
|  | 177 | +      run: cargo xtask build | 
0 commit comments