District 21 Game
go test ./... -v
If we want test with coverage
go test ./... -test.coverprofile coverage go test ./... -cover
CI Tool Chain For Go
For my personal code I use GitHub as a repository, so assuming that the tools I’ll employ are:
-
GitHub Actions: Automate the workflow
-
Codecov.io: A coverage dashboard
-
Readme badges: Easy visibility dashboard on CI status
-
Templates CI/CD for golang projects
Start with any events on
- Push:
- On branches
main
orfeature
- On branches
- Any pull_request
stateDiagram
direction LR
[*] --> checkout@v3
checkout@v3 --> setup_go@v3
setup_go@v3 --> vet
vet --> fmt
fmt --> test
test --> go_coverage_badge
go_coverage_badge --> verify_changed_files
verify_changed_files --> push_changes
push_changes --> build
build --> [*]
Start with
- Push:
- On Tag with name as
v*
- On branches
main
orfeature
- On Tag with name as
- Any pull_request
stateDiagram
direction LR
[*] --> checkout@v3
checkout@v3 --> golangci_lint
golangci_lint --> [*]
- Push:
- On Tag with name as
v*
- On only branches
main
- On Tag with name as
- Any pull_request
stateDiagram
direction LR
[*] --> checkout@v3
checkout@v3 --> setup_go@v3
setup_go@v3 --> goreleaser
goreleaser --> [*]
jobs:
greeting:
runs-on: ubuntu-latest
steps:
- uses: actions/first-interaction@v1.1.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
issue-message: "Thanks for reporting this issue, don't forget to star this project if you haven't already to help us reach a wider audience."
pr-message: "Thanks for implementing a fix, could you ensure that the test covers your changes if applicable."
Include Fix
fix(#issueId): include a comment
Include Feature
feat(#issueId): Include an commit change
Improbe documentation
doc(#issueid): Include an change
For example doc(#1): [README.md] Include CI and CD Workflows