Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support appending args to bazel diff command #18

Merged
merged 20 commits into from
Apr 1, 2024
Merged
11 changes: 9 additions & 2 deletions .github/workflows/compute_impacted_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,13 @@ jobs:

- name: Compute Impacted Targets
id: compute
run: ./src/scripts/compute_impacted_targets.sh
shell: bash
uses: trunk-io/[email protected]
with:
breakpoint-id: trunk-bazel-action
run: ./src/scripts/compute_impacted_targets.sh
trunk-token: ${{ secrets.TRUNK_DEBUGGER_TOKEN }}
org: trunk-staging-org
shell: bash
env:
MERGE_INSTANCE_BRANCH: do_not_delete/stable_test_branch
MERGE_INSTANCE_BRANCH_HEAD_SHA: 3e8b2a57e0f3ad7b63cc487eae576c25b84b653b
Expand All @@ -41,6 +46,8 @@ jobs:
BAZEL_STARTUP_OPTIONS: --host_jvm_args=-Xmx12G,--block_for_lock,--client_debug
BAZEL_PATH: bazel
BAZEL_DIFF_CMD: ${{ steps.bazel-diff.outputs.bazel_diff_cmd }}
BAZEL_DIFF_COMMAND_OPTIONS: --remote_cache=
TRUNK_API_ADDRESS: api.trunk-staging.io:8443

- name: Validate Impacted Targets Computation
shell: bash
Expand Down
1 change: 1 addition & 0 deletions .trunk/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
plugins
user_trunk.yaml
user.yaml
tmp
9 changes: 6 additions & 3 deletions .trunk/trunk.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
version: 0.1
cli:
version: 1.16.2
version: 1.21.0
api:
address: api.trunk-staging.io:8443
org: trunk-staging-org
plugins:
sources:
- id: trunk
ref: v1.2.5
ref: v1.4.5
uri: https://github.com/trunk-io/plugins
- id: configs
uri: https://github.com/trunk-io/configs
ref: v0.0.7
ref: v1.0.4
runtimes:
enabled:
- [email protected]
Expand Down
6 changes: 6 additions & 0 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ inputs:
description: The command to run against bazel when running tests.
required: false
default: test
bazel-diff-command-options:
description: Additional args to append to the bazel diff bazelCommandOptions flag.
required: false
default: ""
test-kind-filter:
description: Kind filter to apply to impacted targets
required: false
Expand Down Expand Up @@ -136,6 +140,7 @@ runs:
WORKSPACE_PATH: ${{ steps.prerequisites.outputs.workspace_path }}
BAZEL_PATH: ${{ inputs.bazel-path }}
BAZEL_DIFF_CMD: ${{ steps.bazel-diff.outputs.bazel_diff_cmd }}
BAZEL_DIFF_COMMAND_OPTIONS: ${{ inputs.bazel-diff-command-options }}
BAZEL_STARTUP_OPTIONS: ${{ inputs.bazel-startup-options }}

- name: Upload Impacted Targets
Expand Down Expand Up @@ -170,6 +175,7 @@ runs:
WORKSPACE_PATH: ${{ steps.prerequisites.outputs.workspace_path }}
BAZEL_PATH: ${{ inputs.bazel-path }}
BAZEL_DIFF_CMD: ${{ steps.bazel-diff.outputs.bazel_diff_cmd }}
BAZEL_DIFF_COMMAND_OPTIONS: ${{ inputs.bazel-diff-command-options }}
BAZEL_STARTUP_OPTIONS: ${{ inputs.bazel-startup-options }}

- name: Test Impacted Targets
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/compute_impacted_targets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ generate_hashes() {
--bazelPath "${BAZEL_PATH}" \
-so="${bazel_startup_options}" \
--workspacePath "${WORKSPACE_PATH}" \
--bazelCommandOptions "--noshow_progress" \
--bazelCommandOptions "--noshow_progress ${BAZEL_DIFF_COMMAND_OPTIONS}" \
"$1"
}

Expand Down
1 change: 1 addition & 0 deletions src/scripts/test_wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ TARGET_BRANCH=main
BAZEL_PATH="${BAZEL_PATH:-.trunk/tools/bazel}"
CACHE_DIR="${HOME}/.cache/trunk/bazel-diff"
BAZEL_STARTUP_OPTIONS=""
BAZEL_DIFF_COMMAND_OPTIONS=""

mkdir -p "${CACHE_DIR}"

Expand Down
Loading