snb
snb, abbreviation for "Shake 'N Bake", is a flexible build automation tool with caching capabilities and straightfoward rules. To use, simply run the executable in the directory containing a ShakeAndBakeFile spec or pass the directory as an argument.
Installation
Using Homebrew:
$ brew update
...
$ brew install aemengo/snb/snb https://github.com/aemengo/snb
Spec
$ cat ShakeAndBakeFile
RUN ./operation.sh ./build-artifacts
RUN echo "success!"
An example ShakeAndBakeFile looks like above. Steps are declared with RUN
directive and must be terminated with a completely blank line or the end of the file. Multi-line statements are supported.
Implementation
Each step is scanned for referenced files and directories. A sha1 checksum is taken after each is executed, for the aforementioned files and directories, and stored in a sqlite database in .snb/snb.db
. When snb is invoked again, the step definition and checksums of referenced files and directories are compared: opting to skip any steps that completely match.
A best practice is to document the input and output artifacts of every step that you'd wish snb to track for changes.
Step Details
- Each step is executed in its own
bash
shell, so declared environment variables and directory changes will not carry over.
- Each step is executed relative to the directory of the ShakeAndBakeFile.
- Each step is executed with all environment variables of the shell that snb is invoked in.
- Each step without any referenced files or directories will not be cached.
Building
Prerequisites
-
cd
into the root directory of the project.
-
Compile the snb library.
$ go build .
Testing
-
Install the ginkgo test runner cli
$ go get -u github.com/onsi/ginkgo/ginkgo
-
Execute tests
$ ginkgo -r
License
Apache 2.0.
Copyright (c) 2018 Anthony Emengo