Refactoring and fixes #9
This file contains hidden or 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: CI | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ^1.22 | |
cache: true | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Get dependencies | |
run: go mod download | |
- name: Format check | |
run: | | |
gofmt -l -d $(find . -type f -name '*.go' -not -path "./vendor/*") | |
if [ "$(gofmt -l $(find . -type f -name '*.go' -not -path "./vendor/*") | wc -l)" -gt 0 ]; then | |
echo "Code is not formatted. Please run 'make format'" | |
exit 1 | |
fi | |
- name: Build | |
run: go build -v ./... | |
- name: Test | |
run: go test -v -race -coverprofile=coverage.txt -covermode=atomic ./... | |
- name: Upload coverage | |
uses: codecov/codecov-action@v3 | |
with: | |
file: ./coverage.txt | |
fail_ci_if_error: false |