This directory contains the GitHub Actions workflows for Node Doctor continuous integration and deployment.
Comprehensive CI pipeline that runs on:
- Pull requests to
mainbranch - Pushes to
mainbranch - Git tags matching
v*pattern
-
Lint - Code quality checks
- Runs
golangci-lintwith comprehensive configuration - Uses
.golangci.ymlconfiguration - Timeout: 5 minutes
- Runs
-
Test - Unit and integration tests
- Matrix strategy: Go 1.21 and 1.22
- Runs unit tests with race detection and coverage
- Runs integration tests (if
test/integration/exists) - Uploads coverage to Codecov (Go 1.22 only)
-
Security Scan (gosec) - Security vulnerability detection
- Scans Go code for common security issues
- Uploads results to GitHub Security tab (SARIF format)
-
Build - Binary compilation
- Builds the
node-doctorbinary - Injects version metadata (VERSION, GIT_COMMIT, BUILD_TIME)
- Tests binary execution
- Uploads binary as artifact (7-day retention)
- Builds the
-
Docker - Multi-platform container build (only on tags)
- Builds for
linux/amd64andlinux/arm64 - Pushes to Harbor registry
- Tags with version and
latest - Triggers the informational Grype vulnerability scan on the pushed image (SARIF-only, does not gate the pipeline)
- Builds for
-
CI Success - Overall status check
- Aggregates results from all jobs
- Fails if any required job fails
- Dependency Caching: Go modules and build cache are cached automatically
- Code Coverage: Generated and uploaded to Codecov
- Security Scanning: gosec (code) and Grype (container images, informational)
- Multi-platform Builds: Docker images for amd64 and arm64
- Build Metadata: Version, commit SHA, and build time injected into binaries
Configure these secrets in your GitHub repository settings:
HARBOR_USERNAME- Harbor registry usernameHARBOR_PASSWORD- Harbor registry password or access token
CODECOV_TOKEN- Codecov.io upload token (optional, public repos may not need it)
- Go to repository Settings → Secrets and variables → Actions
- Click New repository secret
- Add each secret with the exact name shown above
Coverage reports are uploaded to Codecov for tracking over time.
- Visit codecov.io and sign in with GitHub
- Add your repository
- Copy the upload token
- Add as
CODECOV_TOKENsecret (optional for public repos)
Create a PR to main branch - triggers lint, test, security scan, and build jobs.
Push or merge to main branch - runs full CI pipeline.
Create and push a git tag:
git tag v1.0.0
git push origin v1.0.0This triggers:
- Full CI pipeline
- Docker multi-platform build
- Push to Docker Hub registry
- Informational Grype security scan (non-blocking)
Before pushing, test locally:
# Run lint
make lint
# Run tests
make test
# Run all tests with coverage
make test-all
# Build binary
make build
# Build Docker image
docker build -t node-doctor:local .Linter configuration is in .golangci.yml at repository root. It includes:
- Enabled linters: errcheck, gosimple, govet, ineffassign, staticcheck, unused, gofmt, goimports, misspell, revive, gosec, and more
- Cyclomatic complexity: Maximum 15
- Code duplication: Threshold 100 lines
- Test exclusions: Some strict linters disabled for test files
Run make lint locally to see issues. Fix with make fmt.
Run make test or make test-all locally. Check for race conditions with -race flag.
Ensure Dockerfile is valid. Test locally: docker build -t test .
Verify secrets are set correctly in repository settings. Check secret names match exactly.
Codecov uploads are non-blocking (fail_ci_if_error: false). Check Codecov token if needed.
Add to README.md:
[](https://github.com/supporttools/node-doctor/actions)