Skip to content

PoC Bazel

PoC Bazel #108

Workflow file for this run

name: bazel
permissions:
contents: read
on:
push:
branches:
- main
pull_request:
merge_group:
workflow_dispatch:
env:
GOPRIVATE: github.com/smartcontractkit/capabilities
jobs:
test:
runs-on: runs-on=${{ github.run_id }}/runner=8cpu-linux-arm64/spot=false/extras=s3-cache
steps:
- name: Enable S3 Cache for Self-Hosted Runners
# these env vars are set (and exposed) when it is a self-hosted runner with extras=s3-cache
if: ${{ env.RUNS_ON_INSTANCE_ID != '' && env.ACTIONS_CACHE_URL != '' }}
uses: runs-on/action@66d4449b717b5462159659523d1241051ff470b9 # v1
- name: Check out repository
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Install Bazel
# install for self-hosted runners only, as github-hosted already have bazel installed
if: ${{ env.RUNS_ON_INSTANCE_ID != '' }}
run: |
npm install -g @bazel/bazelisk
bazel version
- name: Bazel mod tidy
run: |
bazel mod tidy
- name: Ensure no diff
run: |
git diff
git diff --stat --exit-code
# Restore Bazel cache after Bazel mod tidy to fail faster on errors
- name: Restore Bazel cache
uses: actions/cache@v4
with:
path: |
~/.cache/bazel
~/.cache/bazelisk
key: bazel_cache-runner_${{ runner.os }}-ref_${{ github.ref }}-hash_${{ hashFiles('**/BUILD.bazel', '**/MODULE.bazel', '**/*.bzl', '.bazelrc') }}
restore-keys: |
bazel_cache-runner_${{ runner.os }}-ref_${{ github.ref }}-
bazel_cache-runner_${{ runner.os }}-
- name: Bazel (re)generate
run: |
bazel run //:gazelle --config=ci
- name: Ensure no diff
run: |
git diff
git diff --stat --exit-code
- name: Build, lint, and test
run: bazel test //... --config=ci