Skip to content

Commit 6c8e29a

Browse files
cameriphoenix-serverCopilot
authored
chore(ci): skip expensive jobs on non-source changes (#565)
* chore(ci): install missing changelog package * chore(ci): skip expensive jobs on non-source changes Add dorny/paths-filter gate so lint, build-check, and both test jobs only run when source-affecting files change (src/, test/, package.json, tsconfigs, Dockerfiles, etc.). Metadata checks (commit-lint, changeset-check) remain unconditional. Also restrict commit-lint to PRs/workflow_dispatch to avoid false positives on squash-merge commits pushed to main, fix post-tests Coveralls parallel-finished to not fire on skipped test runs, and bump actions/checkout + actions/setup-node from v3 to v4. * fix(ci): address reviewer feedback on checks.yml security and correctness Agent-Logs-Url: https://github.com/cameri/nostream/sessions/5e3c60f2-1798-47a5-b25a-45c990bfb6bd Co-authored-by: cameri <378886+cameri@users.noreply.github.com> --------- Co-authored-by: phoenix-server <phoenix@ricardocabral.io> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: cameri <378886+cameri@users.noreply.github.com>
1 parent 47a9f4e commit 6c8e29a

1 file changed

Lines changed: 76 additions & 22 deletions

File tree

.github/workflows/checks.yml

Lines changed: 76 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,31 +12,64 @@ concurrency:
1212
cancel-in-progress: true
1313

1414
jobs:
15+
changes:
16+
name: Detect changed paths
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
20+
pull-requests: read
21+
outputs:
22+
src: ${{ steps.filter.outputs.src }}
23+
steps:
24+
- uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0
27+
- id: filter
28+
uses: dorny/paths-filter@v3
29+
with:
30+
filters: |
31+
src:
32+
- 'src/**'
33+
- 'test/**'
34+
- 'package.json'
35+
- 'pnpm-lock.yaml'
36+
- 'tsconfig*.json'
37+
- 'biome.json'
38+
- '.knip.json'
39+
- 'Dockerfile*'
40+
- 'docker-compose*.yml'
41+
- '.nvmrc'
42+
- '.github/workflows/checks.yml'
43+
1544
commit-lint:
1645
name: Lint commits
1746
runs-on: ubuntu-latest
47+
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
1848
steps:
1949
- name: Checkout
20-
uses: actions/checkout@v3
50+
uses: actions/checkout@v4
2151
with:
2252
fetch-depth: 0
2353
- uses: pnpm/action-setup@v4
24-
- uses: actions/setup-node@v3
54+
- uses: actions/setup-node@v4
2555
with:
2656
node-version-file: .nvmrc
2757
cache: pnpm
2858
- name: Install package dependencies
2959
run: pnpm install --frozen-lockfile
3060
- name: Run commitlint
3161
uses: wagoid/commitlint-github-action@v5
62+
3263
lint:
3364
name: Lint code
3465
runs-on: ubuntu-latest
66+
needs: changes
67+
if: needs.changes.outputs.src == 'true'
3568
steps:
3669
- name: Checkout
37-
uses: actions/checkout@v3
70+
uses: actions/checkout@v4
3871
- uses: pnpm/action-setup@v4
39-
- uses: actions/setup-node@v3
72+
- uses: actions/setup-node@v4
4073
with:
4174
node-version-file: .nvmrc
4275
cache: pnpm
@@ -46,14 +79,17 @@ jobs:
4679
run: pnpm run lint
4780
- name: Run Knip
4881
run: pnpm run check:deps
82+
4983
build-check:
5084
name: Build check
5185
runs-on: ubuntu-latest
86+
needs: changes
87+
if: needs.changes.outputs.src == 'true'
5288
steps:
5389
- name: Checkout
54-
uses: actions/checkout@v3
90+
uses: actions/checkout@v4
5591
- uses: pnpm/action-setup@v4
56-
- uses: actions/setup-node@v3
92+
- uses: actions/setup-node@v4
5793
with:
5894
node-version-file: .nvmrc
5995
cache: pnpm
@@ -65,18 +101,23 @@ jobs:
65101
run: pnpm run build
66102
- name: Verify built CLI entrypoint
67103
run: pnpm run verify:cli:build
104+
68105
test-units-and-cover:
69106
name: Unit Tests And Coverage
70107
runs-on: ubuntu-latest
71108
needs:
72-
- commit-lint
109+
- changes
73110
- lint
74111
- build-check
112+
if: |
113+
needs.changes.outputs.src == 'true' &&
114+
needs.lint.result == 'success' &&
115+
needs.build-check.result == 'success'
75116
steps:
76117
- name: Checkout
77-
uses: actions/checkout@v3
118+
uses: actions/checkout@v4
78119
- uses: pnpm/action-setup@v4
79-
- uses: actions/setup-node@v3
120+
- uses: actions/setup-node@v4
80121
with:
81122
node-version-file: .nvmrc
82123
cache: pnpm
@@ -96,25 +137,30 @@ jobs:
96137
name: unit-coverage-lcov
97138
path: .coverage/unit/lcov.info
98139
- name: Coveralls
99-
uses: coverallsapp/github-action@master
140+
uses: coverallsapp/github-action@v2.3.6
100141
if: ${{ always() }}
101142
with:
102143
path-to-lcov: ./.coverage/unit/lcov.info
103144
flag-name: Unit
104145
github-token: ${{ secrets.GITHUB_TOKEN }}
105146
parallel: true
147+
106148
test-integrations-and-cover:
107149
name: Integration Tests and Coverage
108150
runs-on: ubuntu-latest
109151
needs:
110-
- commit-lint
152+
- changes
111153
- lint
112154
- build-check
155+
if: |
156+
needs.changes.outputs.src == 'true' &&
157+
needs.lint.result == 'success' &&
158+
needs.build-check.result == 'success'
113159
steps:
114160
- name: Checkout
115-
uses: actions/checkout@v3
161+
uses: actions/checkout@v4
116162
- uses: pnpm/action-setup@v4
117-
- uses: actions/setup-node@v3
163+
- uses: actions/setup-node@v4
118164
with:
119165
node-version-file: .nvmrc
120166
- name: Run integration tests
@@ -129,7 +175,7 @@ jobs:
129175
- name: Run coverage for integration tests
130176
run: pnpm run docker:cover:integration
131177
- name: Coveralls
132-
uses: coverallsapp/github-action@master
178+
uses: coverallsapp/github-action@v2.3.6
133179
if: ${{ always() }}
134180
with:
135181
path-to-lcov: .coverage/integration/lcov.info
@@ -142,28 +188,36 @@ jobs:
142188
with:
143189
name: integration-coverage-lcov
144190
path: .coverage/integration/lcov.info
191+
145192
post-tests:
146193
name: Post Tests
147-
needs: [test-units-and-cover, test-integrations-and-cover]
148194
runs-on: ubuntu-latest
195+
needs:
196+
- changes
197+
- test-units-and-cover
198+
- test-integrations-and-cover
149199
if: ${{ always() }}
150200
steps:
151-
- name: Coveralls Finished
152-
uses: coverallsapp/github-action@master
153-
with:
154-
github-token: ${{ secrets.GITHUB_TOKEN }}
155-
parallel-finished: true
201+
- name: Coveralls Finished
202+
uses: coverallsapp/github-action@v2.3.6
203+
if: |
204+
needs.test-units-and-cover.result != 'skipped' ||
205+
needs.test-integrations-and-cover.result != 'skipped'
206+
with:
207+
github-token: ${{ secrets.GITHUB_TOKEN }}
208+
parallel-finished: true
209+
156210
changeset-check:
157211
name: Changeset Required
158212
runs-on: ubuntu-latest
159213
if: github.event_name == 'pull_request' && github.head_ref != 'changeset-release/main'
160214
steps:
161215
- name: Checkout
162-
uses: actions/checkout@v3
216+
uses: actions/checkout@v4
163217
with:
164218
fetch-depth: 0
165219
- uses: pnpm/action-setup@v4
166-
- uses: actions/setup-node@v3
220+
- uses: actions/setup-node@v4
167221
with:
168222
node-version-file: .nvmrc
169223
cache: pnpm

0 commit comments

Comments
 (0)