Merge pull request #507 from AdamCDunlap/vanadium_initial_state #1539
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Rust | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
check: | |
name: Check | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Install specified rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: '1.82.0' | |
target: x86_64-unknown-none | |
profile: minimal | |
override: true | |
components: rustfmt, rust-src, clippy | |
- name: Install Microsoft TPM build dependencies | |
run: sudo apt install -y autoconf autoconf-archive pkg-config build-essential automake | |
- name: Check that Cargo.lock is up to date | |
uses: actions-rs/cargo@v1 | |
with: | |
command: update | |
args: --workspace --locked | |
# ubuntu-latest does not have binutils 2.39, which we need for | |
# ld to work, so build all the objects without performing the | |
# final linking step. | |
- name: Build | |
run: make FEATURES="default,enable-gdb" bin/svsm-kernel.elf stage1/stage1.o stage1/reset.o | |
- name: Run tests | |
run: make test | |
- name: Format | |
uses: actions-rs/cargo@v1 | |
with: | |
command: fmt | |
args: --all -- --check | |
- name: Clippy on no_std x86_64-unknown-none | |
uses: actions-rs/cargo@v1 | |
with: | |
command: clippy | |
args: --workspace --exclude igvmbuilder --exclude igvmmeasure --exclude svsm-fuzz --all-features -- -D warnings | |
- name: Clippy on std x86_64-unknown-linux-gnu | |
uses: actions-rs/cargo@v1 | |
with: | |
command: clippy | |
args: --workspace --all-features --exclude svsm --exclude svsm-fuzz --target=x86_64-unknown-linux-gnu -- -D warnings | |
- name: Clippy on svsm-fuzz | |
uses: actions-rs/cargo@v1 | |
with: | |
command: clippy | |
args: --package svsm-fuzz --all-features --target=x86_64-unknown-linux-gnu -- -D warnings | |
env: | |
RUSTFLAGS: --cfg fuzzing | |
- name: Clippy on tests | |
uses: actions-rs/cargo@v1 | |
with: | |
command: clippy | |
args: --workspace --all-features --tests --target=x86_64-unknown-linux-gnu -- -D warnings | |
- name: Check documentation | |
run: make doc | |
env: | |
RUSTDOCFLAGS: -D warnings | |
nightly-check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Install latest nightly | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly | |
target: x86_64-unknown-none | |
profile: minimal | |
override: true | |
components: rustfmt | |
# The bindings.rs is auto-generated during make, but we are not | |
# building the code with nightly. So we initialize bindings.rs here | |
# for cargo-fmt in the next workflow, otherwise it will fail reporting | |
# that bindings.rs does not exist. | |
- name: Touch libmstpm bindings | |
run: echo "" > libmstpm/src/bindings.rs | |
- name: Format doctests | |
uses: actions-rs/cargo@v1 | |
with: | |
command: fmt | |
args: --all -- --check --config "format_code_in_doc_comments=true" |