[CI] Add Basic Bazel Checks (#153740)

Having basic checks (like running buildifier) on the upstream bazel
files would be helpful for contributors maintaining the bazel build. Add
basic checks (currently just buildifier) to a workflow that runs
whenever the bazel build files change.
This commit is contained in:
Aiden Grossman 2025-08-15 08:30:07 -07:00 committed by GitHub
parent 6d3ad9d9fd
commit 0b04168948
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

32
.github/workflows/bazel-checks.yml vendored Normal file
View File

@ -0,0 +1,32 @@
name: Bazel Checks
permissions:
contents: read
on:
push:
paths:
- '.github/workflows/bazel-checks.yml'
- 'utils/bazel/**'
branches:
- main
pull_request:
paths:
- '.github/workflows/bazel-checks.yml'
- 'utils/bazel/**'
jobs:
buildifier:
name: "Buildifier"
runs-on: ubuntu-24.04
if: github.repository == 'llvm/llvm-project'
steps:
- name: Fetch LLVM sources
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Setup Buildifier
run: |
sudo curl -L https://github.com/bazelbuild/buildtools/releases/download/v8.2.1/buildifier-linux-amd64 -o /usr/bin/buildifier
sudo chmod +x /usr/bin/buildifier
- name: Run Buildifier
run: |
buildifier --mode=check $(find ./utils/bazel -name *BUILD*)