Improve CI/CD and Test Coverage #28
Workflow file for this run
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
| # This workflow will build a golang project | |
| # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go | |
| name: Go | |
| on: | |
| push: | |
| branches: [ "root" ] | |
| pull_request: | |
| branches: [ "root" ] | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up Go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: '1.24' | |
| cache: true | |
| - name: Get dependencies | |
| run: | | |
| go mod download | |
| go mod verify | |
| - name: Verify formatting | |
| run: | | |
| gofmt -l . > gofmt_diff.txt | |
| if [ -s gofmt_diff.txt ]; then | |
| echo "Run 'go fmt ./...' to fix formatting" | |
| cat gofmt_diff.txt | |
| exit 1 | |
| fi | |
| - name: Vet | |
| run: go vet ./... | |
| - name: Install golangci-lint | |
| run: | | |
| curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.54.2 | |
| - name: Run golangci-lint | |
| run: golangci-lint run ./... | |
| - name: Build | |
| run: go build -v ./... | |
| - name: Test with Race Detector and Coverage | |
| run: go test -race -coverprofile=coverage.out -covermode=atomic -v ./... | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v3 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} # optional, but required for private repos | |
| file: ./coverage.out | |
| flags: unittests | |
| name: codecov-umbrella |