| 1 |
# |
| 2 |
# Rust Test Suite |
| 3 |
# |
| 4 |
# This workflow builds the project via Cargo, configures a suitable test |
| 5 |
# environment, and then runs the test-suite defined in Cargo. |
| 6 |
# |
| 7 |
|
| 8 |
name: "Rust Test Suite" |
| 9 |
|
| 10 |
on: |
| 11 |
pull_request: |
| 12 |
push: |
| 13 |
branches-ignore: ["pr/**"] |
| 14 |
tags: ["**"] |
| 15 |
workflow_dispatch: |
| 16 |
|
| 17 |
defaults: |
| 18 |
run: |
| 19 |
shell: "bash" |
| 20 |
|
| 21 |
jobs: |
| 22 |
# |
| 23 |
# CI with Default Configuration |
| 24 |
# |
| 25 |
# This simply runs `cargo build && cargo test` on all sources. We want to |
| 26 |
# explicitly ensure that this project stays compatible to the stable channel |
| 27 |
# and the standard build setup. |
| 28 |
# |
| 29 |
ci: |
| 30 |
name: "Default - rust-${{ matrix.rust }}@${{ matrix.os }}" |
| 31 |
|
| 32 |
strategy: |
| 33 |
fail-fast: false |
| 34 |
matrix: |
| 35 |
os: ["ubuntu-latest"] |
| 36 |
rust: ["nightly", "stable"] |
| 37 |
|
| 38 |
runs-on: ${{ matrix.os }} |
| 39 |
|
| 40 |
steps: |
| 41 |
- name: "Fetch Sources" |
| 42 |
uses: actions/checkout@v3 |
| 43 |
- name: "Install Rust Components" |
| 44 |
run: rustup default "${{ matrix.rust }}" |
| 45 |
- name: "Build Project" |
| 46 |
run: cargo build --verbose --all-targets |
| 47 |
- name: "Run Tests" |
| 48 |
run: cargo test --verbose |
| 49 |
|
| 50 |
# |
| 51 |
# Cross-Compilation to UEFI Target |
| 52 |
# |
| 53 |
# This cross-compiles all sources (including the examples) for native UEFI |
| 54 |
# targets. This test ensures that we can actually compile for our main target |
| 55 |
# platforms. |
| 56 |
# |
| 57 |
ci-cross: |
| 58 |
name: "Cross-Compilation - ${{ matrix.target }}/rust-${{ matrix.rust }}@${{ matrix.os }}" |
| 59 |
|
| 60 |
strategy: |
| 61 |
fail-fast: false |
| 62 |
matrix: |
| 63 |
os: ["ubuntu-latest"] |
| 64 |
rust: ["nightly", "stable"] |
| 65 |
target: |
| 66 |
- "aarch64-unknown-uefi" |
| 67 |
- "i686-unknown-uefi" |
| 68 |
- "x86_64-unknown-uefi" |
| 69 |
|
| 70 |
runs-on: ${{ matrix.os }} |
| 71 |
|
| 72 |
steps: |
| 73 |
- name: "Fetch Sources" |
| 74 |
uses: actions/checkout@v3 |
| 75 |
- name: "Install Rust Components" |
| 76 |
run: | |
| 77 |
rustup default "${{ matrix.rust }}" |
| 78 |
rustup target add --toolchain "${{ matrix.rust }}" "${{ matrix.target }}" |
| 79 |
- name: "Build Project" |
| 80 |
run: | |
| 81 |
cargo build \ |
| 82 |
--examples \ |
| 83 |
--features native \ |
| 84 |
--lib \ |
| 85 |
--target "${{ matrix.target }}" \ |
| 86 |
--verbose |
| 87 |
|
| 88 |
# |
| 89 |
# Bootstrap to UEFI Target |
| 90 |
# |
| 91 |
# This uses the `-Zbuild-std` feature to fully bootstrap a native UEFI target |
| 92 |
# via cross-compilation. This currently requires a nightly compiler. |
| 93 |
# |
| 94 |
ci-bootstrap: |
| 95 |
name: "Bootstrap - ${{ matrix.target }}/rust-${{ matrix.rust }}@${{ matrix.os }}" |
| 96 |
|
| 97 |
strategy: |
| 98 |
fail-fast: false |
| 99 |
matrix: |
| 100 |
os: ["ubuntu-latest"] |
| 101 |
rust: ["nightly"] |
| 102 |
target: |
| 103 |
- "aarch64-unknown-uefi" |
| 104 |
- "i686-unknown-uefi" |
| 105 |
- "x86_64-unknown-uefi" |
| 106 |
|
| 107 |
runs-on: ${{ matrix.os }} |
| 108 |
|
| 109 |
steps: |
| 110 |
- name: "Fetch Sources" |
| 111 |
uses: actions/checkout@v3 |
| 112 |
- name: "Install Rust Components" |
| 113 |
run: | |
| 114 |
rustup default "${{ matrix.rust }}" |
| 115 |
rustup component add --toolchain "${{ matrix.rust }}" rust-src |
| 116 |
- name: "Build Project" |
| 117 |
run: | |
| 118 |
cargo build \ |
| 119 |
-Zbuild-std=core,compiler_builtins,alloc \ |
| 120 |
-Zbuild-std-features=compiler-builtins-mem \ |
| 121 |
--examples \ |
| 122 |
--features native \ |
| 123 |
--lib \ |
| 124 |
--target "${{ matrix.target }}" \ |
| 125 |
--verbose |