Conversation
Makefile automates common tasks such as: - testing the codebase - generating code coverage reports - enforcing minimum coverage thresholds - cleaning up generated files - tagging releases
Including an overview, testing instructions, contributor guidelines and release automation workflow.
Those scripts will be used to automated the release process
There was a problem hiding this comment.
Pull request overview
Initial scaffolding for a Go-based project, including module definition, CI workflows, and release/coverage automation scripts.
Changes:
- Added Go module configuration (
go.mod) and project README. - Introduced CI + release GitHub Actions workflows running tests and coverage checks.
- Added local automation for coverage enforcement and release branching/tagging.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
go.mod |
Defines the module path and Go language version. |
README.md |
Documents project overview, testing, contributor guidance, and release workflow. |
Makefile |
Adds test, coverage, coverage gate, clean, and tag-release targets. |
scripts/release.sh |
Automates release branch creation, changelog generation, and PR creation. |
scripts/next_version.sh |
Computes the next version from git tags. |
.github/workflows/ci.yml |
Runs tests + coverage gate on pushes/PRs. |
.github/workflows/release.yml |
Runs tests + coverage gate on version tag pushes. |
pkg/.gitkeep |
Keeps pkg/ tracked in git. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
release automation should support pre-release like alphama, beta, rc, etc. This change adds an optional suffix parameter to the `next_version.sh` script and the `release.sh` script, allowing users to specify a suffix for the version being released. If no suffix is provided, it defaults to a standard patch version bump.
…ocks-org/forging_foundation into chore/starting-golang-project
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ocks-org/forging_foundation into chore/starting-golang-project
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 10 changed files in this pull request and generated 7 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Ensure git-chglog configuration exists | ||
| if [ ! -f .chglog/config.yml ]; then | ||
| echo "Error: git-chglog config file '.chglog/config.yml' not found." | ||
| echo "Please add it to the repository or update scripts/release.sh to point to the correct config path." | ||
| exit 1 | ||
| fi |
There was a problem hiding this comment.
The script requires .chglog/config.yml, but that directory/file isn't present in the repository currently, so running release.sh will always exit with the error path. Add the .chglog config (and any templates) to the repo, or update the script/README to use the actual config location.
|
|
||
| $DRY_RUN || git push origin "$BRANCH" | ||
|
|
||
| CHANGELOG_BODY=$($DRY_RUN && echo "[DRY RUN]" || awk '/^## /{flag=1;next}/^$/{flag=0}flag' CHANGELOG.md | awk 'NR>1') |
There was a problem hiding this comment.
head -n -1 is GNU-specific; on macOS/BSD head this errors, which will break release PR creation on developer machines. Consider replacing this with a portable approach (e.g., using sed to drop the last line) or avoid needing to trim with head -n -1.
|
|
||
| stdout := os.Stdout | ||
| os.Stdout = w | ||
|
|
||
| PrintFoo() | ||
|
|
||
| w.Close() | ||
|
|
||
| os.Stdout = stdout | ||
|
|
There was a problem hiding this comment.
This test mutates the global os.Stdout without a defer/t.Cleanup restore, so any early failure (or panic) can leak the redirected stdout into subsequent tests. Also, the pipe fds aren’t consistently closed via defer (e.g., r is never closed). Use t.Cleanup/defer to restore os.Stdout and close both ends of the pipe reliably.
| stdout := os.Stdout | |
| os.Stdout = w | |
| PrintFoo() | |
| w.Close() | |
| os.Stdout = stdout | |
| defer func() { | |
| _ = r.Close() | |
| }() | |
| stdout := os.Stdout | |
| os.Stdout = w | |
| t.Cleanup(func() { | |
| os.Stdout = stdout | |
| }) | |
| defer func() { | |
| _ = w.Close() | |
| }() | |
| PrintFoo() | |
| w.Close() |
| push: | ||
| tags: | ||
| - 'v*.*.*' | ||
|
|
There was a problem hiding this comment.
The documented release flow supports optional suffixes like alpha.1/rc.2, but the release workflow only triggers on tags matching v*.*.* (no prerelease suffix). Either expand the tag trigger to include prerelease patterns or clarify in docs/scripts that prerelease tags won’t run the release workflow.
| clean: | ||
| rm -f $(COVERAGE_FILE) | ||
|
|
||
| release: |
There was a problem hiding this comment.
make release will run even if VERSION is unset, which would try to create/push a v tag. Add a guard that fails with a clear message when VERSION is missing (e.g., require VERSION to be non-empty before tagging).
| release: | |
| release: | |
| @if [ -z "$(VERSION)" ]; then \ | |
| echo "ERROR: VERSION is not set. Usage: make release VERSION=x.y.z"; \ | |
| exit 1; \ | |
| fi |
| ## 🚀 Release Automation | ||
|
|
||
| ### Prerequisites | ||
| - [git-chglog](https://github.com/git-chglog/git-chglog) must be installed for changelog generation. | ||
|
|
||
| ### Release Workflow | ||
|
|
||
| 1. **Automate the release process:** | ||
| ```bash | ||
| ./scripts/release.sh # Real release flow | ||
| ./scripts/release.sh --dry-run # Preview actions only (no changes made) | ||
| ``` | ||
| This script will: | ||
| - Ensure you are on the main branch and up to date | ||
| - Determine the next version automatically | ||
| - Generate and commit the changelog for the new version | ||
| - Create a branch named `release/v<version>` from main | ||
| - Push the release branch to the remote | ||
| - Open a PR to main with the changelog as the PR body (requires GitHub CLI) | ||
|
|
There was a problem hiding this comment.
Release docs mention installing git-chglog but don’t mention that the repo needs a .chglog/config.yml (and possibly templates) for ./scripts/release.sh to work. Either add that config to the repo or update this section to document where the config lives/how to generate it.
No description provided.