-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Allow users to pass in a path to the Bazel path executable. Useful for custom installations of Bazel. - Only install Bazel to the PATH if the expected bazel-path is `bazel`, but no bazel exists. If a user provides a custom bazel-path, we assume the executable exists. Similarly, if bazel already exists, no need to install.
- Loading branch information
1 parent
6489285
commit 6c5a6fc
Showing
4 changed files
with
29 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,18 +25,14 @@ inputs: | |
https://bazel.build/reference/command-line-reference#startup-options for a complete list. If | ||
unspecified, no startup options are specified. | ||
required: false | ||
bazel-path: | ||
description: A path to the Bazel executable. Defaults to PATH. | ||
required: false | ||
default: bazel | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Setup Bazel | ||
# trunk-ignore(semgrep): Trust third-party `bazelbuild` GH Action | ||
uses: bazelbuild/setup-bazelisk@v2 | ||
|
||
- name: Setup jq | ||
# trunk-ignore(semgrep): Trust third-party action to install JQ. Source code: https://github.com/dcarbone/install-jq-action/ | ||
uses: dcarbone/[email protected] | ||
|
||
- name: Prerequisites | ||
id: prerequisites | ||
run: ${GITHUB_ACTION_PATH}/src/scripts/prerequisites.sh | ||
|
@@ -45,6 +41,16 @@ runs: | |
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }} | ||
TARGET_BRANCH: ${{ inputs.target-branch }} | ||
WORKSPACE_PATH: ${{ inputs.bazel-workspace-path }} | ||
BAZEL_PATH: ${{ inputs.bazel-path }} | ||
|
||
- name: Install Bazel in PATH | ||
if: ${{ steps.prerequisites.outputs.requires_default_bazel_installation == 'true' }} | ||
# trunk-ignore(semgrep): Trust third-party `bazelbuild` GH Action | ||
uses: bazelbuild/setup-bazelisk@v2 | ||
|
||
- name: Setup jq | ||
# trunk-ignore(semgrep): Trust third-party action to install JQ. Source code: https://github.com/dcarbone/install-jq-action/ | ||
uses: dcarbone/[email protected] | ||
|
||
- name: Compute Impacted Targets | ||
id: compute-impacted-targets | ||
|
@@ -55,6 +61,7 @@ runs: | |
PR_BRANCH: ${{ github.head_ref }} | ||
VERBOSE: ${{ inputs.verbose }} | ||
WORKSPACE_PATH: ${{ steps.prerequisites.outputs.workspace_path }} | ||
BAZEL_PATH: ${{ inputs.bazel-path }} | ||
BAZEL_STARTUP_OPTIONS: ${{ inputs.bazel-startup-options }} | ||
|
||
- name: Upload Impacted Targets | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,7 +33,7 @@ logIfVerbose "Bazel startup options" "${bazel_startup_options}" | |
|
||
_bazel() { | ||
# trunk-ignore(shellcheck) | ||
bazel ${bazel_startup_options} "$@" | ||
${BAZEL_PATH} ${bazel_startup_options} "$@" | ||
} | ||
|
||
# trunk-ignore(shellcheck) | ||
|
@@ -91,7 +91,7 @@ fi | |
# Install the bazel-diff JAR. Avoid cloning the repo, as there will be conflicting WORKSPACES. | ||
curl --retry 5 -Lo bazel-diff.jar https://github.com/Tinder/bazel-diff/releases/latest/download/bazel-diff_deploy.jar | ||
_java -jar bazel-diff.jar -V | ||
bazel version # Does not require running with startup options. | ||
_bazel version # Does not require running with startup options. | ||
|
||
# Output Files | ||
merge_instance_branch_out=./${merge_instance_branch_head_sha} | ||
|
@@ -100,11 +100,11 @@ impacted_targets_out=./impacted_targets_${pr_branch_head_sha} | |
|
||
# Generate Hashes for the Merge Instance Branch | ||
git switch "${MERGE_INSTANCE_BRANCH}" | ||
bazelDiff generate-hashes --workspacePath="${WORKSPACE_PATH}" "-so=${bazel_startup_options}" "${merge_instance_branch_out}" | ||
bazelDiff generate-hashes --bazelPath="${BAZEL_PATH}" --workspacePath="${WORKSPACE_PATH}" "-so=${bazel_startup_options}" "${merge_instance_branch_out}" | ||
|
||
# Generate Hashes for the Merge Instance Branch + PR Branch | ||
git -c "user.name=Trunk Actions" -c "[email protected]" merge --squash "${PR_BRANCH}" | ||
bazelDiff generate-hashes --workspacePath="${WORKSPACE_PATH}" "-so=${bazel_startup_options}" "${merge_instance_with_pr_branch_out}" | ||
bazelDiff generate-hashes --bazelPath="${BAZEL_PATH}" --workspacePath="${WORKSPACE_PATH}" "-so=${bazel_startup_options}" "${merge_instance_with_pr_branch_out}" | ||
|
||
# Compute impacted targets | ||
bazelDiff get-impacted-targets --startingHashes="${merge_instance_branch_out}" --finalHashes="${merge_instance_with_pr_branch_out}" --output="${impacted_targets_out}" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters