Skip to content

ci: Use cargo xtask fmt --check #1348

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

Merged
merged 3 commits into from
Aug 24, 2024
Merged
Changes from all commits
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
13 changes: 9 additions & 4 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,16 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- name: Run cargo fmt
- name: Install yamlfmt
env:
YFV: "0.13.0"
HASH: "043e96d754a8afa4f4c5c13ffb2f3e50c6be5a70bf53292d3025abc0b42fe4ae"
run: |
rustup component add rustfmt
cargo fmt --all -- --check
curl -L --fail --output /tmp/yamlfmt.tar.xz https://github.com/google/yamlfmt/releases/download/v${YFV}/yamlfmt_${YFV}_Linux_x86_64.tar.gz
Copy link
Member

@phip1611 phip1611 Aug 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: If we add nix, this could be a simple nix-shell --run "cargo xtask fmt --check". Similar to here https://github.com/rust-osdev/uefi-rs/blob/main/.github/workflows/developer_productivity.yml#L50

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, but looks like a bit of additional work is needed since the nix files currently fail the format check, and also https://github.com/nix-community/nixpkgs-fmt has been deprecated. I'll go ahead and merge the version without nix, and we can follow up with another PR later.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohh.. I had no clue that it is deprecated (to be fair, only since very recently) . Thanks!

echo "${HASH} /tmp/yamlfmt.tar.xz" | sha256sum --check
tar xf /tmp/yamlfmt.tar.xz -C /usr/local/bin yamlfmt
- name: Check formatting
run: cargo xtask fmt --check
- name: Run clippy
run: |
rustup component add clippy
Expand Down Expand Up @@ -131,7 +137,6 @@ jobs:
- uses: Swatinem/rust-cache@v2
- name: Build
run: cargo package -p uefi -p uefi-raw -p uefi-macros

# This job requires the nightly channel, but keep it as a separate job from
# `nightly_channel` because it takes a while to run.
build_feature_permutations:
Expand Down