-
Notifications
You must be signed in to change notification settings - Fork 0
Update CI/CD workflows #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 6 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
107f968
Update CI/CD workflows
EndlessTrax 9bb840c
fix(lint): update golangci-lint config to v2 schema and fix errcheck …
EndlessTrax 384858c
fix(goreleaser): update Taskfile to find goreleaser in ~/go/bin; upda…
EndlessTrax ddba9e6
Updates for version consistency
EndlessTrax f51c34d
ci(lint): use golangci-lint v2.5.0 in CI and pin Taskfile install; ke…
EndlessTrax ee03ff0
ci(lint): install golangci-lint using @latest to avoid invalid tag
EndlessTrax 614626c
Update .github/workflows/release.yml
EndlessTrax 6499aad
Fix lint workflow
EndlessTrax 56f9914
Fix Lint config
EndlessTrax 4717805
Fix lint config
EndlessTrax File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| --- | ||
| name: Format | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [main] | ||
| paths: | ||
| - "**/*.go" | ||
| - ".github/workflows/format.yml" | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| format-check: | ||
| name: Format Check | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version-file: go.mod | ||
| cache: true | ||
|
|
||
| - name: Check formatting | ||
| run: | | ||
| if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then | ||
| echo "The following files are not properly formatted:"; | ||
| gofmt -s -l .; | ||
| echo ""; | ||
| echo "Please run 'go fmt ./...' to fix formatting issues."; | ||
| exit 1; | ||
| fi |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| --- | ||
| name: Lint | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [main] | ||
| paths: | ||
| - "**/*.go" | ||
| - ".golangci.yml" | ||
| - "go.mod" | ||
| - "go.sum" | ||
| - ".github/workflows/lint.yml" | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| golangci: | ||
| name: golangci-lint | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version-file: go.mod | ||
| cache: true | ||
|
|
||
| - name: Install golangci-lint (latest) | ||
| run: | | ||
| go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest | ||
| ~/go/bin/golangci-lint --version | ||
|
|
||
| - name: Run golangci-lint | ||
| run: ~/go/bin/golangci-lint run --timeout=5m ./... |
This file was deleted.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| name: Release | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - 'v*.*.*' | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
|
||
| concurrency: | ||
| group: release-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| goreleaser: | ||
| name: Release with GoReleaser | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| # GoReleaser needs full history for changelog generation | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Setup Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version-file: go.mod | ||
| cache: true | ||
|
|
||
| - name: Validate version match | ||
| run: | | ||
| # Extract version from git tag (strip 'v' prefix) | ||
| TAG_VERSION="${GITHUB_REF#refs/tags/v}" | ||
| echo "Tag version: v${TAG_VERSION}" | ||
|
|
||
| # Extract version from cmd/root.go | ||
| CODE_VERSION=$(grep -oP 'Version:\s*"\K[^"]+' cmd/root.go) | ||
| echo "Code version: ${CODE_VERSION}" | ||
|
|
||
| # Compare versions | ||
| if [ "${TAG_VERSION}" != "${CODE_VERSION}" ]; then | ||
| echo "❌ Error: Version mismatch!" | ||
| echo " Git tag: v${TAG_VERSION}" | ||
| echo " Code: ${CODE_VERSION}" | ||
| echo "" | ||
| echo "Please update the version in cmd/root.go to match the tag." | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "✅ Version match confirmed: ${CODE_VERSION}" | ||
|
|
||
| - name: Run GoReleaser | ||
| uses: goreleaser/goreleaser-action@v6 | ||
| with: | ||
| distribution: goreleaser | ||
| version: latest | ||
| args: release --clean | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| --- | ||
| name: Tests | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [ main ] | ||
| paths: | ||
| - '**/*.go' | ||
| - 'go.mod' | ||
| - 'go.sum' | ||
| - '.github/workflows/tests.yml' | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| unit-tests: | ||
| name: Unit Tests | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version-file: go.mod | ||
| cache: true | ||
|
|
||
| - name: Download deps | ||
| run: go mod download | ||
|
|
||
| - name: Run tests | ||
| run: go test -v -race |
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 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,46 +1,36 @@ | ||
| version: "2" | ||
| # golangci-lint configuration | ||
| # See https://golangci-lint.run/usage/configuration/ | ||
|
|
||
| version: 2 | ||
|
|
||
| run: | ||
| tests: true | ||
| timeout: 5m | ||
|
|
||
| linters: | ||
| enable: | ||
| - goconst | ||
| - gosec | ||
| - misspell | ||
| - unconvert | ||
| - unparam | ||
| settings: | ||
| goconst: | ||
| min-len: 2 | ||
| min-occurrences: 3 | ||
| exclusions: | ||
| generated: lax | ||
| presets: | ||
| - comments | ||
| - common-false-positives | ||
| - legacy | ||
| - std-error-handling | ||
| rules: | ||
| - linters: | ||
| - gosec | ||
| - unparam | ||
| path: _test\.go | ||
| paths: | ||
| - third_party$ | ||
| - builtin$ | ||
| - examples$ | ||
| formatters: | ||
| enable: | ||
| - gofmt | ||
| - goimports | ||
| settings: | ||
| gofmt: | ||
| simplify: true | ||
| goimports: | ||
| local-prefixes: | ||
| - github.com/endlesstrax/brokli | ||
| exclusions: | ||
| generated: lax | ||
| paths: | ||
| - third_party$ | ||
| - builtin$ | ||
| - examples$ | ||
|
|
||
| linters-settings: | ||
| goconst: | ||
| min-len: 2 | ||
| min-occurrences: 3 | ||
| gofmt: | ||
| simplify: true | ||
| goimports: | ||
| local-prefixes: github.com/endlesstrax/brokli | ||
|
|
||
| issues: | ||
| exclude-rules: | ||
| - path: _test\.go | ||
| linters: | ||
| - gosec | ||
| - unparam | ||
| exclude-dirs: | ||
| - third_party | ||
| - builtin | ||
| - examples |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| # GoReleaser config for brokli (v2) | ||
| # See https://goreleaser.com for reference | ||
|
|
||
| version: 2 | ||
|
|
||
| project_name: brokli | ||
|
|
||
| before: | ||
| hooks: | ||
| - go mod tidy | ||
|
|
||
| builds: | ||
| - id: brokli | ||
| main: . | ||
| binary: brokli | ||
| env: | ||
| - CGO_ENABLED=0 | ||
| flags: | ||
| - -trimpath | ||
| ldflags: | ||
| - -s -w | ||
EndlessTrax marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| goos: [linux, darwin, windows] | ||
| goarch: [amd64, arm64] | ||
| goarm: ["7"] | ||
|
|
||
| archives: | ||
| - name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}' | ||
| files: | ||
| - LICENSE* | ||
| - README* | ||
| - CHANGELOG* | ||
|
|
||
| checksum: | ||
| name_template: 'SHA256SUMS_{{ .Version }}.txt' | ||
|
|
||
| changelog: | ||
| use: github | ||
|
|
||
| release: | ||
| prerelease: auto | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.