fix: improve build pipeline and goreleaser configuration#2
Conversation
Shoaibashk
commented
Dec 23, 2025
- Fix goreleaser cross-compilation issues by disabling CGO and removing Darwin builds on Windows
- Remove deprecated goreleaser options (archives.format and archives.format_overrides)
- Add dist/ folder to .gitignore
- Create PR checks workflow for automated testing (go vet, go fmt, tests, coverage, build)
- Fix goreleaser cross-compilation issues by disabling CGO and removing Darwin builds on Windows - Remove deprecated goreleaser options (archives.format and archives.format_overrides) - Add dist/ folder to .gitignore - Create PR checks workflow for automated testing (go vet, go fmt, tests, coverage, build)
There was a problem hiding this comment.
Pull request overview
This pull request improves the build and release pipeline by adding GoReleaser configuration and GitHub Actions workflows. The changes fix cross-compilation issues by disabling CGO and establish automated CI/CD processes for both pull request validation and releases.
Key changes:
- Added GoReleaser configuration for cross-platform builds (Linux, Windows, FreeBSD across amd64, arm64, 386)
- Created GitHub Actions workflows for automated PR checks (formatting, vetting, testing, coverage) and releases
- Updated release documentation to reflect the new GoReleaser-based workflow
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| .goreleaser.yml | New GoReleaser v2 configuration defining build targets, archives, and release settings with CGO disabled for cross-compilation |
| .github/workflows/release.yml | New workflow that triggers on version tags to build and publish releases using GoReleaser |
| .github/workflows/pr-checks.yml | New workflow for PR validation including go vet, formatting checks, tests with race detection, and coverage reporting |
| .gitignore | Added dist/ and build/ directories to ignore build artifacts |
| docs/DEVELOPMENT.md | Updated release process documentation to describe the new GoReleaser-based workflow with local verification steps |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| run: go tool cover -func=coverage.out | ||
|
|
There was a problem hiding this comment.
Consider adding a check to ensure the test coverage meets a minimum threshold (e.g., failing if coverage drops below a certain percentage). This can be done by parsing the output of 'go tool cover -func=coverage.out' or using 'go test -covermode=count -coverpkg=./... -coverprofile=coverage.out ./...' with a threshold check. This helps prevent regression in test coverage over time.
| run: go tool cover -func=coverage.out | |
| run: | | |
| THRESHOLD=80 | |
| echo "Coverage report:" | |
| go tool cover -func=coverage.out | |
| total_coverage=$(go tool cover -func=coverage.out | awk '/^total:/ {gsub("%","",$3); print $3}') | |
| if [ -z "$total_coverage" ]; then | |
| echo "Failed to determine total test coverage from coverage.out" | |
| exit 1 | |
| fi | |
| coverage_int=${total_coverage%.*} | |
| if [ "$coverage_int" -lt "$THRESHOLD" ]; then | |
| echo "Test coverage ${total_coverage}% is below the required threshold of ${THRESHOLD}%" | |
| exit 1 | |
| fi | |
| echo "Test coverage ${total_coverage}% meets the required threshold of ${THRESHOLD}%" |
| goarch: | ||
| - amd64 | ||
| - arm64 | ||
| - 386 |
There was a problem hiding this comment.
The ignore rule excludes freebsd/386, but FreeBSD does support the 386 architecture. Unless there's a specific reason to exclude this combination (e.g., known build issues or lack of demand), consider whether this exclusion is necessary. If intentional, consider adding a comment explaining why this combination is excluded.
| - 386 | |
| - 386 | |
| # Intentionally exclude freebsd/386: not supported/tested for this project. |
| 2. Verify packaging locally without publishing: `goreleaser release --snapshot --clean` | ||
| 3. Run full CI checks: `make ci` | ||
| 4. Tag the version you just tested: `git tag vX.Y.Z` | ||
| 5. Push the tag to trigger the GitHub Action release (builds Windows/Linux/macOS/FreeBSD; 386, amd64, arm64 where supported): `git push origin vX.Y.Z` |
There was a problem hiding this comment.
Consider using "GitHub Actions" (plural) instead of "GitHub Action" (singular) as "GitHub Actions" is the standard way to refer to the CI/CD platform by GitHub, even when referring to a single workflow.
| 5. Push the tag to trigger the GitHub Action release (builds Windows/Linux/macOS/FreeBSD; 386, amd64, arm64 where supported): `git push origin vX.Y.Z` | |
| 5. Push the tag to trigger the GitHub Actions release workflow (builds Windows/Linux/macOS/FreeBSD; 386, amd64, arm64 where supported): `git push origin vX.Y.Z` |
| 2. Verify packaging locally without publishing: `goreleaser release --snapshot --clean` | ||
| 3. Run full CI checks: `make ci` | ||
| 4. Tag the version you just tested: `git tag vX.Y.Z` | ||
| 5. Push the tag to trigger the GitHub Action release (builds Windows/Linux/macOS/FreeBSD; 386, amd64, arm64 where supported): `git push origin vX.Y.Z` |
There was a problem hiding this comment.
The documentation states that the release "builds Windows/Linux/macOS/FreeBSD" but the .goreleaser.yml configuration only includes linux, windows, and freebsd under the goos field. macOS builds require "darwin" to be added to the goos list. Either add darwin to the goreleaser configuration or update the documentation to remove the mention of macOS.
| 5. Push the tag to trigger the GitHub Action release (builds Windows/Linux/macOS/FreeBSD; 386, amd64, arm64 where supported): `git push origin vX.Y.Z` | |
| 5. Push the tag to trigger the GitHub Action release (builds Windows/Linux/FreeBSD; 386, amd64, arm64 where supported): `git push origin vX.Y.Z` |
| binary: seriallink | ||
| flags: | ||
| - -trimpath | ||
| ldflags: -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.buildDate={{.Date}} |
There was a problem hiding this comment.
For better YAML readability and to prevent potential parsing issues, consider enclosing the ldflags value in quotes: ldflags: "-s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.buildDate={{.Date}}"
| ldflags: -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.buildDate={{.Date}} | |
| ldflags: "-s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.buildDate={{.Date}}" |
| - name: Run GoReleaser | ||
| uses: goreleaser/goreleaser-action@v6 | ||
| with: | ||
| version: latest |
There was a problem hiding this comment.
Using "latest" for the goreleaser version can lead to unexpected breaking changes in CI/CD pipelines. Consider pinning to a specific version (e.g., "v6" or "~> v6") to ensure reproducible builds and prevent potential issues from automatic updates.
| version: latest | |
| version: v6 |