Skip to content

Commit

Permalink
CI/CD run now uses basic plus toml formatter for cargo
Browse files Browse the repository at this point in the history
CMK-19040

Change-Id: Ib7af6b5bdad8f2b9f280316295f6e502b225002b
  • Loading branch information
Owen Synge committed Jan 21, 2025
1 parent ff1cf73 commit d5d0d1e
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 4 deletions.
10 changes: 9 additions & 1 deletion packages/host/cmk-agent-ctl/run
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,14 @@ run_format() {
run_cargo_cmd_with_explicit_package fmt
}

run_check_format() {
${BAZEL_CMD} run \
--ui_event_filters=-info,-stderr \
--action_env=RUST_LOG=warn //bazel/tools:taplo_bin -- \
format --check --diff Cargo.toml
"${BAZEL_CMD}" build --config=rustfmt :all
}

main() {
# Change to the directory where this script resides, it makes many things easier
# and we can call this script from everywhere.
Expand All @@ -176,7 +184,7 @@ main() {
# machinery for Rust doesn't handle this yet.
test ${RUN_BUILD} = yes && run_cargo_cmd_with_explicit_package build --jobs="${JOBS}" --release --all-targets ${FEATURES:+"--features=$FEATURES"}
test ${RUN_UNIT_TESTS} = yes && RUST_BACKTRACE=full run_cargo_cmd_with_explicit_package test --jobs="${JOBS}" --release --all-targets ${FEATURES:+"--features=$FEATURES"}
test ${RUN_CHECK_FORMAT} = yes && "${BAZEL_CMD}" build --config=rustfmt :all
test ${RUN_CHECK_FORMAT} = yes && run_check_format
test ${RUN_CLIPPY} = yes && "${BAZEL_CMD}" build --config=clippy :all
test ${RUN_FORMAT} = yes && run_format
test ${RUN_DOCUMENTATION} = yes && run_cargo_cmd_with_explicit_package doc --jobs="${JOBS}" --release --lib --bins --examples ${FEATURES:+"--features=$FEATURES"}
Expand Down
10 changes: 9 additions & 1 deletion packages/host/mk-sql/run
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,14 @@ run_format() {
run_cargo_cmd_with_explicit_package fmt
}

run_check_format() {
${BAZEL_CMD} run \
--ui_event_filters=-info,-stderr \
--action_env=RUST_LOG=warn //bazel/tools:taplo_bin -- \
format --check --diff Cargo.toml
"${BAZEL_CMD}" build --config=rustfmt :all
}

main() {
# Change to the directory where this script resides, it makes many things easier
# and we can call this script from everywhere.
Expand All @@ -176,7 +184,7 @@ main() {
# machinery for Rust doesn't handle this yet.
test ${RUN_BUILD} = yes && run_cargo_cmd_with_explicit_package build --jobs="${JOBS}" --release --all-targets ${FEATURES:+"--features=$FEATURES"}
test ${RUN_UNIT_TESTS} = yes && RUST_BACKTRACE=full run_cargo_cmd_with_explicit_package test --jobs="${JOBS}" --release --all-targets ${FEATURES:+"--features=$FEATURES"}
test ${RUN_CHECK_FORMAT} = yes && "${BAZEL_CMD}" build --config=rustfmt :all
test ${RUN_CHECK_FORMAT} = yes && run_check_format
test ${RUN_CLIPPY} = yes && "${BAZEL_CMD}" build --config=clippy :all
test ${RUN_FORMAT} = yes && run_format
test ${RUN_DOCUMENTATION} = yes && run_cargo_cmd_with_explicit_package doc --jobs="${JOBS}" --release --lib --bins --examples ${FEATURES:+"--features=$FEATURES"}
Expand Down
10 changes: 9 additions & 1 deletion packages/site/check-cert/run
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,14 @@ run_format() {
run_cargo_cmd_with_explicit_package fmt
}

run_check_format() {
${BAZEL_CMD} run \
--ui_event_filters=-info,-stderr \
--action_env=RUST_LOG=warn //bazel/tools:taplo_bin -- \
format --check --diff Cargo.toml
"${BAZEL_CMD}" build --config=rustfmt :all
}

main() {
# Change to the directory where this script resides, it makes many things easier
# and we can call this script from everywhere.
Expand All @@ -173,7 +181,7 @@ main() {
# TODO: Re-evaluate usage of --all-targets below
test ${RUN_BUILD} = yes && "${BAZEL_CMD}" build :all
test ${RUN_UNIT_TESTS} = yes && RUST_BACKTRACE=full run_cargo_cmd_with_explicit_package test --jobs="${JOBS}" --release --all-targets ${FEATURES:+"--features=$FEATURES"}
test ${RUN_CHECK_FORMAT} = yes && "${BAZEL_CMD}" build --config=rustfmt :all
test ${RUN_CHECK_FORMAT} = yes && run_check_format
test ${RUN_CLIPPY} = yes && "${BAZEL_CMD}" build --config=clippy :all
test ${RUN_FORMAT} = yes && run_format
test ${RUN_DOCUMENTATION} = yes && run_cargo_cmd_with_explicit_package doc --jobs="${JOBS}" --release --lib --bins --examples ${FEATURES:+"--features=$FEATURES"}
Expand Down
10 changes: 9 additions & 1 deletion packages/site/check-http/run
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,14 @@ run_format() {
run_cargo_cmd_with_explicit_package fmt
}

run_check_format() {
${BAZEL_CMD} run \
--ui_event_filters=-info,-stderr \
--action_env=RUST_LOG=warn //bazel/tools:taplo_bin -- \
format --check --diff Cargo.toml
"${BAZEL_CMD}" build --config=rustfmt :all
}

main() {
# Change to the directory where this script resides, it makes many things easier
# and we can call this script from everywhere.
Expand All @@ -173,7 +181,7 @@ main() {
# TODO: Re-evaluate usage of --all-targets below
test ${RUN_BUILD} = yes && "${BAZEL_CMD}" build :all
test ${RUN_UNIT_TESTS} = yes && "${BAZEL_CMD}" test :all
test ${RUN_CHECK_FORMAT} = yes && "${BAZEL_CMD}" build --config=rustfmt :all
test ${RUN_CHECK_FORMAT} = yes && run_check_format
test ${RUN_CLIPPY} = yes && "${BAZEL_CMD}" build --config=clippy :all
test ${RUN_FORMAT} = yes && run_format
test ${RUN_DOCUMENTATION} = yes && run_cargo_cmd_with_explicit_package doc --jobs="${JOBS}" --release --lib --bins --examples ${FEATURES:+"--features=$FEATURES"}
Expand Down

0 comments on commit d5d0d1e

Please sign in to comment.