From 43f4b2dc961768c1c6eb35f7f41ef73a63543baa Mon Sep 17 00:00:00 2001 From: Andriy Oblivantsev Date: Sat, 2 May 2026 20:00:08 +0100 Subject: [PATCH] chore: add GitHub workflows for linting, testing, and release management - Introduced dependabot configuration for Go modules and GitHub Actions. - Added linting workflow to enforce code quality on pushes and pull requests. - Created release workflow to automate versioning and releases based on tags. - Implemented testing workflow to run tests across multiple Go versions and OS environments. --- .github/dependabot.yml | 44 ++++++++++++++++++++ .github/workflows/lint.yml | 32 +++++++++++++++ .github/workflows/release-please.yml | 26 ++++++++++++ .github/workflows/release.yml | 32 +++++++++++++++ .github/workflows/test.yml | 61 ++++++++++++++++++++++++++++ 5 files changed, 195 insertions(+) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/release-please.yml create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..9e1baed --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,44 @@ +version: 2 + +updates: + - package-ecosystem: gomod + directory: "/" + schedule: + interval: weekly + day: monday + time: "06:00" + timezone: Etc/UTC + open-pull-requests-limit: 10 + commit-message: + prefix: "chore(deps)" + include: scope + labels: + - dependencies + - go + groups: + go-minor-and-patch: + applies-to: version-updates + update-types: + - minor + - patch + + - package-ecosystem: github-actions + directory: "/" + schedule: + interval: weekly + day: monday + time: "06:00" + timezone: Etc/UTC + open-pull-requests-limit: 5 + commit-message: + prefix: "ci(actions)" + include: scope + labels: + - dependencies + - github-actions + groups: + actions-minor-and-patch: + applies-to: version-updates + update-types: + - minor + - patch diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..da02876 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,32 @@ +name: Lint + +on: + push: + branches: [main] + pull_request: + +permissions: + contents: read + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: stable + cache: true + + - name: Run go vet + run: go vet ./... + + - name: golangci-lint + uses: golangci/golangci-lint-action@v6 + with: + version: latest + args: --timeout 5m diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml new file mode 100644 index 0000000..916d09b --- /dev/null +++ b/.github/workflows/release-please.yml @@ -0,0 +1,26 @@ +name: Release Please + +on: + push: + branches: [main] + +permissions: + contents: write + pull-requests: write + +jobs: + release-please: + name: Release Please + runs-on: ubuntu-latest + steps: + - name: Run release-please + uses: googleapis/release-please-action@v4 + id: release + with: + config-file: release-please-config.json + manifest-file: .release-please-manifest.json + token: ${{ secrets.GITHUB_TOKEN }} + + outputs: + release_created: ${{ steps.release.outputs.release_created }} + tag_name: ${{ steps.release.outputs.tag_name }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..35b1b0f --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,32 @@ +name: Release + +on: + push: + tags: ["v*"] + +permissions: + contents: write + +jobs: + goreleaser: + name: GoReleaser + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: stable + cache: true + + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v6 + with: + distribution: goreleaser + version: "~> v2" + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..4e5ed50 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,61 @@ +name: Tests + +on: + push: + branches: [main] + pull_request: + +permissions: + contents: read + +jobs: + test: + name: Test (Go ${{ matrix.go }} / ${{ matrix.os }}) + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + go: + - "1.22" + - "1.23" + - "stable" + include: + - os: macos-latest + go: "stable" + - os: windows-latest + go: "stable" + + steps: + - uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: ${{ matrix.go }} + cache: true + + - name: Verify dependencies + run: | + go mod verify + go mod download + + - name: Check go mod tidy + if: runner.os != 'Windows' + run: | + go mod tidy + git diff --exit-code go.mod go.sum + + - name: Build + run: go build ./... + + - name: Run tests with race detector and shuffle + run: go test -race -shuffle=on -count=1 -coverprofile=coverage.out -covermode=atomic ./... + + - name: Upload coverage + if: matrix.os == 'ubuntu-latest' && matrix.go == 'stable' + uses: codecov/codecov-action@v5 + with: + files: ./coverage.out + fail_ci_if_error: false + token: ${{ secrets.CODECOV_TOKEN }}