CI: non-zero exit if cargo-derivefmt-* targets fail

A previous commit made a change to show an error message and a diff if
cargo-derivefmt check failed, but did not exit with a non-zero code,
thus allowing the failed check to pass.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
This commit is contained in:
Manos Pitsidianakis 2024-12-05 15:32:08 +02:00
parent d49344f9d8
commit ece6bfc2ce
No known key found for this signature in database
GPG key ID: 7729C7707F7E09D0

View file

@ -42,7 +42,7 @@ cargo-derivefmt-melib:
@printf "Checking that derives are sorted alphabetically...\n"
cargo derivefmt --manifest-path ./melib/Cargo.toml
@$(GIT) checkout --quiet meli/src/conf/overrides.rs
@($(GIT) diff --quiet ./melib && $(GIT) diff --cached --quiet ./melib && printf "All ./melib derives are sorted alphabetically.\n") || (printf "Some derives in the ./melib crate are not sorted alphabetically, see diff:\n"; $(GIT) diff HEAD)
@($(GIT) diff --quiet ./melib && $(GIT) diff --cached --quiet ./melib && printf "All ./melib derives are sorted alphabetically.\n") || (printf "Some derives in the ./melib crate are not sorted alphabetically, see diff:\n"; $(GIT) diff HEAD; exit 1)
.PHONY: cargo-derivefmt-meli
cargo-derivefmt-meli:
@ -50,7 +50,7 @@ cargo-derivefmt-meli:
@printf "Checking that derives are sorted alphabetically...\n"
cargo derivefmt --manifest-path ./meli/Cargo.toml
@$(GIT) checkout --quiet meli/src/conf/overrides.rs
@($(GIT) diff --quiet ./meli && $(GIT) diff --cached --quiet ./meli && printf "All ./meli derives are sorted alphabetically.\n") || (printf "Some derives in the ./meli crate are not sorted alphabetically, see diff:\n"; $(GIT) diff HEAD)
@($(GIT) diff --quiet ./meli && $(GIT) diff --cached --quiet ./meli && printf "All ./meli derives are sorted alphabetically.\n") || (printf "Some derives in the ./meli crate are not sorted alphabetically, see diff:\n"; $(GIT) diff HEAD; exit 1)
.PHONY: cargo-derivefmt-tools
cargo-derivefmt-tools:
@ -58,4 +58,4 @@ cargo-derivefmt-tools:
@printf "Checking that derives are sorted alphabetically...\n"
cargo derivefmt --manifest-path ./tools/Cargo.toml
@$(GIT) checkout --quiet meli/src/conf/overrides.rs
@($(GIT) diff --quiet ./tools && $(GIT) diff --cached --quiet ./tools && printf "All ./tools derives are sorted alphabetically.\n") || (printf "Some derives in the ./tools crate are not sorted alphabetically, see diff:\n"; $(GIT) diff HEAD)
@($(GIT) diff --quiet ./tools && $(GIT) diff --cached --quiet ./tools && printf "All ./tools derives are sorted alphabetically.\n") || (printf "Some derives in the ./tools crate are not sorted alphabetically, see diff:\n"; $(GIT) diff HEAD; exit 1)