Skip to content

test: bazel self-hosted runners #85

test: bazel self-hosted runners

test: bazel self-hosted runners #85

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 }}/cpu=4/ram=16/family=m6idn/spot=false/image=ubuntu24-full-x64/extras=s3-cache
# runs-on: ubuntu-latest
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: Try to 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
whereis bazelisk || echo "bazelisk not found in PATH"
which bazelisk || echo "bazelisk not found in PATH"
sudo ln -s /usr/local/lib/node_modules/@bazel/bazelisk/bazelisk.js /usr/local/bin/bazel
bazel version
- name: Cache Bazel
uses: actions/cache@v4
with:
path: |
~/.cache/bazel
~/.cache/bazelisk
key: ${{ runner.os }}-bazel-${{ github.ref }}-${{ hashFiles('**/BUILD.bazel', '**/MODULE.bazel', '**/*.bzl', '.bazelrc') }}
restore-keys: |
${{ runner.os }}-bazel-${{ github.ref }}-
${{ runner.os }}-bazel-
- name: Tidy and generate
run: |
bazel mod tidy
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