diff --git a/.github/workflows/autoupdate.yaml b/.github/workflows/autoupdate.yaml new file mode 100644 index 0000000..af1e3b0 --- /dev/null +++ b/.github/workflows/autoupdate.yaml @@ -0,0 +1,20 @@ +name: Autoupdate go.mod and go.sum + +on: + workflow_dispatch: + schedule: + - cron: "0 3 * * *" + +permissions: + contents: write + actions: write + pull-requests: write + security-events: write + +jobs: + autoupdate: + uses: lukaszraczylo/shared-actions/.github/workflows/go-autoupdate.yaml@main + with: + go-version: ">=1.24" + release-workflow: "release.yaml" + secrets: inherit diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index ccba5c8..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: ci - -on: - push: - branches: [main] - pull_request: - branches: [main] - -jobs: - test: - name: test - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version-file: go.mod - cache: true - - name: vet - run: go vet ./... - - name: build - run: go build ./... - - name: test - run: go test -race -count=1 ./... - - lint: - name: lint - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version-file: go.mod - cache: true - - uses: golangci/golangci-lint-action@v6 - with: - version: latest diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml new file mode 100644 index 0000000..6ab7a3b --- /dev/null +++ b/.github/workflows/lint.yaml @@ -0,0 +1,40 @@ +name: Lint + +on: + push: + branches: + - main + paths: + - '**.go' + - 'go.mod' + - 'go.sum' + - '.golangci.yml' + pull_request: + paths: + - '**.go' + - 'go.mod' + - 'go.sum' + - '.golangci.yml' + +permissions: + contents: read + +jobs: + golangci: + name: golangci-lint + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + cache: true + + - name: Run golangci-lint + uses: golangci/golangci-lint-action@v8 + with: + version: v2.9.0 + args: --timeout=5m diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..c746d9d --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,23 @@ +name: Test, build, release + +on: + workflow_dispatch: + push: + paths-ignore: + - '**.md' + - '**/release.yaml' + branches: + - main + +permissions: + id-token: write + contents: write + packages: write + +jobs: + release: + uses: lukaszraczylo/shared-actions/.github/workflows/go-release.yaml@main + with: + go-version: ">=1.24" + rolling-release-tag: "v1" + secrets: inherit diff --git a/.github/workflows/security.yaml b/.github/workflows/security.yaml new file mode 100644 index 0000000..177ccf6 --- /dev/null +++ b/.github/workflows/security.yaml @@ -0,0 +1,40 @@ +name: Security Scan + +on: + push: + branches: + - main + paths: + - '**.go' + - 'go.mod' + - 'go.sum' + pull_request: + paths: + - '**.go' + - 'go.mod' + - 'go.sum' + schedule: + - cron: '0 9 * * 1' + +permissions: + contents: read + +jobs: + govulncheck: + name: Run govulncheck + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + cache: true + + - name: Install govulncheck + run: go install golang.org/x/vuln/cmd/govulncheck@latest + + - name: Run govulncheck + run: govulncheck ./... diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..4c68c45 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,43 @@ +version: "2" + +run: + timeout: 5m + go: '1.25' + +linters: + enable: + - errcheck + - govet + - ineffassign + - staticcheck + - unused + - gocyclo + - misspell + +formatters: + enable: + - gofmt + +linters-settings: + gocyclo: + min-complexity: 15 + errcheck: + check-blank: true + govet: + enable-all: true + staticcheck: + checks: ["all"] + +issues: + exclude-rules: + - path: _test\.go + linters: + - gocyclo + - errcheck + - gosec + + max-issues-per-linter: 0 + max-same-issues: 0 + +output: + sort-results: true diff --git a/semver.yaml b/semver.yaml new file mode 100644 index 0000000..526b1a9 --- /dev/null +++ b/semver.yaml @@ -0,0 +1,21 @@ +version: 1 +force: + existing: true + strict: false + minor: 1 +wording: + patch: + - update + - initial + - fix + - chore + - docs + - test + minor: + - release + - refactor + - feat + - feature + major: + - breaking + - major