1name: Bazel presubmit checks
2
3on:
4  push:
5  pull_request:
6
7jobs:
8  bazel-build-check:
9    strategy:
10        matrix:
11          # TODO: Windows is currently broken.
12          os: [ubuntu-latest, macos-latest]
13        fail-fast: false
14    runs-on: ${{ matrix.os }}
15    steps:
16      - name: Checkout
17        uses: actions/checkout@v4
18        with:
19          fetch-depth: 0
20      - name: Get Bazel
21        uses: bazel-contrib/setup-bazel@0.9.0
22        with:
23          # Avoid downloading Bazel every time.
24          bazelisk-cache: true
25          # Store build cache per workflow.
26          disk-cache: ${{ github.workflow }}
27          # Share repository cache between workflows.
28          repository-cache: true
29      # Only needed to drive the presbumit scripts.
30      - name: Setup Python
31        uses: actions/setup-python@v5
32        with:
33          python-version: '3.10'
34      - name: Fetch latest Picotool
35        uses: actions/checkout@v4
36        with:
37          repository: raspberrypi/picotool
38          ref: develop
39          fetch-depth: 0
40          path: lib/picotool
41      - name: Full Bazel build with develop Picotool
42        run: python3 tools/run_all_bazel_checks.py --program=build --picotool-dir=lib/picotool
43      # Checks that the current BCR-requested version of Picotool builds.
44      - name: Bazel Picotool backwards compatibility
45        run: bazel build @picotool//:picotool
46  other-bazel-checks:
47    runs-on: ubuntu-latest
48    steps:
49      - name: Checkout
50        uses: actions/checkout@v4
51        with:
52          fetch-depth: 0
53      - name: Get Bazel
54        uses: bazel-contrib/setup-bazel@0.9.0
55        with:
56          # Avoid downloading Bazel every time.
57          bazelisk-cache: true
58          # Store build cache per workflow.
59          disk-cache: ${{ github.workflow }}
60          # Share repository cache between workflows.
61          repository-cache: true
62      # Only needed to drive the presbumit scripts.
63      - name: Setup Python
64        uses: actions/setup-python@v5
65        with:
66          python-version: '3.10'
67      - name: Fetch latest Picotool
68        uses: actions/checkout@v4
69        with:
70          repository: raspberrypi/picotool
71          ref: develop
72          fetch-depth: 0
73          path: lib/picotool
74      - name: Other Bazel checks
75        run: python3 tools/run_all_bazel_checks.py --program=other --picotool-dir=lib/picotool
76