Skip to content

Add Auto-Labeling for Issues using GitHub Actions #10709

Add Auto-Labeling for Issues using GitHub Actions

Add Auto-Labeling for Issues using GitHub Actions #10709

Workflow file for this run

name: "bazel"
on:
push:
branches: [main]
pull_request:
branches: [main]
merge_group:
branches: [main]
# Cancel any preceding run on the pull request.
concurrency:
group: bazel-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
format_bazel_files:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: tools/format-bazel-files.sh
- name: Check formatting diff
run: |
CHANGED_FILES="$(git diff-index --name-only HEAD --)"
if [[ -z "${CHANGED_FILES}" ]]; then
echo "Success: no formatting changes needed."
exit 0
fi
echo "Found formatting changes in the following files:"
echo "${CHANGED_FILES}"
echo ""
echo "Please run `tools/format-bazel-files.sh` to apply the changes."
exit 1
build_direct: # Build p4c directly.
needs: format_bazel_files
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Mount bazel cache
uses: actions/cache@v4
with:
# See https://docs.bazel.build/versions/master/output_directories.html
path: "~/.cache/bazel"
# Create cash entry for every run (by using unique key derived from commit hash).
# See https://docs.github.com/en/actions/guides/caching-dependencies-to-speed-up-workflows
key: ${{ runner.os }}-build-direct-${{ github.sha }}
restore-keys: |
${{ runner.os }}-build-direct-
- name: Install Flex and Bison
run: sudo apt install bison flex libfl-dev
- name: Build p4c
run: bazel build //... --verbose_failures
build_indirect: # Build 3rd party Bazel project depending on p4c as a subproject.
needs: format_bazel_files
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Mount bazel cache
uses: actions/cache@v4
with:
# See https://docs.bazel.build/versions/master/output_directories.html
path: "~/.cache/bazel"
# Create cash entry for every run (by using unique key derived from commit hash).
# See https://docs.github.com/en/actions/guides/caching-dependencies-to-speed-up-workflows
key: ${{ runner.os }}-build-indirect-${{ github.sha }}
restore-keys: |
${{ runner.os }}-build-indirect-
- name: Install Flex and Bison
run: sudo apt install bison flex libfl-dev
- name: Build bazel/example
run: cd ./bazel/example && bazel build //... --verbose_failures