Merge pull request #3 from andrew/dependabot/go_modules/github.com/cl… #10
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: Test | |
| on: | |
| push: | |
| branches: [main, master] | |
| pull_request: | |
| branches: [main, master] | |
| jobs: | |
| test: | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.23' | |
| - name: Install dependencies | |
| run: go mod download | |
| - name: Build | |
| run: go build -v ./... | |
| - name: Test | |
| run: go test -v -race ./... | |
| - name: Test with coverage | |
| if: matrix.os == 'ubuntu-latest' | |
| run: go test -race -coverprofile=coverage.out $(go list ./... | grep -v /cmd/) | |
| - name: Upload coverage | |
| if: matrix.os == 'ubuntu-latest' | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| files: coverage.out | |
| fail_ci_if_error: false | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.23' | |
| - name: Run go vet | |
| run: go vet ./... | |
| - name: Run go fmt check | |
| run: | | |
| if [ -n "$(gofmt -l .)" ]; then | |
| echo "Files not formatted:" | |
| gofmt -l . | |
| exit 1 | |
| fi |