Appearance
GitHub Actions CI/CD
This project uses GitHub Actions for continuous integration and deployment. The workflows automatically build and test the application on both Ubuntu and macOS.
Workflows
1. Build and Test (build.yml)
- Triggers: Push to
main,master, ordevelopbranches, version tags, and pull requests - Platforms: Ubuntu Latest, macOS Latest
- Go Version: 1.21
- Features:
- Dependency caching for faster builds
- Code formatting validation
- Test execution
- Cross-platform builds
- Build artifact uploads
2. Continuous Integration (ci.yml)
- Triggers: Push to
main,master, ordevelopbranches, pull requests, and manual dispatch - Features:
- Linting with golangci-lint
- Test coverage reporting
- Multi-platform builds (Ubuntu, macOS)
- Build artifact uploads
3. Release (release.yml)
- Triggers: Push to version tags (
v*) and manual dispatch - Features:
- Creates GitHub releases automatically
- Builds binaries for multiple platforms and architectures
- Generates checksums for all binaries
- Supports Linux (amd64, arm64), macOS (amd64, arm64), Windows (amd64), FreeBSD (amd64)
Release Process
Automatic Releases
When you create a Git tag starting with v (e.g., v1.0.0), the release workflow will:
- Create a GitHub release
- Build binaries for multiple platforms and architectures:
- Linux (amd64, arm64)
- macOS (amd64, arm64)
- Windows (amd64)
- FreeBSD (amd64)
- Generate SHA256 checksums for all binaries
- Upload all binaries and checksums to the release
Creating a Release
bash
# Tag your release
git tag v1.0.0
git push origin v1.0.0
# The GitHub Action will automatically create the releaseBuild Artifacts
Each successful build uploads artifacts that you can download:
gocommit-ubuntu-latest: Linux binarygocommit-macos-latest: macOS binary
Artifacts are retained for 7-30 days depending on the workflow.
Code Quality
The CI pipeline includes:
- Linting: golangci-lint with comprehensive rule set
- Testing: Unit tests with race detection
- Coverage: Code coverage reporting to Codecov
- Formatting: Automatic Go code formatting validation
Configuration Files
.golangci.yml: Linter configuration.github/workflows/build.yml: Main build and test workflow.github/workflows/ci.yml: Continuous integration workflow.github/workflows/release.yml: Release workflow for creating binaries
Status Badges
Add these badges to your main README.md:
markdown
[](https://github.com/thanhphuchuynh/gocommit/actions)
[](https://github.com/thanhphuchuynh/gocommit/actions)
[](https://github.com/thanhphuchuynh/gocommit/actions)
[](https://goreportcard.com/report/github.com/thanhphuchuynh/gocommit)Local Development
To run the same checks locally:
bash
# Run tests
make test
# Run linter (requires golangci-lint installation)
make lint
# Format code
make fmt
# Build application
make buildTroubleshooting
Common Issues
- Linting failures: Run
make lintlocally to see issues - Test failures: Run
make testto debug test issues - Build failures: Check Go version compatibility
Requirements
- Go 1.21 or later
- golangci-lint (for local linting)
- All dependencies in go.mod must be available