Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
with:
fetch-depth: 0
- name: Run bazel-diff example script
run: USE_BAZEL_VERSION=latest ./bazel-diff-example.sh $(pwd) bazel $(git rev-parse HEAD~1) $(git rev-parse HEAD)
run: USE_BAZEL_VERSION=latest ./bazel-diff-example.sh "$GITHUB_WORKSPACE" ~/go/bin/bazelisk $(git rev-parse HEAD~1) $(git rev-parse HEAD)
test-jre11:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -103,7 +103,7 @@ jobs:
with:
fetch-depth: 0
- name: Run bazel-diff example script
run: USE_BAZEL_VERSION=latest ./bazel-diff-example.sh $(pwd) bazel $(git rev-parse HEAD~1) $(git rev-parse HEAD)
run: USE_BAZEL_VERSION=latest ./bazel-diff-example.sh "$GITHUB_WORKSPACE" ~/go/bin/bazelisk $(git rev-parse HEAD~1) $(git rev-parse HEAD)
deploy:
needs: [test-jre8, test-jre11]
runs-on: ubuntu-latest
Expand Down
14 changes: 6 additions & 8 deletions bazel-diff-example.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

set -ex

# Path to your Bazel WORKSPACE directory
workspace_path=$1
# Path to your Bazel executable
Expand All @@ -14,27 +16,23 @@ final_hashes_json="/tmp/final_hashes.json"
impacted_targets_path="/tmp/impacted_targets.txt"
bazel_diff="/tmp/bazel_diff"

shared_flags=""

# Uncomment the line below to see debug information
# shared_flags="--config=verbose"

"$bazel_path" run :bazel-diff "$shared_flags" --script_path="$bazel_diff"
"$bazel_path" run :bazel-diff --script_path="$bazel_diff"

git -C "$workspace_path" checkout "$previous_revision" --quiet

echo "Generating Hashes for Revision '$previous_revision'"
$bazel_diff generate-hashes -w "$workspace_path" -b "$bazel_path" $starting_hashes_json

git -C "$workspace_path" checkout $final_revision --quiet
git -C "$workspace_path" checkout "$final_revision" --quiet

echo "Generating Hashes for Revision '$final_revision'"
$bazel_diff generate-hashes -w "$workspace_path" -b "$bazel_path" $final_hashes_json

echo "Determining Impacted Targets"
$bazel_diff get-impacted-targets -sh $starting_hashes_json -fh $final_hashes_json -o $impacted_targets_path

IFS=$'\n' read -d '' -r -a impacted_targets < $impacted_targets_path
impacted_targets=()
IFS=$'\n' read -d '' -r -a impacted_targets < $impacted_targets_path || true
formatted_impacted_targets=$(IFS=$'\n'; echo "${impacted_targets[*]}")
echo "Impacted Targets between $previous_revision and $final_revision:"
echo "$formatted_impacted_targets"
Expand Down