Skip to content

Commit

Permalink
Implement a workaround for macOS/Bazel flakes.
Browse files Browse the repository at this point in the history
See bazelbuild/bazel#17437 for more details.

PiperOrigin-RevId: 509869860
  • Loading branch information
mkruskal-google authored and copybara-github committed Feb 15, 2023
1 parent 8f89e0d commit aa0fb30
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
11 changes: 11 additions & 0 deletions .github/actions/bazel/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,17 @@ runs:
run: ${{ inputs.bash }}
shell: bash

# Xcode has a warmup period that can frequently exceed the 2m timeout
# that Bazel uses internally. If we warm it up in advance w/o a timeout,
# Bazel's call will run in seconds.
# See https://github.com/bazelbuild/bazel/issues/17437 for more details.
- name: Warm up Xcode
if: ${{ runner.os == 'macOS' }}
shell: bash
run: |
bazelisk build @bazel_tools//tools/osx:xcode_locator.m
time xcrun --sdk macosx clang -mmacosx-version-min=10.9 -fobjc-arc -framework CoreServices -framework Foundation -o xcode-locator-bin $(bazel info output_base)/external/bazel_tools/tools/osx/xcode_locator.m
- name: Run Bazel
if: ${{ !inputs.bash }}
run: >-
Expand Down
4 changes: 3 additions & 1 deletion .github/actions/internal/bazel-setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ runs:
- name: Initialize MacOS-specific Bazel flags
if: runner.os == 'macOS'
shell: bash
run: echo "BAZEL_FLAGS=$BAZEL_FLAGS --xcode_version_config=//.github:host_xcodes" >> $GITHUB_ENV
run: |
echo "BAZEL_FLAGS=$BAZEL_FLAGS --xcode_version_config=//.github:host_xcodes" >> $GITHUB_ENV
echo "DEVELOPER_DIR=${{ env.DEVELOPER_DIR || '/Applications/Xcode_14.1.app/Contents/Developer' }}" >> $GITHUB_ENV
- name: Configure Bazel caching
# Skip bazel cache for local act runs due to issue with credential files
Expand Down

0 comments on commit aa0fb30

Please sign in to comment.