set on push tag only #17
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Go Test | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
branches: | |
- main | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.21 | |
- name: Run Tests | |
run: | | |
go test -v -coverprofile=coverage.txt -covermode=atomic ./... | |
- name: Lint Code | |
run: go vet ./... | |
- name: Install Dependencies | |
run: go mod download | |
- name: Build | |
run: go build ./... | |
- name: Check for Code Formatting | |
run: | | |
fmtcount=$(gofmt -l . | wc -l) | |
if [ $fmtcount -gt 0 ]; then | |
echo "Code is not formatted. Run 'gofmt' and commit the changes." | |
exit 1 | |
fi |