|
1 | 1 | # CI/CD Pipeline — bankstatementprocessor monorepo |
2 | 2 | # |
3 | 3 | # Jobs (all lint jobs run in parallel): |
| 4 | +# changes — detect which paths changed (skips heavy jobs on workflow-only PRs) |
4 | 5 | # lint-core — black, isort, flake8, mypy on packages/parser-core |
5 | 6 | # lint-free — black, isort, flake8 on packages/parser-free |
6 | 7 | # security — bandit + safety on both packages |
@@ -46,13 +47,39 @@ permissions: |
46 | 47 | actions: read |
47 | 48 |
|
48 | 49 | # --------------------------------------------------------------------------- |
49 | | -# Lint jobs (all parallel) |
| 50 | +# Jobs |
50 | 51 | # --------------------------------------------------------------------------- |
51 | 52 | jobs: |
| 53 | + # Detect which paths changed so downstream jobs can skip when irrelevant |
| 54 | + changes: |
| 55 | + name: Detect changed paths |
| 56 | + runs-on: ubuntu-latest |
| 57 | + permissions: |
| 58 | + pull-requests: read |
| 59 | + contents: read |
| 60 | + outputs: |
| 61 | + core: ${{ steps.filter.outputs.core }} |
| 62 | + free: ${{ steps.filter.outputs.free }} |
| 63 | + any-src: ${{ steps.filter.outputs.any-src }} |
| 64 | + steps: |
| 65 | + - uses: actions/checkout@v6 |
| 66 | + - uses: dorny/paths-filter@v3 |
| 67 | + id: filter |
| 68 | + with: |
| 69 | + filters: | |
| 70 | + core: |
| 71 | + - 'packages/parser-core/**' |
| 72 | + free: |
| 73 | + - 'packages/parser-free/**' |
| 74 | + any-src: |
| 75 | + - 'packages/**' |
| 76 | +
|
52 | 77 | lint-core: |
53 | 78 | name: Lint — parser-core |
54 | 79 | runs-on: ubuntu-latest |
55 | 80 | timeout-minutes: 10 |
| 81 | + needs: changes |
| 82 | + if: needs.changes.outputs.core == 'true' |
56 | 83 | defaults: |
57 | 84 | run: |
58 | 85 | working-directory: packages/parser-core |
@@ -102,6 +129,8 @@ jobs: |
102 | 129 | name: Lint — parser-free |
103 | 130 | runs-on: ubuntu-latest |
104 | 131 | timeout-minutes: 10 |
| 132 | + needs: changes |
| 133 | + if: needs.changes.outputs.free == 'true' |
105 | 134 | defaults: |
106 | 135 | run: |
107 | 136 | working-directory: packages/parser-free |
@@ -140,6 +169,8 @@ jobs: |
140 | 169 | name: Security — bandit + safety |
141 | 170 | runs-on: ubuntu-latest |
142 | 171 | timeout-minutes: 10 |
| 172 | + needs: changes |
| 173 | + if: needs.changes.outputs.any-src == 'true' |
143 | 174 |
|
144 | 175 | steps: |
145 | 176 | - uses: actions/checkout@v6 |
@@ -282,7 +313,7 @@ jobs: |
282 | 313 | name: CI Pass |
283 | 314 | runs-on: ubuntu-latest |
284 | 315 | if: always() |
285 | | - needs: [lint-core, lint-free, security, test-core, test-free] |
| 316 | + needs: [changes, lint-core, lint-free, security, test-core, test-free] |
286 | 317 | steps: |
287 | 318 | - name: Check all jobs passed |
288 | 319 | run: | |
|
0 commit comments