Skip to content

Commit 5adce51

Browse files
committed
simplify: integration test filtering (future-proof)
- docs-only: skip entire integration job (job-level if) - browser-only: skip tests/ipc, run all other tests under tests/ - otherwise: run ALL tests under tests/ (new directories auto-included) Uses --testPathIgnorePatterns for browser-only exclusion. Jest's testMatch only picks up *.test.ts, so e2e/*.spec.ts is already excluded.
1 parent e509e3f commit 5adce51

File tree

1 file changed

+20
-46
lines changed

1 file changed

+20
-46
lines changed

.github/workflows/pr.yml

Lines changed: 20 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ jobs:
2222
runs-on: ubuntu-latest
2323
outputs:
2424
docs-only: ${{ steps.filter.outputs.docs == 'true' && steps.filter.outputs.src == 'false' && steps.filter.outputs.config == 'false' }}
25-
config: ${{ steps.filter.outputs.config }}
26-
ipc: ${{ steps.filter.outputs.ipc }}
27-
runtime: ${{ steps.filter.outputs.runtime }}
25+
browser-only: ${{ steps.filter.outputs.browser == 'true' && steps.filter.outputs.backend == 'false' && steps.filter.outputs.config == 'false' }}
2826
steps:
2927
- uses: actions/checkout@v4
3028
- uses: dorny/paths-filter@v3
@@ -40,21 +38,18 @@ jobs:
4038
- 'src/**'
4139
- 'tests/**'
4240
- 'vscode/**'
43-
# IPC tests: backend services, ORPC, config, common types
44-
ipc:
45-
- 'src/node/services/**'
46-
- 'src/node/orpc/**'
47-
- 'src/node/config/**'
48-
- 'src/node/git/**'
49-
- 'src/node/utils/**'
50-
- 'src/common/**'
41+
browser:
42+
- 'src/browser/**'
43+
- 'src/styles/**'
44+
- '**/*.stories.tsx'
45+
- '.storybook/**'
46+
backend:
47+
- 'src/node/**'
5148
- 'src/cli/**'
5249
- 'src/desktop/**'
53-
- 'tests/ipc/**'
54-
# Runtime tests: runtime implementations (SSH, worktree)
55-
runtime:
56-
- 'src/node/runtime/**'
57-
- 'tests/runtime/**'
50+
- 'src/common/**'
51+
- 'tests/**'
52+
- '!tests/e2e/**'
5853
config:
5954
- '.github/**'
6055
- 'jest.config.cjs'
@@ -124,47 +119,26 @@ jobs:
124119
fetch-depth: 0
125120
- uses: ./.github/actions/setup-mux
126121
- run: make build-main
127-
- name: Compute test filter
128-
id: test-filter
122+
- name: Run integration tests
129123
run: |
130-
# Manual override takes precedence
124+
# Manual override
131125
if [[ -n "${{ github.event.inputs.test_filter }}" ]]; then
132-
echo "filter=${{ github.event.inputs.test_filter }}" >> $GITHUB_OUTPUT
126+
TEST_INTEGRATION=1 bun x jest --coverage --maxWorkers=100% --silent ${{ github.event.inputs.test_filter }}
133127
exit 0
134128
fi
135129
136-
# Config changes = run everything
137-
if [[ "${{ needs.changes.outputs.config }}" == "true" ]]; then
138-
echo "filter=tests/ipc tests/runtime" >> $GITHUB_OUTPUT
130+
# Browser-only PRs skip IPC tests but run all other integration tests
131+
if [[ "${{ needs.changes.outputs.browser-only }}" == "true" ]]; then
132+
echo "Browser-only PR - skipping tests/ipc"
133+
TEST_INTEGRATION=1 bun x jest --coverage --maxWorkers=100% --silent --testPathIgnorePatterns='tests/ipc' tests/
139134
exit 0
140135
fi
141136
142-
# Build filter from changed paths
143-
paths=""
144-
if [[ "${{ needs.changes.outputs.ipc }}" == "true" ]]; then
145-
paths="$paths tests/ipc"
146-
fi
147-
if [[ "${{ needs.changes.outputs.runtime }}" == "true" ]]; then
148-
paths="$paths tests/runtime"
149-
fi
150-
paths=$(echo $paths | xargs) # trim whitespace
151-
152-
if [[ -z "$paths" ]]; then
153-
echo "No integration tests needed for changed paths"
154-
echo "filter=" >> $GITHUB_OUTPUT
155-
else
156-
echo "Running: $paths"
157-
echo "filter=$paths" >> $GITHUB_OUTPUT
158-
fi
159-
- name: Run integration tests
160-
if: ${{ steps.test-filter.outputs.filter != '' }}
161-
run: TEST_INTEGRATION=1 bun x jest --coverage --maxWorkers=100% --silent ${{ steps.test-filter.outputs.filter }}
137+
# Default: run ALL integration tests (future-proof for new test directories)
138+
TEST_INTEGRATION=1 bun x jest --coverage --maxWorkers=100% --silent tests/
162139
env:
163140
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
164141
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
165-
- name: Skip integration tests
166-
if: ${{ steps.test-filter.outputs.filter == '' }}
167-
run: echo "Skipping integration tests - no relevant paths changed"
168142
- uses: codecov/codecov-action@v5
169143
if: ${{ steps.test-filter.outputs.filter != '' }}
170144
with:

0 commit comments

Comments
 (0)