Action — bats
Installs Bats (Bash Automated Testing System) and runs shell unit tests.
Usage
yaml
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
submodules: true # required if using bats helpers (bats-support, bats-assert, etc.)
- uses: KevinDeBenedetti/github-workflows/.github/actions/bats@v0.57.0 # x-release-please-version
with:
tests-dir: tests/Inputs
| Input | Type | Default | Description |
|---|---|---|---|
tests-dir | string | tests/ | Directory (or file) containing .bats test files |
recursive | boolean | false | Also run .bats files in sub-directories (bats --recursive). Off by default: vendored helpers under test_helper/ ship their own suites |
Steps
- Install a pinned Bats release from the upstream repository into
$RUNNER_TEMP(nosudo, no npm) withinstall-tool - Run
bats [--recursive] <tests-dir>
Notes
- Pass a specific
.batsfile path totests-dirto run a single test file. - Bats helper libraries (
bats-support,bats-assert,bats-file) are typically added as git submodules — check out withsubmodules: truein your checkout step.