diff --git a/.github/workflows/.go.yml b/.github/workflows/.go.yml new file mode 100644 index 0000000..269c22e --- /dev/null +++ b/.github/workflows/.go.yml @@ -0,0 +1,32 @@ +name: Go + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: '1.25' + - name: golangci-lint + uses: golangci/golangci-lint-action@v7 + with: + version: v2.4 + + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: '1.25' + - name: Test + run: go test -v ./... + - name: Vet + run: go vet ./... diff --git a/.github/workflows/.release.yml b/.github/workflows/.release.yml index c6283f5..3c511af 100644 --- a/.github/workflows/.release.yml +++ b/.github/workflows/.release.yml @@ -20,7 +20,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: '1.21' + go-version: '1.25' - name: Run Tests run: go test -v ./... @@ -40,7 +40,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: '1.21' + go-version: '1.25' - name: Generate Man and Completions run: | diff --git a/lefthook.yml b/lefthook.yml new file mode 100644 index 0000000..e0d005f --- /dev/null +++ b/lefthook.yml @@ -0,0 +1,9 @@ +pre-commit: + parallel: true + commands: + fmt-check: + glob: "*.go" + run: gofmt -l {staged_files} | grep . && echo "Run 'go fmt' to fix" && exit 1 || true + golangci-lint: + glob: "*.go" + run: golangci-lint run --new-from-rev=HEAD ./...