Skip to content

Commit 4d030f9

Browse files
authored
Use cargo-action-fmt to annotate PRs (#7876)
[`cargo-action-fmt`][caf] reads `cargo` output and generates GitHub action errors that properly annotate source locations. This change updates our CI workflows to use `cargo-action-fmt` so that errors are more clearly annotated in PRs. [caf]: https://github.com/olix0r/cargo-action-fmt Signed-off-by: Oliver Gould <[email protected]>
1 parent ae034f0 commit 4d030f9

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

.github/workflows/policy_controller.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ permissions:
1414
contents: read
1515

1616
env:
17+
CARGO_ACTION_FMT_VERSION: v0.1.3
1718
CARGO_INCREMENTAL: 0
1819
CARGO_NET_RETRY: 10
1920
RUST_BACKTRACE: short
@@ -52,9 +53,13 @@ jobs:
5253
container:
5354
image: docker://rust:1.56.1
5455
steps:
55-
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
5656
- run: rustup component add clippy
57-
- run: cargo clippy --workspace --all-targets
57+
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
58+
- run: |
59+
bin/scurl -o /usr/local/bin/cargo-action-fmt "https://github.com/olix0r/cargo-action-fmt/releases/download/release%2F${CARGO_ACTION_FMT_VERSION}/cargo-action-fmt-x86_64-unknown-linux-gnu"
60+
chmod 755 /usr/local/bin/cargo-action-fmt
61+
- run: cargo fetch
62+
- run: cargo clippy --frozen --all --message-format=json | cargo-action-fmt
5863

5964
check:
6065
timeout-minutes: 20
@@ -63,13 +68,17 @@ jobs:
6368
image: docker://rust:1.56.1
6469
steps:
6570
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
71+
- run: |
72+
bin/scurl -o /usr/local/bin/cargo-action-fmt "https://github.com/olix0r/cargo-action-fmt/releases/download/release%2F${CARGO_ACTION_FMT_VERSION}/cargo-action-fmt-x86_64-unknown-linux-gnu"
73+
chmod 755 /usr/local/bin/cargo-action-fmt
74+
- run: cargo fetch
6675
# Check each crate independently to ensure its Cargo.toml is sufficient.
6776
- run: |
6877
for toml in $(find . -mindepth 2 -name Cargo.toml | sort -r)
6978
do
7079
d=$(dirname "$toml")
7180
echo "# $d"
72-
(cd $d ; cargo check --all-targets)
81+
(cd $d ; cargo check --all-targets --frozen --message-format=json | cargo-action-fmt)
7382
done
7483
7584
test:

0 commit comments

Comments
 (0)