Mirror of bazel-contrib/setup-bazel for self-hosted Forgejo Actions
Find a file
renovate[bot] 0d27eba2b7
Update dependency yaml to v2.5.1 (#35)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-09-04 13:00:36 -07:00
.github/workflows Fix release workflow tag creation 2024-05-20 13:44:06 -07:00
dist Release 0.8.5 2024-06-04 13:57:06 +00:00
.gitignore Hello world 2023-01-04 16:31:00 -08:00
.tool-versions Update dependency node to v20.17.0 (#34) 2024-08-21 11:25:34 -07:00
action.yml Rename action 2024-03-20 11:40:35 -07:00
config.js Support passing files to hash in repository-cache 2024-03-05 14:25:19 -08:00
index.js Set octokit's baseUrl explicitly (#24) 2024-06-04 06:56:06 -07:00
LICENSE Initial commit 2023-01-04 16:27:56 -08:00
package-lock.json Update dependency yaml to v2.5.1 (#35) 2024-09-04 13:00:36 -07:00
package.json Update dependency @actions/glob to ^0.5.0 (#33) 2024-08-15 21:58:50 -07:00
post.js Make bazelisk in a tool cache available in the PATH (#19) 2024-05-20 13:30:16 -07:00
README.md Release 0.8.5 2024-06-04 13:57:06 +00:00
renovate.json Add renovate.json (#3) 2024-03-09 11:06:24 -08:00
util.js Fix regression in gathering folder size 2023-11-26 17:11:31 -08:00

setup-bazel

This action allows to properly configure Bazelisk and Bazel on all operating systems and provides an advanced fine-grained caching to improve workflows performance.

Usage

- uses: bazel-contrib/setup-bazel@0.8.5
  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

Inputs

bazelisk-cache

Cache bazelisk downloads based on contents of a .bazelversion file.

Default false.

bazelisk-version

bazelisk version to download and use.

Supports semver specification and ranges. Leave empty to use pre-installed Bazelisk.

Default "".

Examples

Install Bazelisk 1.x

- uses: bazel-contrib/setup-bazel@0.8.5
  with:
    bazelisk-version: 1.x

Install exact Bazelisk version

- uses: bazel-contrib/setup-bazel@0.8.5
  with:
    bazelisk-version: 1.19.0

bazelrc

Extra contents to write to a user's bazelrc file.

You can use multiline YAML strings.

Default "".

Examples

Enable Bzlmod

- uses: bazel-contrib/setup-bazel@0.8.5
  with:
    bazelrc: common --enable_bzlmod

Add colors and timestamps

- uses: bazel-contrib/setup-bazel@0.8.5
  with:
    bazelrc: |
      build --color=yes
      build --show_timestamps

disk-cache

Enable disk_cache and store it on GitHub based on contents of BUILD files.

You can also pass a string to use as a cache key to separate caches from different workflows.

Default false.

Examples

Share a single disk cache

- uses: bazel-contrib/setup-bazel@0.8.5
  with:
    disk-cache: true

Separate disk caches between workflows

- uses: bazel-contrib/setup-bazel@0.8.5
  with:
    disk-cache: ${{ github.workflow }}}

external-cache

Cache external/ repositories based on contents of MODULE.bazel and WORKSPACE files. Only repositories exceeding 10MB are being cached. Each repository is stored in a separate cache.

You can also pass a manifest object where key is the name of the external repository and value is a file (or list of files) which contents are used to calculate cache key. If the value is false, the external repository won't be cached.

Default false.

Examples

Enable external repositories caches

- uses: bazel-contrib/setup-bazel@0.8.5
  with:
    external-cache: true

Cache NPM repositories based on package-lock.json contents

- uses: bazel-contrib/setup-bazel@0.8.5
  with:
    external-cache: |
      manifest:
        npm: package-lock.json

Do not cache Ruby on Windows

- uses: bazel-contrib/setup-bazel@0.8.5
  with:
    external-cache: |
      manifest:
        ruby: ${{ runner.os == 'Windows' && 'false' || 'true' }}

google-credentials

Google Cloud account key to use for remote caching authentication.

Default "".

Examples

Authenticate via key

- uses: bazel-contrib/setup-bazel@0.8.5
  with:
    google-credentials: ${{ secrets.GOOGLE_CLOUD_KEY }}

repository-cache

Enable repository_cache and store it on GitHub based on contents of MODULE.bazel and WORKSPACE files.

You can also pass a file (or list of files) which contents are used to calculate cache key.

Default false.

Examples

Store a single repository cache

- uses: bazel-contrib/setup-bazel@0.8.5
  with:
    repository-cache: true

Store a repository cache from a custom location

- uses: bazel-contrib/setup-bazel@0.8.5
  with:
    repository-cache: examples/gem/WORKSPACE

Migrating from bazelbuild/setup-bazelisk

You can simply replace bazelbuild/setup-bazelisk action with bazel-contrib/setup-bazel. However, if you used a bazel-version input before, you will need to remove it in favor other ways to specify Bazel version.

Development

To build action, run the following command:

$ npm run build

Release

Use Release workflow to cut a new release.