|
|
@@ -62,29 +62,22 @@ jobs:
|
|
|
uses: dorny/paths-filter@v2
|
|
|
with:
|
|
|
filters: |
|
|
|
- ignore:
|
|
|
- - '**/*.md'
|
|
|
- - 'LICENSE'
|
|
|
- - 'CODEOWNERS'
|
|
|
- - '.git*'
|
|
|
+ has_code:
|
|
|
+ - '!{**/*.md,LICENSE,CODEOWNERS,.git*}'
|
|
|
|
|
|
# Setup Python and related tools.
|
|
|
- uses: actions/setup-python@v4
|
|
|
- if: steps.filter.outputs.ignore == 'false'
|
|
|
+ if: steps.filter.outputs.has_code == 'true'
|
|
|
with:
|
|
|
# Match the min version listed in docs/project/contribution_tools.md
|
|
|
python-version: '3.9'
|
|
|
|
|
|
# Use LLVM following:
|
|
|
# https://github.com/actions/runner-images/blob/main/images/macos/macos-12-Readme.md
|
|
|
- # Both 14 and 15 are candidates because GitHub is testing new images.
|
|
|
- name: Setup LLVM and Clang (macOS)
|
|
|
- if: steps.filter.outputs.ignore == 'false' && matrix.os == 'macos-12'
|
|
|
+ if: steps.filter.outputs.has_code == 'true' && matrix.os == 'macos-12'
|
|
|
run: |
|
|
|
LLVM_PATH="$(brew --prefix llvm@15)"
|
|
|
- if [[ ! -e "${LLVM_PATH}" ]]; then
|
|
|
- LLVM_PATH="$(brew --prefix llvm@14)"
|
|
|
- fi
|
|
|
echo "Using ${LLVM_PATH}"
|
|
|
echo "${LLVM_PATH}/bin" >> $GITHUB_PATH
|
|
|
echo '*** ls "${LLVM_PATH}"'
|
|
|
@@ -94,11 +87,9 @@ jobs:
|
|
|
|
|
|
# Use LLVM following:
|
|
|
# https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2204-Readme.md
|
|
|
- # Both 14 and 15 are candidates for forwards compatibility, although 15
|
|
|
- # isn't provided.
|
|
|
- name: Setup LLVM and Clang (Ubuntu)
|
|
|
if:
|
|
|
- steps.filter.outputs.ignore == 'false' && matrix.os == 'ubuntu-22.04'
|
|
|
+ steps.filter.outputs.has_code == 'true' && matrix.os == 'ubuntu-22.04'
|
|
|
run: |
|
|
|
# TODO: Re-enable once llvm-15 is working.
|
|
|
# https://github.com/actions/runner-images/issues/8253
|
|
|
@@ -115,7 +106,7 @@ jobs:
|
|
|
|
|
|
# Print the various tool paths and versions to help in debugging.
|
|
|
- name: Print tool debugging info
|
|
|
- if: steps.filter.outputs.ignore == 'false'
|
|
|
+ if: steps.filter.outputs.has_code == 'true'
|
|
|
run: |
|
|
|
echo '*** PATH'
|
|
|
echo $PATH
|
|
|
@@ -135,7 +126,7 @@ jobs:
|
|
|
# Disable uploads when the remote cache is read-only.
|
|
|
- name: Set up remote cache access (read-only)
|
|
|
if:
|
|
|
- steps.filter.outputs.ignore == 'false' && github.event_name ==
|
|
|
+ steps.filter.outputs.has_code == 'true' && github.event_name ==
|
|
|
'pull_request'
|
|
|
run: |
|
|
|
echo "remote_cache_upload=--remote_upload_local_results=false" \
|
|
|
@@ -144,7 +135,7 @@ jobs:
|
|
|
# Provide a cache key when the remote cache is read-write.
|
|
|
- name: Set up remote cache access (read-write)
|
|
|
if:
|
|
|
- steps.filter.outputs.ignore == 'false' && github.event_name !=
|
|
|
+ steps.filter.outputs.has_code == 'true' && github.event_name !=
|
|
|
'pull_request'
|
|
|
env:
|
|
|
REMOTE_CACHE_KEY: ${{ secrets.CARBON_BUILDS_GITHUB }}
|
|
|
@@ -155,18 +146,18 @@ jobs:
|
|
|
|
|
|
# We need to replace the `.` with a `_` for the build cache.
|
|
|
- name: Setup LLVM and Clang (macOS)
|
|
|
- if: steps.filter.outputs.ignore == 'false' && matrix.os == 'macos-12'
|
|
|
+ if: steps.filter.outputs.has_code == 'true' && matrix.os == 'macos-12'
|
|
|
run: |
|
|
|
echo "os_for_cache=macos-12" >> $GITHUB_ENV
|
|
|
- name: Setup LLVM and Clang (Ubuntu)
|
|
|
if:
|
|
|
- steps.filter.outputs.ignore == 'false' && matrix.os == 'ubuntu-22.04'
|
|
|
+ steps.filter.outputs.has_code == 'true' && matrix.os == 'ubuntu-22.04'
|
|
|
run: |
|
|
|
echo "os_for_cache=ubuntu-22_04" >> $GITHUB_ENV
|
|
|
|
|
|
# Add our bazel configuration and print basic info to ease debugging.
|
|
|
- name: Configure Bazel and print info
|
|
|
- if: steps.filter.outputs.ignore == 'false'
|
|
|
+ if: steps.filter.outputs.has_code == 'true'
|
|
|
env:
|
|
|
# Add a cache version for changes that bazel won't otherwise detect,
|
|
|
# like llvm version changes.
|
|
|
@@ -209,7 +200,7 @@ jobs:
|
|
|
|
|
|
# Just for visibility, print space before and after the build.
|
|
|
- name: Disk space before build
|
|
|
- if: steps.filter.outputs.ignore == 'false'
|
|
|
+ if: steps.filter.outputs.has_code == 'true'
|
|
|
run: df -h
|
|
|
|
|
|
# Build and run all targets on branch pushes to ensure we always have a
|
|
|
@@ -217,7 +208,7 @@ jobs:
|
|
|
# optimize the latency of this step.
|
|
|
- name: Compute impacted pull request targets (for push)
|
|
|
if:
|
|
|
- steps.filter.outputs.ignore == 'false' && github.event_name == 'push'
|
|
|
+ steps.filter.outputs.has_code == 'true' && github.event_name == 'push'
|
|
|
env:
|
|
|
TARGETS_FILE: ${{ runner.temp }}/targets
|
|
|
run: |
|
|
|
@@ -229,7 +220,7 @@ jobs:
|
|
|
# all of the unaffected Bazel targets.
|
|
|
- name: Compute impacted pull request targets
|
|
|
if:
|
|
|
- steps.filter.outputs.ignore == 'false' && github.event_name != 'push'
|
|
|
+ steps.filter.outputs.has_code == 'true' && github.event_name != 'push'
|
|
|
env:
|
|
|
# Compute the base SHA from the different event structures.
|
|
|
GIT_BASE_SHA:
|
|
|
@@ -246,7 +237,7 @@ jobs:
|
|
|
|
|
|
# Build and run just the tests impacted by the PR or merge group.
|
|
|
- name: Test (${{ matrix.build_mode }})
|
|
|
- if: steps.filter.outputs.ignore == 'false'
|
|
|
+ if: steps.filter.outputs.has_code == 'true'
|
|
|
env:
|
|
|
# 'libtool_check_unique failed to generate' workaround.
|
|
|
# https://github.com/bazelbuild/bazel/issues/14113#issuecomment-999794586
|
|
|
@@ -302,5 +293,5 @@ jobs:
|
|
|
|
|
|
# See "Disk space before build".
|
|
|
- name: Disk space after build
|
|
|
- if: steps.filter.outputs.ignore == 'false'
|
|
|
+ if: steps.filter.outputs.has_code == 'true'
|
|
|
run: df -h
|