5.0 KiB
5.0 KiB
CI/CD Migration Guide
Last Updated: 2025-01-27 Purpose: Guide for migrating projects to unified CI/CD pipeline templates
Overview
This guide provides step-by-step instructions for migrating existing projects to use the unified CI/CD pipeline templates.
Unified CI/CD Pipeline
Pipeline Stages
- Lint & Format - Code quality checks
- Type Check - TypeScript/Solidity type checking
- Test - Unit and integration tests
- Build - Compile and build artifacts
- Security Scan - Dependency and code scanning
- Deploy - Deployment to environments
Template Location
- Template:
.github/workflows/ci.yml - Location: Workspace root
Migration Steps
Step 1: Review Current CI/CD
For each project:
- Check for existing
.github/workflows/directory - Review current CI/CD configuration
- Identify project-specific requirements
- Document custom steps
Step 2: Create Project-Specific Workflow
- Copy base template:
.github/workflows/ci.yml - Create project-specific workflow:
.github/workflows/ci-<project>.yml - Customize for project needs
- Test locally first
Step 3: Integrate with Project
- Add workflow file to project
- Update project scripts if needed
- Test workflow execution
- Monitor build results
Step 4: Update Documentation
- Document project-specific CI/CD configuration
- Update README with CI/CD information
- Document deployment process
Project-Specific Examples
TypeScript/Node.js Project
name: CI - Project Name
on:
push:
branches: [main, develop]
paths:
- 'project-name/**'
pull_request:
branches: [main, develop]
paths:
- 'project-name/**'
jobs:
lint:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./project-name
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- run: pnpm install
- run: pnpm lint
test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./project-name
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- run: pnpm install
- run: pnpm test
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./project-name
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- run: pnpm install
- run: pnpm build
Solidity/Foundry Project
name: CI - Solidity Project
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: foundry-actions/foundry-toolchain@v1
- run: forge test
- run: forge fmt --check
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: foundry-actions/foundry-toolchain@v1
- run: forge build
Migration Checklist
Pre-Migration
- Review current CI/CD setup
- Identify project-specific requirements
- Document current build/test process
- Review project dependencies
Migration
- Create workflow file
- Configure project-specific settings
- Test workflow locally (act tool)
- Create PR with workflow changes
- Verify workflow runs successfully
Post-Migration
- Monitor workflow execution
- Fix any issues
- Update documentation
- Remove old CI/CD configuration (if applicable)
Common Customizations
Environment Variables
env:
NODE_ENV: production
DATABASE_URL: ${{ secrets.DATABASE_URL }}
API_KEY: ${{ secrets.API_KEY }}
Matrix Builds
strategy:
matrix:
node-version: [18, 20, 22]
Deployment Steps
deploy:
needs: [build, test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Deploy to Azure
run: |
# Deployment commands
Projects to Migrate
High Priority
- dbis_core - Core banking system
- the_order - Identity platform
- smom-dbis-138 - Blockchain network
Medium Priority
- Sankofa - Cloud platform
- miracles_in_motion - Web application
- Defi-Mix-Tooling projects - DeFi tools
Lower Priority
- Documentation projects - Static sites
- Utility projects - Scripts and tools
Troubleshooting
Common Issues
Issue: Workflow fails on dependency installation
- Solution: Check package.json, ensure all dependencies are listed
Issue: Tests fail in CI but pass locally
- Solution: Check environment variables, test database setup
Issue: Build fails due to missing environment variables
- Solution: Add secrets to GitHub repository settings
Resources
Last Updated: 2025-01-27