| 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-26.04 | |
| if: github.repository == 'llvm/llvm-project' | |
| steps: | |
| - name: Fetch LLVM sources | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Setup Buildifier | |
| run: | | |
| sudo curl -L https://github.com/bazelbuild/buildtools/releases/download/v8.2.1/buildifier-linux-amd64 -o /usr/bin/buildifier --fail | |
| echo "4d2e6da38c3ef993a6bd1329431de2e30c5741f2 /usr/bin/buildifier" | shasum --check - | |
| sudo chmod +x /usr/bin/buildifier | |
| - name: Run Buildifier | |
| run: | | |
| BZL_FILES=$(find ./utils/bazel -name *BUILD* -o -name '*bzl' -o -name '*.bazel') | |
| if ! buildifier --mode=check $BZL_FILES; then | |
| echo "::error::Buildifier formatting issues found." | |
| echo "::group::Buildifier Diff" | |
| buildifier --mode=diff $BZL_FILES | |
| echo "::endgroup::" | |
| exit 1 | |
| else | |
| echo "All files are formatted correctly." | |
| fi | |
| bazel-build: | |
| name: "Bazel ${{ matrix.name }}" | |
| # Only run on US Central workers so we only have to keep one cache warm as | |
| # the cache buckets are per cluster. | |
| runs-on: | |
| group: llvm-premerge-cluster-us-central | |
| labels: llvm-premerge-linux-runners | |
| if: github.repository == 'llvm/llvm-project' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: "Build/Test" | |
| flags: "" | |
| targets: "@llvm-project//... //..." | |
| - name: "LLVM-libc Fullbuild Tests" | |
| flags: "--@llvm-project//libc:build_mode=full" | |
| targets: "@llvm-project//libc/..." | |
| steps: | |
| - name: Fetch LLVM sources | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| # TODO(boomanaiden154): We should use a purpose built container for this. Move | |
| # over when we have fixed the issues with using custom containers with Github | |
| # ARC in GKE. | |
| - name: Setup System Dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libmpfr-dev libpfm4-dev m4 libedit-dev | |
| sudo curl -L https://github.com/bazelbuild/bazelisk/releases/download/v1.27.0/bazelisk-amd64.deb --fail > /tmp/bazelisk.deb | |
| echo "d8b00ea975c823e15263c80200ac42979e17368547fbff4ab177af035badfa83 /tmp/bazelisk.deb" | shasum --check - | |
| sudo apt-get install -y /tmp/bazelisk.deb | |
| rm /tmp/bazelisk.deb | |
| - name: Build/Test | |
| working-directory: utils/bazel | |
| run: | | |
| bazelisk test --config=ci --sandbox_base="" \ | |
| --remote_cache=https://storage.googleapis.com/$CACHE_GCS_BUCKET-bazel \ | |
| --google_default_credentials \ | |
| --remote_download_outputs=minimal \ | |
| ${{ matrix.flags }} \ | |
| ${{ matrix.targets }} |