setup-bazel/README.md
2024-01-18 11:57:13 -08:00

2.3 KiB

setup-bazel

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

Inputs

bazelisk-cache

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

Default false.

bazelrc

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

Default "".

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.

external-cache

Cache external/ repositories based on contents of a WORKSPACE file. Only repositories exceeding 10MB are being cached.

You can also pass a YAML object where key is the name of the external repository and value is the list of files which contents are used to calculate cache key.

Default false.

repository-cache

Enable repository_cache and store it on GitHub based on contents of a WORKSPACE file.

Default false.

Examples

Simple configuration

- uses: p0deje/setup-bazel@0.4.0

Additional .bazelrc options

- uses: p0deje/setup-bazel@0.4.0
  with:
    bazelrc: |
      build --show_timestamps

Full caching enabled

- uses: p0deje/setup-bazel@0.4.0
  with:
    bazelisk-cache: true
    disk-cache: true
    external-cache: true
    repository-cache: true

Separate disk cache between workflows

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

Cache external repository based on different files

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

Disable individual external repositories conditionally

- uses: p0deje/setup-bazel@0.4.0
  with:
    external-cache: |
      manifest:
        ruby: ${{ matrix.os == 'windows' && 'false' || '.ruby-version' }}