$npx -y skills add vibeeval/vibecosystem --skill ci-pipeline-patternsGitHub Actions workflow templates, matrix builds, caching, and monorepo CI strategies
| 1 | # CI Pipeline Patterns |
| 2 | |
| 3 | ## GitHub Actions Workflow Template |
| 4 | |
| 5 | ```yaml |
| 6 | name: CI |
| 7 | on: |
| 8 | push: |
| 9 | branches: [main] |
| 10 | pull_request: |
| 11 | branches: [main] |
| 12 | |
| 13 | concurrency: |
| 14 | group: ${{ github.workflow }}-${{ github.ref }} |
| 15 | cancel-in-progress: true |
| 16 | |
| 17 | jobs: |
| 18 | lint-and-type: |
| 19 | runs-on: ubuntu-latest |
| 20 | steps: |
| 21 | - uses: actions/checkout@v4 |
| 22 | - uses: actions/setup-node@v4 |
| 23 | with: { node-version: 20, cache: npm } |
| 24 | - run: npm ci |
| 25 | - run: npm run lint |
| 26 | - run: npm run type-check |
| 27 | |
| 28 | test: |
| 29 | runs-on: ubuntu-latest |
| 30 | strategy: |
| 31 | matrix: |
| 32 | shard: [1, 2, 3, 4] |
| 33 | steps: |
| 34 | - uses: actions/checkout@v4 |
| 35 | - uses: actions/setup-node@v4 |
| 36 | with: { node-version: 20, cache: npm } |
| 37 | - run: npm ci |
| 38 | - run: npm test -- --shard=${{ matrix.shard }}/4 |
| 39 | |
| 40 | build: |
| 41 | needs: [lint-and-type, test] |
| 42 | runs-on: ubuntu-latest |
| 43 | steps: |
| 44 | - uses: actions/checkout@v4 |
| 45 | - uses: actions/setup-node@v4 |
| 46 | with: { node-version: 20, cache: npm } |
| 47 | - run: npm ci |
| 48 | - run: npm run build |
| 49 | - uses: actions/upload-artifact@v4 |
| 50 | with: { name: build, path: dist/ } |
| 51 | ``` |
| 52 | |
| 53 | ## Caching Strategies |
| 54 | |
| 55 | ```yaml |
| 56 | # npm cache |
| 57 | - uses: actions/cache@v4 |
| 58 | with: |
| 59 | path: ~/.npm |
| 60 | key: npm-${{ hashFiles('**/package-lock.json') }} |
| 61 | |
| 62 | # Docker layer cache |
| 63 | - uses: docker/build-push-action@v5 |
| 64 | with: |
| 65 | cache-from: type=gha |
| 66 | cache-to: type=gha,mode=max |
| 67 | |
| 68 | # Turborepo remote cache |
| 69 | - run: npx turbo build --cache-dir=.turbo |
| 70 | ``` |
| 71 | |
| 72 | ## Monorepo CI (Affected Only) |
| 73 | |
| 74 | ```yaml |
| 75 | # Nx affected |
| 76 | - run: npx nx affected --target=test --base=origin/main |
| 77 | |
| 78 | # Turborepo |
| 79 | - run: npx turbo run test --filter=...[origin/main] |
| 80 | |
| 81 | # Manual path filter |
| 82 | - uses: dorny/paths-filter@v3 |
| 83 | id: changes |
| 84 | with: |
| 85 | filters: | |
| 86 | api: ['packages/api/**'] |
| 87 | web: ['packages/web/**'] |
| 88 | ``` |
| 89 | |
| 90 | ## Pipeline Security |
| 91 | |
| 92 | ```yaml |
| 93 | # Secret scanning |
| 94 | - uses: trufflesecurity/trufflehog@main |
| 95 | with: { extra_args: --only-verified } |
| 96 | |
| 97 | # Dependency audit |
| 98 | - run: npm audit --audit-level=high |
| 99 | |
| 100 | # SAST |
| 101 | - uses: github/codeql-action/analyze@v3 |
| 102 | ``` |
| 103 | |
| 104 | ## Checklist |
| 105 | |
| 106 | - [ ] Concurrency: cancel-in-progress aktif |
| 107 | - [ ] Cache: npm/pip/go module cache |
| 108 | - [ ] Paralel: test shard veya matrix |
| 109 | - [ ] Security: secret scan + dependency audit |
| 110 | - [ ] Artifact: build output upload |
| 111 | - [ ] Branch protection: require status checks |
| 112 | - [ ] Monorepo: affected-only strategy |
| 113 | - [ ] Timeout: job timeout belirlenmiş |
| 114 | |
| 115 | ## Anti-Patterns |
| 116 | |
| 117 | - Cache key'de sabit string (hash kullan) |
| 118 | - Her push'ta tüm testler (affected-only) |
| 119 | - Secret'ı log'a yazdırma (mask) |
| 120 | - Single job tüm adımlar (paralelize et) |
| 121 | - Manual deploy (CD otomatik olmalı) |