Skip to content

ci: add multi-language formatting checks - #440

Merged
agicy merged 6 commits into
devfrom
luanlai/ci-fmt
Nov 23, 2026
Merged

agicy merged 6 commits into
devfrom
luanlai/ci-fmt

Conversation

@agicy

@agicy agicy commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add a dedicated format workflow for Rust, C, Python, TOML, JSON, and YAML, and apply the formatters to the existing tree.

The Rust checks cover cargo fmt plus direct rustfmt for build.rs, platform/*/*/board.rs, and hvisor-tool/examples/**/*.rs. The old __board.rs symlink workaround is removed because the final build system generates the board module in OUT_DIR.

Motivation

cargo fmt follows the Rust module graph. Board files under platform/ and Rust examples under hvisor-tool/ were outside that graph, and the old format workflow had to create a source-tree symlink just to make cargo fmt resolve src/platform/mod.rs. That left most board files unchecked.

The repository also contains C, JSON, YAML, TOML, and Python configuration and tooling; formatting them in one dedicated workflow avoids duplicating format commands between ci.yml and local scripts.

Verification

Passed:

  • cargo fmt --all -- --check
  • rustfmt --check --edition 2021 for all non-src Rust:
    • build.rs
    • platform/*/*/board.rs (all 23 board files)
    • hvisor-tool/examples/**/*.rs
  • aarch64/qemu-gicv3 build was rechecked on the stacked branch.

Not run locally:

  • Prettier YAML/JSON checks.
  • Taplo TOML check.
  • Ruff Python check.
  • clang-format C check.

These run in GitHub Actions and are limited by locally installed tools.

Risks and Limitations

  • This PR contains a large formatting diff, including existing files.
  • The following classes are intentionally not gated yet:
    • GNU assembly .S
    • shell .sh
    • device tree .dts/.dtsi
    • linker scripts .ld
    • Markdown
    • Makefiles
    • Kconfig
    • Jenkinsfile
  • Shell, assembly, and Markdown have large existing diffs and need separate changes.

@agicy
agicy requested review from li041 and peikachu November 21, 2026 03:12
@agicy agicy added ci Github CI enhancement labels Nov 21, 2026
@agicy agicy self-assigned this Nov 21, 2026
@agicy
agicy force-pushed the luanlai/ci-fmt branch 4 times, most recently from 0008aaa to bfa676f Compare November 21, 2026 03:31

@li041 li041 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Two small robustness fixes for the Format workflow (clang-format version pin, rustfmt board coverage).

Comment thread .github/workflows/format.yml Resolved
Comment thread .github/workflows/format.yml Resolved
@agicy
agicy changed the base branch from dev to luanlai/toolchain-upgrade November 23, 2026 05:10
@agicy
agicy added this pull request to stack #444 November 23, 2026 05:11
@agicy
agicy force-pushed the luanlai/ci-fmt branch 2 times, most recently from 7c8776f to 9c5f3d4 Compare November 23, 2026 08:19
Base automatically changed from luanlai/toolchain-upgrade to dev November 23, 2026 11:47
Format tracked YAML files first and add a YAML format check to the new Format workflow.
Add rustfmt to the Format workflow and remove the obsolete make fmt-test call from CI.
Add clang-format to the Format workflow using the existing hvisor-tool style.
Normalize tracked JSON files to four-space indentation and check JSON in the Format workflow.
Normalize tracked TOML files to four-space indentation, add taplo.toml, and check TOML in the Format workflow.
Format tracked Python files with Ruff and check Python in the Format workflow.
@agicy agicy changed the title ci: add formatter checks for Rust, C, JSON, YAML, TOML, and Python ci: add multi-language formatting checks Nov 23, 2026

@li041 li041 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

@agicy
agicy merged commit c9c2487 into dev Nov 23, 2026
9 of 32 checks passed
@agicy
agicy deleted the luanlai/ci-fmt branch November 23, 2026 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants