refactor: update goreleaser #1187
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 runs basic linting and formatting checks. | |
| name: Go Validate | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| jobs: | |
| check-mod-tidy: | |
| runs-on: ubuntu-latest | |
| name: Go Mod Tidy Check | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Setup Go | |
| uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0 | |
| with: | |
| go-version-file: go.mod | |
| cache: true | |
| - name: Run go mod tidy | |
| run: go mod tidy | |
| - name: Verify go.mod/go.sum are tidy | |
| shell: bash | |
| run: | | |
| if ! git diff --exit-code; then | |
| echo "go.mod/go.sum are not tidy." | |
| echo "Run: go mod tidy" | |
| exit 1 | |
| fi | |
| check-lint: | |
| runs-on: ubuntu-latest | |
| name: Go Lint Check | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Setup Go | |
| uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0 | |
| with: | |
| go-version-file: go.mod | |
| cache: true | |
| - name: Run golangci-lint | |
| uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0 | |
| with: | |
| version: latest | |
| only-new-issues: true | |
| check-fmt: | |
| runs-on: ubuntu-latest | |
| name: Go Format Check | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Setup Go | |
| uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0 | |
| with: | |
| go-version-file: go.mod | |
| cache: true | |
| - name: Run gofmt | |
| shell: bash | |
| run: | | |
| files="$(gofmt -l .)" | |
| if [[ -n "$files" ]]; then | |
| echo "Found files that are not gofmt'ed:" | |
| echo "$files" | |
| echo | |
| echo "Run: gofmt -w ." | |
| exit 1 | |
| fi | |
| check-generate: | |
| runs-on: ubuntu-latest | |
| name: Go Generate Check | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Setup Go | |
| uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0 | |
| with: | |
| go-version-file: go.mod | |
| cache: true | |
| - name: Run make generate | |
| run: | | |
| export PATH=$PATH:$(go env GOPATH)/bin | |
| make generate | |
| uncommitted="$(git status -s)" | |
| if [[ -z "$uncommitted" ]]; then | |
| echo "OK" | |
| else | |
| echo "Generated files have changed but are not committed." | |
| echo "Run: make generate" | |
| echo "Generated but uncommitted files:" | |
| echo "$uncommitted" | |
| exit 1 | |
| fi |