🚀 CI/CD Best Practices: When to Fix Those Pesky Failures
⚡ Quick Answer: Fix CI failures regularly—ideally before pushing to main/develop branches, or at least daily during active development.
📅 When to Fix CI Failures
- ✅ Before pushing to main/develop — Keep these branches green and deployable
- ✅ Before creating PRs — Fix locally first to avoid embarrassing red X's
- ✅ Daily or per feature — Don't let failures accumulate
🔧 Recommended Workflow
1️⃣ Fix Locally Before Pushing
# Check formatting
pnpm format:check
pnpm format # Auto-fix if needed
# Check linting
pnpm run lint
# Run tests
pnpm --filter web test:run
pnpm test:ui # Run UI tests
pnpm test:coverage # Check test coverage
# Build project
pnpm build
2️⃣ Use Pre-Commit Hooks (Optional)
Run checks automatically before commits to prevent pushing broken code.
3️⃣ Fix Immediately When CI Fails
- Prevents accumulation of issues
- Keeps main branch deployable
- Easier to trace what broke
🎯 Priority Order for Fixes
1️⃣
Formatting
Usually quick to fix
2️⃣
Linting
Catches code quality issues
3️⃣
Tests
Critical for functionality - Run test:ui and test:coverage
4️⃣
Build
Must pass for deployment
⚡ Quick Fix Workflow
# 1. Check what's wrong
git pull # Get latest
pnpm format:check # See formatting issues
pnpm format # Auto-fix formatting
pnpm run lint # Check linting
pnpm --filter web test:run # Run tests
pnpm test:ui # Run UI tests
pnpm test:coverage # Check test coverage
pnpm build # Verify build works
# 2. Fix issues locally
# 3. Commit and push
💡 Pro Tip: Frequency
- Daily if actively developing
- Before each PR to keep reviews smooth
- Immediately when CI fails—don't let it pile up!
Remember: A green CI pipeline is a happy pipeline! 🎉
Comments
Post a Comment