Skip to content

Enable Bazel build and repository caching in GitHub Actions workflow. #348

Enable Bazel build and repository caching in GitHub Actions workflow.

Enable Bazel build and repository caching in GitHub Actions workflow. #348

name: Build and Test (Linux)
permissions: read-all
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build-and-test:
runs-on: ubuntu-24.04
steps:
- run: echo "πŸŽ‰ The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
- run: echo "πŸ”Ž The name of your branch is ${GITHUB_REF} and your repository is ${{ github.repository }}."
- name: Check out repository code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- run: echo "πŸ’‘ The ${{ github.repository }} repository has been cloned to the runner."
- run: echo "πŸ–₯️ The workflow is now ready to test your code on the runner."
- name: Setup Bazel
uses: bazel-contrib/setup-bazel@c5acdfb288317d0b5c0bbd7a396a3dc868bb0f86 # 0.19.0
with:
# Avoid downloading Bazel every time.
bazelisk-cache: true
# Store build cache per workflow.
disk-cache: ${{ github.workflow }}
# Share repository cache between workflows.
repository-cache: true
- name: Test LLVM build
run: |
cd ${{ github.workspace }}
bazelisk build @llvm-project//llvm:Support
- name: Build everything
run: |
cd ${{ github.workspace }}
bazelisk build //...
- name: Test everything
run: |
cd ${{ github.workspace }}
bazelisk test //...
- run: echo "🍏 This job's status is ${JOB_STATUS}."
env:
JOB_STATUS: ${{ job.status }}