Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arm64 Build and Packaging Improvements #35

Merged
merged 7 commits into from
Jan 31, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
ci: add support for different target architectures in pipelines
wmmc88 committed Jan 25, 2024
commit 82db40f8286b82d4faf971de4a010feecece1b1d
12 changes: 8 additions & 4 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -25,6 +25,10 @@ jobs:
- dev
- release

target_triple:
- x86_64-pc-windows-msvc
- aarch64-pc-windows-msvc

steps:
- name: Checkout Repository
uses: actions/checkout@v4
@@ -44,15 +48,15 @@ jobs:
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust_toolchain }}
targets: ${{ matrix.target_triple }}

- name: Run Cargo Build
run: cargo build --locked --profile ${{ matrix.cargo_profile }} --workspace
run: cargo +${{ matrix.rust_toolchain }} build --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple }} --workspace

- name: Install Cargo Make
uses: taiki-e/install-action@v2
with:
tool: cargo-make

- name: Build and Package Sample KMDF Driver
run: cargo make --cwd .\crates\sample-kmdf-driver --profile ${{ matrix.cargo_profile }}
continue-on-error: true # FIXME: Packaging tools in non-ewdk environments are not found
- name: Build and Package Sample Drivers
run: cargo make default +${{ matrix.rust_toolchain }} --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple }}
2 changes: 1 addition & 1 deletion .github/workflows/code-formatting-check.yaml
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ jobs:
components: rustfmt

- name: Run Cargo Format
run: cargo fmt --all -- --check
run: cargo +nightly fmt --all -- --check

taplo-fmt:
name: .toml Formatting Check
21 changes: 19 additions & 2 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -25,6 +25,10 @@ jobs:
- dev
- release

target_triple:
- x86_64-pc-windows-msvc
- aarch64-pc-windows-msvc

steps:
- name: Checkout Repository
uses: actions/checkout@v4
@@ -44,10 +48,23 @@ jobs:
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust_toolchain }}
targets: ${{ matrix.target_triple }}

- name: Run Cargo Doc
run: cargo doc --locked --profile ${{ matrix.cargo_profile }}
# proc-macro crates must be excluded to avoid cargo doc bug: https://github.com/rust-lang/cargo/issues/10368
run: cargo +${{ matrix.rust_toolchain }} doc --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple }} --workspace --exclude wdk-macros

- name: Run Cargo Doc (--features nightly)
if: matrix.rust_toolchain == 'nightly'
run: cargo doc --locked --profile ${{ matrix.cargo_profile }} --features nightly
# proc-macro crates must be excluded to avoid cargo doc bug: https://github.com/rust-lang/cargo/issues/10368
run: cargo +${{ matrix.rust_toolchain }} doc --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple }} --workspace --exclude wdk-macros --features nightly

- name: Run Cargo Doc w/ proc-macro crates
if: matrix.target_triple == 'x86_64-pc-windows-msvc'
# cargo doc can only generate documentation for proc-macro crates when --target is not specified due to a cargo doc bug: https://github.com/rust-lang/cargo/issues/7677
run: cargo +${{ matrix.rust_toolchain }} doc --locked --profile ${{ matrix.cargo_profile }}

- name: Run Cargo Doc w/ proc-macro crates (--features nightly)
if: ${{ matrix.target_triple == 'x86_64-pc-windows-msvc' && matrix.rust_toolchain == 'nightly' }}
# cargo doc can only generate documentation for proc-macro crates when --target is not specified due to a cargo doc bug: https://github.com/rust-lang/cargo/issues/7677
run: cargo +${{ matrix.rust_toolchain }} doc --locked --profile ${{ matrix.cargo_profile }} --features nightly
15 changes: 10 additions & 5 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -27,6 +27,10 @@ jobs:
- dev
- release

target_triple:
- x86_64-pc-windows-msvc
- aarch64-pc-windows-msvc

steps:
- name: Checkout Repository
uses: actions/checkout@v4
@@ -47,13 +51,14 @@ jobs:
with:
toolchain: ${{ matrix.rust_toolchain }}
components: clippy
targets: ${{ matrix.target_triple }}

- name: Run Cargo Clippy
run: cargo clippy --locked --profile ${{ matrix.cargo_profile }} --all-targets -- -D warnings
run: cargo +${{ matrix.rust_toolchain }} clippy --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple }} --all-targets -- -D warnings

- name: Run Cargo Clippy (--features nightly)
if: matrix.rust_toolchain == 'nightly'
run: cargo clippy --locked --profile ${{ matrix.cargo_profile }} --all-targets --features nightly -- -D warnings
run: cargo +${{ matrix.rust_toolchain }} clippy --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple }} --all-targets --features nightly -- -D warnings

udeps:
name: Detect Unused Cargo Dependencies
@@ -79,16 +84,16 @@ jobs:
}

- name: Install Rust Toolchain (Nightly)
uses: dtolnay/rust-toolchain@nightly
# Cargo udeps only supports running on nightly due to reliance on unstable dep-info feature: https://github.com/est31/cargo-udeps/issues/113, https://github.com/est31/cargo-udeps/issues/136
uses: dtolnay/rust-toolchain@nightly

- name: Install Cargo Udeps
uses: taiki-e/install-action@v2
with:
tool: cargo-udeps

- name: Run Cargo Udeps
run: cargo udeps --locked --all-targets
run: cargo +nightly udeps --locked --all-targets

- name: Run Cargo Udeps (--features nightly)
run: cargo udeps --locked --all-targets --features nightly
run: cargo +nightly udeps --locked --all-targets --features nightly
11 changes: 7 additions & 4 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -25,6 +25,10 @@ jobs:
- dev
- release

target_triple:
- x86_64-pc-windows-msvc
# - aarch64-pc-windows-msvc FIXME: Add support for executing ARM64 tests. Maybe use target specific test runner in emulator: https://doc.rust-lang.org/cargo/reference/config.html#target
wmmc88 marked this conversation as resolved.
Show resolved Hide resolved

steps:
- name: Checkout Repository
uses: actions/checkout@v4
@@ -44,6 +48,7 @@ jobs:
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust_toolchain }}
targets: ${{ matrix.target_triple }}

- name: Install Cargo Expand
uses: taiki-e/install-action@v2
@@ -52,10 +57,8 @@ jobs:

# FIXME: wdk-sys layout tests fail, but only on github hosted runner
- name: Run Cargo Test
# Final driver crates must be excluded since theres no way to prevent linker args from being passed to their unit tests: https://github.com/rust-lang/cargo/issues/12663
run: cargo test --locked --profile ${{ matrix.cargo_profile }} --workspace --exclude sample-* --exclude wdk-sys
run: cargo +${{ matrix.rust_toolchain }} test --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple }} --workspace --exclude wdk-sys

- name: Run Cargo Test (--features nightly)
if: matrix.rust_toolchain == 'nightly'
# Final driver crates must be excluded since theres no way to prevent linker args from being passed to their unit tests: https://github.com/rust-lang/cargo/issues/12663
run: cargo test --locked --profile ${{ matrix.cargo_profile }} --features nightly --workspace --exclude sample-* --exclude wdk-sys
run: cargo +${{ matrix.rust_toolchain }} test --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple }} --workspace --exclude wdk-sys --features nightly
2 changes: 2 additions & 0 deletions crates/sample-kmdf-driver/Cargo.toml
Original file line number Diff line number Diff line change
@@ -12,6 +12,8 @@ publish = false

[lib]
crate-type = ["cdylib"]
# Tests from root driver crates must be excluded since there's no way to prevent linker args from being passed to their unit tests: https://github.com/rust-lang/cargo/issues/12663
test = false

[dependencies]
wdk.workspace = true
2 changes: 0 additions & 2 deletions rust-driver-makefile.toml
Original file line number Diff line number Diff line change
@@ -13,8 +13,6 @@ CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true
# This is set to "" here to match the default behavior of Cargo.
CARGO_MAKE_CARGO_BUILD_TEST_FLAGS = { unset = true }

# FIXME: add --locked for CI builds using CARGO_MAKE_PR and CARGO_MAKE_CI

[plugins.impl.rust-env-update]
script = '''
assert ${task.has_script} "script is required for rust-env-update plugin"