Jon Ross-Perkins
2024-01-04 21:45:53 +00:00
committed by GitHub
parent 379d776084
commit facf6eea04
+26 -6
View File
@@ -25,6 +25,10 @@ jobs:
# https://github.com/actions/runner-images
os: [ubuntu-22.04, macos-12]
build_mode: [fastbuild, opt]
# The clang-tidy config doesn't work on macos (missing `truncate`).
include:
- os: 'ubuntu-22.04'
build_mode: 'clang-tidy'
runs-on: ${{ matrix.os }}
steps:
@@ -251,20 +255,22 @@ jobs:
# Then use `target-determinator` as wrapped by our script.
./scripts/target_determinator.py $GIT_BASE_SHA >$TARGETS_FILE
# Bazel requires a test target to run the test command. There may be
# no targets or there may only be non-test targets that we want to
# build, so simply inject an explicit no-op test target.
echo "//scripts:no_op_test" >> $TARGETS_FILE
# Build and run just the tests impacted by the PR or merge group.
- name: Test (${{ matrix.build_mode }})
if: steps.filter.outputs.has_code == 'true'
if:
steps.filter.outputs.has_code == 'true' && matrix.build_mode !=
'clang-tidy'
env:
# 'libtool_check_unique failed to generate' workaround.
# https://github.com/bazelbuild/bazel/issues/14113#issuecomment-999794586
BAZEL_USE_CPP_ONLY_TOOLCHAIN: 1
TARGETS_FILE: ${{ runner.temp }}/targets
run: |
# Bazel requires a test target to run the test command. There may be
# no targets or there may only be non-test targets that we want to
# build, so simply inject an explicit no-op test target.
echo "//scripts:no_op_test" >> $TARGETS_FILE
for i in {1..5}; do
if (( $i == 4 )); then
# Decrease the jobs sharply if we see repeated failures to try to
@@ -307,6 +313,20 @@ jobs:
# Propagate the Bazel exit code.
exit $bazel_exit
# Run in the clang-tidy config. This is done as part of tests so that we
# aren't duplicating bazel/llvm setup.
#
# The `-k` flag is used to print all clang-tidy errors.
- name: clang-tidy
if:
steps.filter.outputs.has_code == 'true' && matrix.os == 'ubuntu-22.04'
&& matrix.build_mode == 'clang-tidy'
env:
TARGETS_FILE: ${{ runner.temp }}/targets
run: |
bazelisk build --config=clang-tidy -k \
--target_pattern_file=$TARGETS_FILE
# See "Disk space before build".
- name: Disk space after build
if: steps.filter.outputs.has_code == 'true'