Contributions to devbase
are super welcome! This document is a guide to help you get started.
Generally when working on larger scale features and changes, it's a good idea to open an RFC (Request For Comments) to discuss the design and implementation of the feature. This is to ensure that the design and implementation of the feature is well thought out, documented, and given time for feedback from the community.
To learn more about that, look at the documentation in the ./rfcs
directory.
This project uses devbase, which exposes the following build tooling: devbase/docs/makefile.md
We use bats to test our shell scripts. You can run the tests with:
make test
To write a test, simply created a <name>_test.bats
file with <name>
being replaced by the name of the shellscript you wish to test. A good
starting point is to model it based off of this template:
#!/usr/bin/env bats
bats_load_library "bats-support/load.bash"
bats_load_library "bats-assert/load.bash"
load <shellScriptHere>.sh
@test "function_goes_here should do xyz" {
run function_goes_here
assert_output "expected output"
}
For more information on how to write bats tests, see the bats
documentation
as well as existing tests in this repository (search for *_test.bats
files!)
If you want to test changes to the shared orb:
- Make the changes to the orb
- Run
make publish-orb
- In a test service, change the orb version (after the
@
, example) todev:first
This is only applicable if this repository exposes a public package.
If you want to test a package exposed in this repository in a project that uses it, you can
add the following replace
directive to that project's go.mod
file:
replace github.com/getoutreach/devbase => /path/to/local/version/devbase
Note: This repository may have postfixed it's module path with a version, go check the first
line of the go.mod
file in this repository to see if that is the case. If that is the case,
you will need to modify the first part of the replace directive (the part before the =>
) with
that postfixed path.
You can run the linters and unit tests with:
make test