Skip to content

Latest commit

 

History

History
86 lines (57 loc) · 2.9 KB

CONTRIBUTING.md

File metadata and controls

86 lines (57 loc) · 2.9 KB

devbase

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.

Prerequisites

Building and Testing

This project uses devbase, which exposes the following build tooling: devbase/docs/makefile.md

Shell Script Testing (with bats)

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!)

Building and testing the CircleCI orb

If you want to test changes to the shared orb:

  1. Make the changes to the orb
  2. Run make publish-orb
  3. In a test service, change the orb version (after the @, example) to dev:first

Replacing a Remote Version of the a Package with Local Version

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.

Linting and Unit Testing

You can run the linters and unit tests with:

make test