Skip to content

Commit

Permalink
Some fixes to cargo-related commands
Browse files Browse the repository at this point in the history
* Fix out-of-sync Cargo.lock file after 0c13105
* Fix the execution of the grep for workspace so it actually lists
  results.
* Add git-diff-checks to Kokoro scripts to catch missing file updates.

Change-Id: I451bc64c37973b4c016c2caf23d370485fc4bfa5
  • Loading branch information
jblebrun committed Jul 23, 2024
1 parent e6d56e8 commit 74fb383
Show file tree
Hide file tree
Showing 13 changed files with 17 additions and 59 deletions.
2 changes: 0 additions & 2 deletions enclave_apps/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 9 additions & 6 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export BAZEL_CONFIG_FLAG := if env_var_or_default('CI', '') == "" { "" } else {

# Quick-and-dirty Cargo.toml workspace finder for cargo commands.
# We plan to remove Cargo.toml files soon, and then this can go as well.
export CARGO_WORKSPACE_LIST_CMD := 'grep "\[workspace" **/Cargo.toml --exclude="third_party/*"'
export CARGO_WORKSPACE_LIST_CMD := 'grep -l "\[workspace" **/Cargo.toml --exclude="third_party/*"'

key_xor_test_app: (build_enclave_app "key_xor_test_app")
oak_echo_enclave_app: (build_enclave_app "oak_echo_enclave_app")
Expand Down Expand Up @@ -293,22 +293,22 @@ clippy-ci: bazel-clippy cargo-clippy

cargo-clippy:
#!/bin/sh
for workspace in "$($CARGO_WORKSPACE_LIST_CMD)"
for workspace in $({{CARGO_WORKSPACE_LIST_CMD}})
do
env chdir=$workspace cargo-clippy --all-features --all-targets --no-deps -- --deny=warnings
env chdir=$workspace cargo clippy --all-features --all-targets --no-deps -- --deny=warnings
done


cargo-deny:
#!/bin/sh
for workspace in "$($CARGO_WORKSPACE_LIST_CMD)"
for workspace in $({{CARGO_WORKSPACE_LIST_CMD}})
do
env chdir=$workspace cargo-deny check
env chdir=$workspace cargo deny check
done

cargo-udeps:
#!/bin/sh
for workspace in "$($CARGO_WORKSPACE_LIST_CMD)"
for workspace in $({{CARGO_WORKSPACE_LIST_CMD}})
do
env chdir=$workspace cargo udeps --all-targets --backend=depinfo --workspace
done
Expand All @@ -317,6 +317,9 @@ cargo-udeps:
check-format-ci:
bazel build --config=unsafe-fast-presubmit linter && bazel-bin/linter/linter --verbose

git-check-diff:
./scripts/git_check_diff

# Temporary target to help debugging Bazel remote cache with more detailed logs.
# It should be deleted when debugging is completed.
# TODO: b/337266665 - Remove bazel-cache-test logic once we are satisfied with remote cache hits.
Expand Down
1 change: 1 addition & 0 deletions kokoro/build_binaries_oak_containers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ source "$(dirname "$0")/common.sh"

./scripts/docker_pull
./scripts/docker_run nix develop .#containers --command just kokoro_oak_containers
./scripts/git_check_diff

mkdir -p "${KOKORO_ARTIFACTS_DIR}/test_logs/"
cp --preserve=timestamps \
Expand Down
1 change: 1 addition & 0 deletions kokoro/build_binaries_rust.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ source "$(dirname "$0")/common.sh"

./scripts/docker_pull
./scripts/docker_run nix develop .#ci --command just kokoro_build_binaries_rust
./scripts/git_check_diff

mkdir -p "${KOKORO_ARTIFACTS_DIR}/test_logs/"
cp --preserve=timestamps \
Expand Down
1 change: 1 addition & 0 deletions kokoro/check_format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ source "$(dirname "$0")/common.sh"

./scripts/docker_pull
./scripts/docker_run nix develop .#ci --command just check-format-ci
./scripts/git_check_diff
1 change: 1 addition & 0 deletions kokoro/run_bazel_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ source "$(dirname "$0")/common.sh"
./scripts/docker_pull
# TODO: b/337266665 - Remove bazel-cache-test logic once we are satisfied with remote cache hits.
./scripts/docker_run nix develop .#ci --command just bazel-ci bazel-cache-test
./scripts/git_check_diff

# Upload the bazel execution logs as Kokoro artifacts so we can debug remote cache. This should
# be removed once the debugging is completed. We use the binaries folder only because it is
Expand Down
1 change: 1 addition & 0 deletions kokoro/run_cargo_deny.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ source "$(dirname "$0")/common.sh"

./scripts/docker_pull
./scripts/docker_run nix develop .#ci --command just cargo-deny
./scripts/git_check_diff
1 change: 1 addition & 0 deletions kokoro/run_cargo_udeps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ source "$(dirname "$0")/common.sh"

./scripts/docker_pull
./scripts/docker_run nix develop .#ci --command just cargo-udeps
./scripts/git_check_diff
1 change: 1 addition & 0 deletions kokoro/run_clippy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ source "$(dirname "$0")/common.sh"

./scripts/docker_pull
./scripts/docker_run nix develop .#ci --command just clippy-ci
./scripts/git_check_diff
1 change: 1 addition & 0 deletions kokoro/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ source "$(dirname "$0")/common.sh"

./scripts/docker_pull
./scripts/docker_run nix develop .#default --command just kokoro_run_tests
./scripts/git_check_diff

mkdir -p "${KOKORO_ARTIFACTS_DIR}/test_logs/"
cp --preserve=timestamps \
Expand Down
2 changes: 0 additions & 2 deletions micro_rpc_workspace_test/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 0 additions & 19 deletions oak_restricted_kernel_bin/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 0 additions & 30 deletions stage0_bin/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 74fb383

Please sign in to comment.