Skip to content
This repository has been archived by the owner on Mar 11, 2024. It is now read-only.
/ setup-bazelisk Public archive

Set up your GitHub Actions workflow with a specific version of Bazelisk

License

Notifications You must be signed in to change notification settings

bazelbuild/setup-bazelisk

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Important

setup-bazelisk has been superseded by setup-bazel and all maintenance and support has ceased. setup-bazelisk will remain on GitHub indefinitely, but will almost certainly stop working someday, so if your GitHub Actions workflows use setup-bazelisk, please migrate them to setup-bazel.

setup-bazelisk v3

Set up your GitHub Actions workflow with a specific version of Bazelisk

Note that GitHub Actions includes Bazelisk by default as of actions/runner-images#490 so this setup is not necessary unless you want to customize the Bazelisk version, or are running Bazel inside a container.

Validate 'setup-bazelisk'

This action sets up Bazelisk for use in actions by:

  • optionally downloading and caching a version of Bazelisk by version and adding to PATH
  • setting up cache for downloaded Bazel versions

What's new

  • Updated to the node20 runtime by default

Usage

See action.yml

Basic:

steps:
- uses: actions/checkout@v4
- uses: bazelbuild/setup-bazelisk@v3
- name: Mount bazel cache  # Optional
  uses: actions/cache@v4
  with:
    path: "~/.cache/bazel"
    key: bazel
- run: bazel build //...

Known issues on Windows

  • This action doesn't work with PowerShell. Make sure to have shell: bash in you run: steps. (#3)
  • Windows removes one of the slashes (/) when two are present (bazel test //tests/... becomes bazel test /tests/... and fails). (#4) As a workaround, don't have any prefix //. Since all runs start at WORKSPACE dir, it should work all the same.

Full workaround example on windows:

- name: Run tests
  run: bazel test tests/...
  shell: bash

License

The scripts and documentation in this project are released under the MIT License