Repository navigation
Add errx-migrate: type-aware pkg/errors → errx migrator #1
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 all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
1f65625
Add errx-migrate: type-aware pkg/errors -> errx migrator
denisvmedia 139cc0d
Address CodeRabbit review
denisvmedia 93ed4e1
Bump golangci-lint to v2.12.2 and exclude gosec G703
denisvmedia 69de7ba
Harden CI/release workflows and Makefile (CodeRabbit follow-ups)
denisvmedia 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,119 @@ | ||
| name: CI/CD Pipeline | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - master | ||
| pull_request: | ||
|
|
||
| permissions: | ||
| contents: read | ||
| pull-requests: read | ||
|
|
||
| env: | ||
| COVERAGE_THRESHOLD: 50 | ||
|
|
||
| jobs: | ||
| # Setup job to expose variables | ||
| setup: | ||
| name: Setup | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| # Build verification - ensure the tool compiles | ||
| build: | ||
| name: Build | ||
| runs-on: ubuntu-latest | ||
| needs: setup | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 | ||
| with: | ||
| go-version: stable | ||
| cache: true | ||
| cache-dependency-path: go.sum | ||
|
|
||
| - name: Download dependencies | ||
| run: go mod download | ||
|
|
||
| - name: Build library | ||
| run: go build -v ./... | ||
|
|
||
| - name: Build standalone binary | ||
| run: go build -v -o bin/errx-migrate ./cmd/errx-migrate | ||
|
|
||
| # Unit Tests | ||
| unit-tests: | ||
| name: Unit Tests | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| strategy: | ||
| matrix: | ||
| go-version: | ||
| - oldstable | ||
| - stable | ||
| needs: setup | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 | ||
| with: | ||
| go-version: ${{ matrix.go-version }} | ||
| cache: true | ||
| cache-dependency-path: go.sum | ||
|
|
||
| - name: Download dependencies | ||
| run: go mod download | ||
|
|
||
| - name: Run unit tests with race detection | ||
| run: | | ||
| go test -race -v -coverprofile=coverage.out -covermode=atomic ./... | ||
|
|
||
| - name: Generate coverage report | ||
| run: | | ||
| go tool cover -html=coverage.out -o coverage.html | ||
| go tool cover -func=coverage.out | tail -1 | awk '{print $3}' | sed 's/%//' > coverage.txt | ||
|
|
||
| - name: Check coverage threshold | ||
| run: | | ||
| COVERAGE=$(cat coverage.txt) | ||
| echo "Coverage: ${COVERAGE}%" | ||
| if (( $(echo "$COVERAGE < $COVERAGE_THRESHOLD" | bc -l) )); then | ||
| echo "Coverage ${COVERAGE}% is below threshold ${COVERAGE_THRESHOLD}%" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Upload coverage to Codecov | ||
| if: matrix.go-version == 'stable' | ||
| uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6.0.1 | ||
| with: | ||
| files: ./coverage.out | ||
| flags: unittests | ||
| name: codecov-umbrella | ||
| fail_ci_if_error: false | ||
|
|
||
| - name: Upload coverage artifacts | ||
| if: matrix.go-version == 'stable' | ||
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | ||
| with: | ||
| name: coverage-report | ||
| path: | | ||
| coverage.out | ||
| coverage.html | ||
| coverage.txt |
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,49 @@ | ||
| name: Go Lint | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - master | ||
| pull_request: | ||
|
|
||
| permissions: | ||
| contents: read | ||
| pull-requests: read | ||
|
|
||
| jobs: | ||
| golangci: | ||
| name: lint | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| # Checkout code | ||
| - name: Checkout code | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 | ||
| with: | ||
| go-version: stable | ||
| cache: true | ||
| cache-dependency-path: go.sum | ||
|
|
||
| - name: Download dependencies | ||
| run: go mod download | ||
|
|
||
| - name: Check go mod tidy | ||
| run: | | ||
| go mod tidy | ||
| git diff --exit-code go.mod go.sum | ||
|
|
||
| - name: golangci-lint | ||
| uses: golangci/golangci-lint-action@82606bf257cbaff209d206a39f5134f0cfbfd2ee # v9.2.1 | ||
| with: | ||
| args: --timeout=30m | ||
| version: v2.12.2 | ||
|
|
||
| - name: Run govulncheck | ||
| run: | | ||
| go install golang.org/x/vuln/cmd/govulncheck@latest | ||
| govulncheck ./... |
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,85 @@ | ||
| name: Release | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - 'v*' | ||
| pull_request: | ||
| branches: | ||
| - master | ||
|
|
||
| # Least privilege by default; the release job opts into write below. | ||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| # PR path: build a snapshot to validate the GoReleaser config. Read-only | ||
| # permissions and caching disabled so an untrusted PR cannot publish or | ||
| # poison caches used by the trusted (tag) release job. | ||
| snapshot: | ||
| name: GoReleaser Snapshot | ||
| if: github.event_name == 'pull_request' | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| fetch-depth: 0 | ||
| persist-credentials: false | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 | ||
| with: | ||
| go-version: 1.26.0 | ||
| cache: false | ||
|
|
||
| - name: Run GoReleaser (snapshot) | ||
| uses: goreleaser/goreleaser-action@5daf1e915a5f0af01ddbcd89a43b8061ff4f1a89 # v7.2.2 | ||
| with: | ||
| distribution: goreleaser | ||
| version: '~> v2' | ||
| args: release --snapshot --clean --skip=publish | ||
|
|
||
| - name: Upload PR artifacts | ||
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | ||
| with: | ||
| name: release-artifacts | ||
| path: | | ||
| dist/*.tar.gz | ||
| dist/*.zip | ||
| dist/checksums.txt | ||
| retention-days: 7 | ||
|
|
||
| # Tag path: the real release. Runs only on tag pushes (a trusted ref) and is | ||
| # the only job granted write permissions. | ||
| release: | ||
| name: GoReleaser Release | ||
| if: startsWith(github.ref, 'refs/tags/') | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| packages: write | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| fetch-depth: 0 | ||
| persist-credentials: false | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 | ||
| with: | ||
| go-version: 1.26.0 | ||
| cache: true | ||
| cache-dependency-path: go.sum | ||
|
|
||
| - name: Run GoReleaser (production release) | ||
| uses: goreleaser/goreleaser-action@5daf1e915a5f0af01ddbcd89a43b8061ff4f1a89 # v7.2.2 | ||
| with: | ||
| distribution: goreleaser | ||
| version: '~> v2' | ||
| args: release --clean | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
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.