summaryrefslogtreecommitdiff
path: root/.github/workflows/bazel-checks.yml
blob: dc9dcb97ce0a8372bf666eb14a84287bc9b92b9b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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 --fail
          sudo chmod +x /usr/bin/buildifier
      - name: Run Buildifier
        run: |
          buildifier --mode=check $(find ./utils/bazel -name *BUILD*)
  
  bazel-build:
    name: "Bazel Build/Test"
    # 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'
    steps:
      - name: Fetch LLVM sources
        uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
        # 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
          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 \
            @llvm-project//... //...