ci: move gofmt to formatters section for golangci-lint v2 #49
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: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| test: | |
| name: Test (${{ matrix.os }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: actions/setup-go@v7 | |
| with: | |
| go-version: "1.26.x" | |
| cache: true | |
| - name: go vet | |
| run: go vet ./... | |
| - name: go test | |
| shell: bash | |
| run: go test -race -count=1 -coverprofile=coverage.out ./... | |
| - name: Upload coverage artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: coverage-${{ matrix.os }} | |
| path: coverage.out | |
| retention-days: 7 | |
| coverage: | |
| name: Coverage | |
| runs-on: ubuntu-latest | |
| needs: test | |
| if: always() | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: actions/setup-go@v7 | |
| with: | |
| go-version: "1.26.x" | |
| cache: true | |
| - name: Download ubuntu coverage | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: coverage-ubuntu-latest | |
| path: . | |
| - name: Upload to Codecov | |
| uses: codecov/codecov-action@v7 | |
| with: | |
| files: coverage.out | |
| continue-on-error: true | |
| - name: Print coverage summary | |
| run: go tool cover -func=coverage.out | tail -1 | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: actions/setup-go@v7 | |
| with: | |
| go-version: "1.26.x" | |
| cache: true | |
| - name: go vet | |
| run: go vet ./... | |
| - name: golangci-lint | |
| uses: golangci/golangci-lint-action@v9 | |
| with: | |
| version: latest | |
| args: --timeout=5m | |
| install-mode: goinstall | |
| - name: govulncheck | |
| run: | | |
| go install golang.org/x/vuln/cmd/govulncheck@latest | |
| govulncheck ./... | |
| build: | |
| name: Build & Cross-compile | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: actions/setup-go@v7 | |
| with: | |
| go-version: "1.26.x" | |
| cache: true | |
| - name: Build (linux/amd64) | |
| run: CGO_ENABLED=0 go build -v ./cmd/gomnibus | |
| - name: Cross-compile (darwin/amd64) | |
| run: CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o /tmp/gomnibus-darwin-amd64 ./cmd/gomnibus | |
| - name: Cross-compile (darwin/arm64) | |
| run: CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o /tmp/gomnibus-darwin-arm64 ./cmd/gomnibus | |
| - name: Cross-compile (windows/amd64) | |
| run: CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o /tmp/gomnibus-windows-amd64.exe ./cmd/gomnibus | |
| - name: Cross-compile (linux/arm64) | |
| run: CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o /tmp/gomnibus-linux-arm64 ./cmd/gomnibus | |
| - name: Validate example project | |
| working-directory: examples/myapp | |
| run: ../../gomnibus validate myapp | |
| release: | |
| name: Release | |
| runs-on: ubuntu-latest | |
| needs: [test, build] | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-go@v7 | |
| with: | |
| go-version: "1.26.x" | |
| cache: true | |
| - uses: goreleaser/goreleaser-action@v7 | |
| with: | |
| version: latest | |
| args: release --clean | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |