4.9 KiB
CI/CD Documentation
Overview
The ONVIF Go library uses GitHub Actions for continuous integration and deployment. All workflows are located in .github/workflows/.
Workflow Summary
| Workflow | Purpose | Triggers | Status |
|---|---|---|---|
| CI | Main CI pipeline | Push/PR to main branches | ✅ Active |
| Test | Extended testing | Manual/Weekly/Code changes | ✅ Active |
| Coverage | Coverage analysis | After CI success | ✅ Active |
| Release | Create releases | Tags/Manual | ✅ Active |
| Lint | Code linting | Push/PR | ✅ Active |
| Security | Security scanning | Push/PR/Weekly | ✅ Active |
| Docs | Documentation checks | Docs changes | ✅ Active |
| Dependency Review | Dependency security | PRs | ✅ Active |
Main CI Workflow
The CI workflow (ci.yml) is the primary workflow that runs on every push and pull request.
Jobs
-
validate - Quick validation (5-10 minutes)
- Code formatting check
go vet- Linting with golangci-lint
-
test - Primary testing (10-15 minutes)
- Runs on Go 1.23
- Race detector enabled
- Coverage report generation
- Uploads to Codecov
-
test-matrix - Multi-platform testing (20-30 minutes)
- Tests on Go 1.21, 1.22, 1.23
- Tests on Linux, macOS, Windows
- Parallel execution
-
build - Build verification (5-10 minutes)
- Builds all packages
- Builds all examples
- Builds all CLI tools
-
sonarcloud - Code quality (10-15 minutes)
- Only on master/main
- Requires SONAR_TOKEN secret
Performance
- Total CI time: ~40-60 minutes (parallel jobs)
- Fast feedback: Validation job fails fast on formatting/lint issues
- Caching: Go modules and build cache for faster runs
Release Workflow
The Release workflow (release.yml) creates GitHub releases with binaries for all platforms.
Supported Platforms
- Linux: amd64, arm64, arm (v7)
- Windows: amd64, arm64
- macOS: amd64, arm64
Release Process
- Tag creation: Push a tag like
v1.2.3 - Build: Automatically builds for all platforms
- Archive: Creates
.tar.gz(Linux/macOS) and.zip(Windows) - Checksums: Generates SHA256 checksums
- Release: Creates GitHub release with all artifacts
- Docker: Builds and pushes multi-arch Docker image to GHCR
Manual Release
You can also trigger a release manually:
- Go to Actions → Release workflow
- Click "Run workflow"
- Enter version (e.g.,
v1.2.3)
Security Workflow
The Security workflow (security.yml) scans for vulnerabilities.
Tools
- gosec: Security scanner for Go code
- govulncheck: Vulnerability checker for dependencies
Schedule
Runs weekly on Sundays to catch new vulnerabilities.
Coverage
Coverage is tracked and reported to Codecov. The coverage workflow provides detailed analysis:
- Total coverage percentage
- Coverage by package
- Coverage trends over time
Coverage Threshold
Minimum coverage threshold: 50%
Required Secrets
Optional Secrets
CODECOV_TOKEN- For Codecov integrationSONAR_TOKEN- For SonarCloud integrationDOCKERHUB_USERNAME/DOCKERHUB_TOKEN- For Docker Hub
Workflow Status Badges
Add these badges to your README:



Best Practices
- Always run CI locally first:
make check test - Keep workflows fast: Use caching and parallel jobs
- Fail fast: Validation job catches issues early
- Test before release: All tests must pass before tagging
- Review security scans: Check security workflow results
Troubleshooting
CI Fails on Formatting
# Fix formatting
make fmt
# Or manually
gofmt -w .
CI Fails on Linting
# Run linter locally
make lint
# Or manually
golangci-lint run ./...
Tests Fail Locally but Pass in CI
- Check Go version: CI uses Go 1.23
- Check race detector: CI runs with
-race - Check environment differences
Release Fails
- Ensure tag format:
v1.2.3(not1.2.3) - Check permissions: Need
contents: write - Verify all tests pass before tagging
Workflow Files
All workflow files are in .github/workflows/:
ci.yml- Main CI pipelinetest.yml- Extended testscoverage.yml- Coverage analysisrelease.yml- Release automationlint.yml- Lintingsecurity.yml- Security scanningdocs.yml- Documentation checksdependency-review.yml- Dependency review
See Also
- GitHub Actions Documentation
- Workflow README
- Makefile - Local development commands
Last Updated: December 2, 2025