Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Github actions that setup Bats all the bats libs: support, assert, detik, file.

License

Notifications You must be signed in to change notification settings

draios/infra-action-setup-bats-libs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Setup Bats and Bats libraries

This GitHub Action installs Bats and the four major bats libraries:

The action can be also instructed to select which libraries to install.

How to use it

on: [push]

jobs:
   my_test:
     runs-on: ubuntu-latest
     name: Install Bats and bats libs
     steps:
       - name: Checkout
         uses: actions/checkout@v2
       - name: Setup Bats and bats libs
         uses: brokenpip3/[email protected]

Libraries Path

For each of the Bats libraries, you can choose to install them in the default location (/usr/lib/bats-<lib-name>) or specify a custom path.

For example, if you want to install bats-support in the ./test/bats-support directory, you can configure it as follows:

# ...
       - name: Setup Bats and Bats libs
         uses: brokenpip3/[email protected]
         with:
           support-path: ${{ github.workspace }}/test/bats-support

About Caching

The caching mechanism for the bats binary is always available. However, the caching for the bats libraries is dependent on the location of each library path. If a library is located within the $HOME directory, caching is supported. Conversely, if a library is located outside the $HOME directory (which is the default location per each library), caching is not supported. This is due to a known limitation with sudo and the cache action, as detailed in this GitHub issue: actions/toolkit#946.

Inputs

Key Default Required Description
bats-install true false Bats installation, cache supported
bats-version latest false Bats version
support-install true false Bats-support installation
support-version 0.3.0 false Bats-support version
support-path /usr/lib/bats-support false Bats-support path
support-clean true false Bats-support: clean temp files
assert-install true false Bats-assert installation
assert-version 2.1.0 false Bats-assert version
assert-path /usr/lib/bats-assert false Bats-assert path
assert-clean true false Bats-assert: clean temp files
detik-install true false Bats-detik installation
detik-version 1.2.0 false Bats-detik version
detik-path /usr/lib/bats-detik false Bats-detik path
detik-clean true false Bats-detik: clean temp files
file-install true false Bats-file installation
file-version 0.3.0 false Bats-file version
file-path /usr/lib/bats-file false Bats-file path
file-clean true false Bats-file: clean temp files

Outputs

Key Description
bats-installed True/False if bats has been installed
support-installed True/False if bats-support has been installed
assert-installed True/False if bats-assert has been installed
detik-installed True/False if bats-detik has been installed
file-installed True/False if bats-file has been installed

TODO

  • Add more tests

  • Add Bats binary

  • Add cache for bats binary

  • Better Readme

  • Remove sudo in case of bats libs installed in $HOME

  • Add cache for bats libs

About

Github actions that setup Bats all the bats libs: support, assert, detik, file.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 100.0%