A GitHub Action to setup BATS testing framework.
A sample workflow to run tests using BATS (.github/workflows/ci.yml
):
name: "CI"
on: [push, pull_request]
jobs:
build:
name: build
runs-on: ubuntu-latest
steps:
- name: Setup BATS
uses: mig4/setup-bats@v1
with:
bats-version: 1.2.1
- name: Check out code
uses: actions/checkout@v1
- name: Test
run: bats -r .
Options available as keys in with
block
bats-version
(string
): version of BATS to setup, defaults to 1.2.1 if not set
So far this action has only been tested on Linux environments.
See known issues, if you found one that's not on the list or have a suggestion for improvement, open a new issue. If you can, fork and send a PR, it will be appreciated 💖.
Install the dependencies
$ npm install
Build the typescript
$ npm run build
Run the tests ✔️
$ npm test
...
PASS __tests__/installer.test.ts
installer tests
✓ Acquires version of BATS if no matching version is installed (1051ms)
✓ Throws if no matching version of BATS can be found (674ms)
The action.yml
file defines the inputs and output, description, etc. of the
action.
See the documentation:
Actions are run from GitHub repos. It's recommended for users to only refer to release branches instead of consuming master directly. To create a release branch, you'd normally do:
$ git checkout -b releases/v1
$ npm prune --production
$ git add node_modules
$ git commit -a -m "Release v1"
However some of that is automated using husky git hooks, so it's enough to just do:
$ git checkout -b releases/v1
sed -i '/^node_modules/s/^/#/' .gitignore
# update README.md to refer to @v1
$ git commit -a -m "Release v1"
$ git push origin releases/v1
Now to release a new minor/patch versions from that branch (replace .x.y
as
appropriate):
# update "version" property in `package.json`
$ npm install
$ npm run build && npm run format
$ npm prune --production
$ git add -A
$ git commit -v -m "Release v1.x.y"
$ git push
$ git tag -s v1.x.y
$ git tag -fs v1 -m "Update v1 tag"
$ git push --tags --force
The action is now published! 🚀
See the versioning documentation
- typescript-action template
- existing setup actions