|
| 1 | +# Development |
| 2 | + |
| 3 | +This document describes the intricacies of sloctl development workflow. |
| 4 | + |
| 5 | +## Makefile |
| 6 | + |
| 7 | +Run `make help` to display short description for each target. |
| 8 | +The provided Makefile will automatically install dev dependencies if they're |
| 9 | +missing and place them under `bin` |
| 10 | +(this does not apply to `yarn` managed dependencies). |
| 11 | +However, it does not detect if the binary you have is up to date with the |
| 12 | +versions declaration located in Makefile. |
| 13 | +If you see any discrepancies between CI and your local runs, remove the |
| 14 | +binaries from `bin` and let Makefile reinstall them with the latest version. |
| 15 | + |
| 16 | +## Testing |
| 17 | + |
| 18 | +In addition to standard unit tests, sloctl is tested with |
| 19 | +[bats](https://bats-core.readthedocs.io/en/stable/) framework. |
| 20 | +Bats is a testing framework for Bash, it provides a simple way to verify |
| 21 | +that shell programs behave as expected. |
| 22 | +Bats tests are located under `test` directory. |
| 23 | +Each test file ends with `.bats` suffix. |
| 24 | +In addition to helper test utilities which are part of the framework we also |
| 25 | +provide custom helpers which are located in `test/test_helper` directory. |
| 26 | + |
| 27 | +Bats tests are currently divided into 2 categories, end-to-end and unit tests. |
| 28 | +The categorization is done through Bats tags. In order to categorize a whole |
| 29 | +file as a unit test, add this comment: `# bats file_tags=unit` anywhere in the |
| 30 | +file, preferably just below shebang. |
| 31 | + |
| 32 | +The end-to-end tests are only run automatically for releases, be it official |
| 33 | +version or pre-release (release candidate). |
| 34 | +The tests are executed against the production application. |
| 35 | +If you want to run the tests manually against a different environment, you can |
| 36 | +run the following command: |
| 37 | + |
| 38 | +```shell |
| 39 | +SLOCTL_CLIENT_ID=<client_id> \ |
| 40 | +SLOCTL_CLIENT_SECRET=<client_secret> \ |
| 41 | +SLOCTL_OKTA_ORG_URL=https://accounts.nobl9.dev \ |
| 42 | +SLOCTL_OKTA_AUTH_SERVER=<dev_auth_server> \ # Runs against dev Okta. |
| 43 | +make test/e2e |
| 44 | +``` |
| 45 | + |
| 46 | +Bats tests are fully containerized, refer to Makefile for more details on |
| 47 | +how they're executed. |
| 48 | + |
| 49 | +## Releases |
| 50 | + |
| 51 | +We're using [Release Drafter](https://github.com/release-drafter/release-drafter) |
| 52 | +to automate release notes creation. Drafter also does its best to propose |
| 53 | +the next release version based on commit messages from `main` branch. |
| 54 | + |
| 55 | +Release Drafter is also responsible for auto-labeling of pull requests. |
| 56 | +It checks both title and body of pull request and adds appropriate labels. \ |
| 57 | +**NOTE:** The auto-labeling mechanism will not remove labels once they're |
| 58 | +created. For example, If you end up changing PR title from `sec:` to `fix:` |
| 59 | +you'll have to manually remove `security` label. |
| 60 | + |
| 61 | +On each commit to `main` branch, Release Drafter will update the next release |
| 62 | +draft. Once you're ready to create new version, simply publish the draft. |
| 63 | + |
| 64 | +In addition to Release Drafter, we're also running a script which extracts |
| 65 | +explicitly listed release notes and breaking changes which are optionally |
| 66 | +defined in `## Release Notes` and `## Breaking Changes` headers. |
| 67 | + |
| 68 | +## Dependencies |
| 69 | + |
| 70 | +Renovate is configured to automatically merge minor and patch updates. |
| 71 | +For major versions, which sadly includes GitHub Actions, manual approval |
| 72 | +is required. |
0 commit comments