Skip to content

Commit 5b9aa0a

Browse files
svasista-mskrishnakumar4a4leon-xdleon-xdwmmc88
authored
feat: add cargo-wdk cargo extension (#306)
Signed-off-by: Shravan Vasista <[email protected]> Signed-off-by: Leon Durrenberger <[email protected]> Co-authored-by: krishnakumar4a4 <[email protected]> Co-authored-by: Krishna Kumar Thokala <[email protected]> Co-authored-by: Leon Durrenberger <[email protected]> Co-authored-by: leon-xd <[email protected]> Co-authored-by: Melvin Wang <[email protected]>
1 parent b82b427 commit 5b9aa0a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+13555
-74
lines changed

.github/workflows/build.yaml

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,10 @@ jobs:
3434
- release
3535

3636
target_triple:
37-
- x86_64-pc-windows-msvc
38-
- aarch64-pc-windows-msvc
37+
- name: x86_64-pc-windows-msvc
38+
arch: amd64
39+
- name: aarch64-pc-windows-msvc
40+
arch: arm64
3941

4042
steps:
4143
- name: Checkout Repository
@@ -70,21 +72,32 @@ jobs:
7072
uses: dtolnay/rust-toolchain@master
7173
with:
7274
toolchain: ${{ matrix.rust_toolchain }}
73-
targets: ${{ matrix.target_triple }}
75+
targets: |
76+
${{ matrix.target_triple.name }}
7477
7578
- name: Run Cargo Build
76-
run: cargo +${{ matrix.rust_toolchain }} build --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple }} --workspace --all-features
79+
run: cargo +${{ matrix.rust_toolchain }} build --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple.name }} --workspace --all-features
7780

7881
- name: Install Cargo Make
7982
uses: taiki-e/install-action@v2
8083
with:
8184
tool: cargo-make
8285

8386
- name: Run Cargo Make (package-driver-flow) in Workspace
84-
run: cargo make package-driver-flow +${{ matrix.rust_toolchain }} --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple }} --workspace
87+
run: cargo make package-driver-flow +${{ matrix.rust_toolchain }} --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple.name }} --workspace
8588

8689
- name: Build Examples (via Cargo Make)
87-
run: cargo make --cwd ./examples build +${{ matrix.rust_toolchain }} --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple }}
90+
run: cargo make --cwd ./examples build +${{ matrix.rust_toolchain }} --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple.name }}
8891

8992
- name: Package Examples (via Cargo Make)
90-
run: cargo make --cwd ./examples package-driver-flow +${{ matrix.rust_toolchain }} --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple }}
93+
run: cargo make --cwd ./examples package-driver-flow +${{ matrix.rust_toolchain }} --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple.name }}
94+
95+
# Run cargo-wdk on examples
96+
- name: Install cargo-wdk
97+
run: cargo +${{ matrix.rust_toolchain }} install --path=crates/cargo-wdk --profile ${{ matrix.cargo_profile }} --locked --force
98+
99+
- name: Build & Package Examples (via cargo-wdk)
100+
run: cargo +${{ matrix.rust_toolchain }} wdk build --cwd ./examples --profile ${{ matrix.cargo_profile }} --target-arch ${{ matrix.target_triple.arch }} --sample
101+
102+
- name: Run build on tests folder (via cargo-wdk)
103+
run: cargo +${{ matrix.rust_toolchain }} wdk build --cwd ./tests --profile ${{ matrix.cargo_profile }} --target-arch ${{ matrix.target_triple.arch }}

.github/workflows/code-formatting-check.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,24 @@ jobs:
4141

4242
- run: taplo fmt --check --diff
4343
name: Check TOML files formatting
44+
45+
cargo-sort:
46+
name: Check Dependencies are sorted lexicographically
47+
runs-on: windows-latest
48+
49+
steps:
50+
- name: Checkout Repository
51+
uses: actions/checkout@v4
52+
53+
- name: Install Rust Toolchain (Stable)
54+
uses: dtolnay/rust-toolchain@stable
55+
56+
# Installing cargo-sort from main branch since there is an unreleased fix
57+
# Ref: https://github.com/DevinR528/cargo-sort/issues/67#issuecomment-2486868511
58+
- name: Install cargo-sort binary from specific branch
59+
run: cargo install --git=https://github.com/DevinR528/cargo-sort cargo-sort --branch main --rev 4a1ecf093649b87fa610aec32a1bdaa4829d416b --locked --force
60+
61+
# -w for every crate in workspace, -g for keeping blank lines when sorting groups of deps,
62+
# -n do not run formatting, --check to only check without modifying files
63+
- run: cargo sort -g -w -n --check
64+
name: Check if dependencies in Cargo.toml are sorted

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
target/
2+
3+
# ignore lock file created during cargo-wdk's integration test runs
4+
crates/cargo-wdk/cargo-wdk-test.lock

CONTRIBUTING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ To maintain the quality of code, tests and tools are required to pass before con
137137
* `+nightly` is required to use some `nightly` configuration features in [the `rustfmt.toml` config](./rustfmt.toml)
138138
* Check for consistent `.toml` file formatting: `taplo fmt --check --diff`
139139
* Running `taplo fmt` resolves these formatting inconsistencies usually
140+
* Check for sorted sections and dependencies listed in the `Cargo.toml` files: `cargo sort -w -g -n --check`
141+
* Running `cargo sort -w -g -n` resolves any formatting inconsistencies.
140142
141143
**_Dependency Analysis:_**
142144

0 commit comments

Comments
 (0)