GitHub Actions

GitHub Actions' Ubuntu 18.04 and Ubuntu 20.04 runners come pre-installed with everything needed to run batect. We recommend using Ubuntu 20.04.

To use the Ubuntu 20.04 runner, specify runs-on: ubuntu:20.04 in your configuration file. For example:

.github/workflows/build.yml
jobs:
build:
name: "Build"
runs-on: ubuntu-20.04
steps:
- uses: actions/checko[email protected]
- name: Build application
run: ./batect build

You can see a full example of using Batect with CircleCI in the TypeScript sample project.

Caching between builds#

If you're using caches, you can persist these between builds with the following configuration:

.github/workflows/build.yml
jobs:
build:
name: "Build"
runs-on: ubuntu-20.04
env:
BATECT_CACHE_TYPE: directory
steps:
- uses: actions/[email protected]
- name: Cache dependencies
uses: actions/[email protected]
with:
path: .batect/caches
key: batect-caches-${{ hashFiles('path to a file that uniquely identifies the contents of the caches') }}
- # ...other build steps

The key should be a value that changes when the contents of the cache change, and remains constant otherwise. A good candidate is the hash of a dependency lockfile, such as Gemfile.lock, package-lock.json, yarn.lock or go.sum. The documentation for caching has more details on key.