Use `cargo-action-fmt` to annotate PRs
[`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]:
@@ -14,6 +14,7 @@ permissions:
contents: read
env:
+ CARGO_ACTION_FMT_VERSION: v0.1.3
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
RUST_BACKTRACE: short
@@ -52,9 +53,13 @@ jobs:
container:
image: docker://rust:1.56.1
steps:
- - uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
- run: rustup component add clippy
- - run: cargo clippy --workspace --all-targets
+ - uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
+ - run: |
+ 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"
+ chmod 755 /usr/local/bin/cargo-action-fmt
+ - run: cargo fetch
+ - run: cargo clippy --frozen --all --message-format=json | cargo-action-fmt
check:
timeout-minutes: 20
@@ -63,13 +68,17 @@ jobs:
image: docker://rust:1.56.1
steps:
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
+ - run: |
+ 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"
+ chmod 755 /usr/local/bin/cargo-action-fmt
+ - run: cargo fetch
# Check each crate independently to ensure its Cargo.toml is sufficient.
- run: |
for toml in $(find . -mindepth 2 -name Cargo.toml | sort -r)
do
d=$(dirname "$toml")
echo "# $d"
- (cd $d ; cargo check --all-targets)
+ (cd $d ; cargo check --all-targets --frozen --message-format=json | cargo-action-fmt)
done
test:
