This document explains the CI/CD architecture, workflows, and automation used in the Pulumi Any Terraform project.
Overview#
The project uses GitHub Actions for continuous integration and deployment, with three main workflows:
- Test Workflow - Automated quality checks
- Update Workflow - Dependency management
- Publish Workflow - Package publishing
Workflow Architecture#
Test Workflow#
Trigger: Every push and pull request
File: .github/workflows/test.yml
Jobs#
1. Fix Job#
Automatically fixes formatting and linting issues:
What it does:
- Installs dependencies with pnpm
- Runs formatters (Oxfmt) on affected packages
- Runs linters (Biome) on affected packages
- Auto-commits fixes via Autofix.ci
2. Lint & Build Job#
Validates code quality and builds packages:
What it does:
- Type checks TypeScript code
- Lints with Biome
- Lints GitHub Actions workflows with actionlint and zizmor
- Builds all affected packages
- Validates package.json files
- Checks dependency versions with Syncpack
Performance Optimizations#
- Nx Affected: Only processes changed packages
- GitHub Actions Cache: pnpm store cached across runs on the lockfile hash
- Concurrent Execution: Multiple jobs run in parallel
Update Workflow#
Trigger: Daily at 00:00 UTC or manual dispatch
File: .github/workflows/update.yml
Purpose#
Keeps dependencies up to date automatically:
What it does:
- Checks for dependency updates
- Updates package.json files
- Runs tests and fixes
- Creates automated PR with changes
Update Strategy#
- Patch versions: Auto-merge after tests pass
- Minor versions: Create PR for review
- Major versions: Create PR with breaking change notice
Publish Workflow#
Trigger: Push to main branch (after tests pass)
File: .github/workflows/publish.yml
Jobs#
NPM Package Publishing#
Publishes packages to NPM registry:
What it does:
- Checks for changesets
- Versions packages based on changesets
- Builds all packages
- Publishes to NPM registry
- Creates Git tags
- Generates release notes
- Creates GitHub release
Version Management#
Uses Changesets:
Security Measures#
1. Aikido Safe Chain#
Protects against supply chain attacks:
Features:
- Blocks malicious packages
- Detects supply chain attacks
- Monitors network activity
- Validates package integrity
2. Dependency Scanning#
- Dependabot: Automated security updates
- npm audit: Vulnerability scanning
- Syncpack: Version consistency checks
3. Secret Management#
Secrets used:
GITHUB_TOKEN: Repository accessNPM_TOKEN: Package publishing
Caching Strategy#
Nx Local Cache#
Nx caches task outputs locally and skips tasks whose inputs are unchanged. There is no remote or shared cache -- build correctness comes from Nx's input-hashing, and the machine-bound .nx/cache database is not restored across CI runs.
Benefits:
- Faster local rebuilds
- Skips unchanged tasks
GitHub Actions Cache#
Caches the pnpm store across runs:
Automated Code Fixes#
Autofix.ci Integration#
Automatically fixes and commits:
Fixes:
- Code formatting (Oxfmt)
- Linting issues (Biome)
- Package.json formatting
- Import sorting
Manual Overrides#
To skip autofix on a commit:
Monitoring & Notifications#
GitHub Status Checks#
- ✅ Tests pass
- ✅ Build succeeds
- ✅ No linting errors
- ✅ Dependencies secure
Notifications#
- PR comments: Test results
- Slack: (if configured) Build notifications
- Email: Workflow failures
Local Development Workflow#
Simulate CI locally:
CI Configuration Files#
mise.toml#
Defines tool versions:
nx.json#
Build orchestration:
.syncpackrc.json#
Dependency management:
Troubleshooting CI Issues#
Build Failures#
- Check workflow logs in GitHub Actions
- Reproduce locally:
pnpm nx affected -t build - Clear caches:
pnpm nx reset - Verify Node.js and pnpm versions
Test Failures#
- Run tests locally:
pnpm nx affected -t check - Check for flaky tests
- Verify dependencies are installed
- Review error messages in logs
Publishing Failures#
- Check NPM token validity
- Verify package versions
- Ensure changesets exist
- Review publish logs
Cache Issues#
- Clear Nx cache:
pnpm nx reset - Clear GitHub Actions cache (in repository settings)
Best Practices#
1. Use Changesets#
Always create changesets for changes:
2. Fix Before Commit#
Run formatters and linters:
3. Test Locally#
Before pushing:
4. Keep Workflows Updated#
Regularly update GitHub Actions:
5. Monitor Build Times#
Review per-job timings in the GitHub Actions run summary.
Metrics & Analytics#
Build Performance#
- Average build time
- Cache hit rate
- Test execution time
- Package size
Deployment Frequency#
- Commits per day
- PRs merged per week
- Releases per month
- Update frequency
Future Enhancements#
Planned improvements:
- E2E Testing: Add end-to-end tests
- Visual Regression: Screenshot comparisons
- Performance Testing: Benchmark tests
- Documentation Testing: Link validation
- Security Scanning: Advanced vulnerability detection