Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 26 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Version: 0.3-SNAPSHOT
## Intro
<!-- Quick Description, could match Github repo description or have a little more info-->

This is an example project with a goal of 100% passing [Core Infrastructure Initiative Criteria] status. It is based off of the [Github Semver Project](https://github.com/devlinjunker/template.github.semver) Template.
This is an example project with a goal of 100% passing [Core Infrastructure Initiative Criteria] status. It is based off of the [GitHub Semver Project] Template.

Contains the following improvements for passing status:
- Automated Test Suite (for Bash Scripts)
Expand All @@ -33,16 +33,27 @@ Contains the following improvements for passing status:

## Quick Setup/Run
<!-- This section should try to quickly explain how to setup the project and start using it (server/app/demo/template) - ideally in list format -->

<!-- - [ ] Review the [Wiki] - overview of the concepts -->
- [ ] [Clone or Template to New Project][Contributing Guide]
- [ ] Review/Update [License] File
- [ ] Review/Update [Security Policy]
- Provide private way of reporting vulnerabilities?
- [ ] Update this README and Links with project specific details
- [ ] Review [Github Workflows] in Template (and improve for your process)
- [ ] Add Custom Project Build and Configuration Files
- Start Writing Tests and Coding!

- [ ] Review documentation in [GitHub Semver Project]
- [ ] Clone repo (with submodules)
- follow GitHub Semver Project setup steps if creating your own project

### Add Code
- [ ] Create branch matching style `<prefix>/<hyphenated-description>
- [ ] Add changes to branch
- [ ] Before push, if hooks are installed, should do the following (otherwise manual):
- [ ] Run bash linting with `./scripts/bin/lint.sh`
- [ ] Run all unit tests with `./scripts/bin/test.sh`
- [ ] Create Pull Request against `develop`


### Create Release
See full details in the Github Semver Project [wiki](https://github.com/devlinjunker/template.github.semver/wiki/Release)
- **Must be after `feature/*` or `feat/*` branch is merged**
- [ ] Initiate `release-cut` GitHub Action
- [ ] Merge the created `release-*` PR to `main` to start release
- **Avoid `squash and merge`**


## Links

Expand All @@ -52,6 +63,8 @@ Contains the following improvements for passing status:
<!-- - [Wiki] -->
- External
- [Core Infrastructure Initiative Criteria]
- [BATS]
- [ShellCheck]

## Contributors

Expand All @@ -71,4 +84,5 @@ Contains the following improvements for passing status:
[Bulldozer]: https://github.com/palantir/bulldozer
[Git-mkver]: https://idc101.github.io/git-mkver/
[BATS]: https://bats-core.readthedocs.io/
[ShellCheck]: https://www.shellcheck.net/
[ShellCheck]: https://www.shellcheck.net/
[GitHub Semver Project]: https://github.com/devlinjunker/template.github.semver
5 changes: 4 additions & 1 deletion scripts/bin/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ lint_scripts() {


main() {
lint_scripts
# skip if in test (avoid infinite loop)
if [[ -z $BATS_TMPDIR ]]; then
lint_scripts
fi
}

main "$@"
19 changes: 11 additions & 8 deletions scripts/bin/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,17 @@ all_script_tests() {
}

main() {
case "$1" in
--file | -f)
find_script_test "${@: 2}"
;;
--all | -a | *)
all_script_tests
;;
esac
# skip if in test (avoid infinite loop)
if [[ -z "$BATS_TMPDIR" ]]; then
case "$1" in
--file | -f)
find_script_test "${@: 2}"
;;
--all | -a | *)
all_script_tests
;;
esac
fi
}

main "$@"
2 changes: 2 additions & 0 deletions scripts/hooks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ Git hooks need to be added to your local repo for each project,

### pre-push
- enforces that the branch name matches style: <prefix>/<feature_name>
- runs `scripts/bin/lint.sh` to lint before pushing
- runs `scripts/bin/test.sh` to require unit tests pass before pushing

### post-commit
- warns when changes are getting large since "last merge"
Expand Down
14 changes: 14 additions & 0 deletions scripts/hooks/pre-push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,20 @@ main() {
return 1;
fi

git stash save -k "githook uncommitted changes" > /dev/null;

if ! $DIR/../bin/lint.sh; then
git stash pop;
return 1;
fi


if ! $DIR/../bin/test.sh; then
git stash pop;
return 1;
fi

git stash pop || true;
}

main
Expand Down