Skip to content

Commit efca2b3

Browse files
committed
fix(e2e): making required action cacheable
1 parent 92cf4e9 commit efca2b3

1 file changed

Lines changed: 31 additions & 9 deletions

File tree

.github/workflows/e2e.yml

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,6 @@ on:
44
workflow_dispatch:
55
pull_request:
66
types: [opened, reopened, ready_for_review, synchronize]
7-
paths:
8-
- "src/**"
9-
- "webview-ui/**"
10-
- "apps/vscode-e2e/**"
11-
- "packages/core/**"
12-
- "package.json"
13-
- "pnpm-lock.yaml"
14-
- "turbo.json"
15-
- ".github/actions/setup-node-pnpm/**"
167
merge_group:
178
types: [checks_requested]
189

@@ -23,9 +14,40 @@ jobs:
2314
steps:
2415
- name: Checkout code
2516
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
17+
18+
- name: Restore mocked E2E pass marker
19+
id: e2e-marker
20+
uses: actions/cache/restore@v4
21+
with:
22+
path: .cache/e2e-pass
23+
# packages/** is intentionally broader than the old packages/core/** to avoid false cache hits when any package changes
24+
# base_ref is included to prevent same-repo branches from stuffing a pass marker for a different base
25+
key: ${{ runner.os }}-mocked-e2e-${{ github.base_ref }}-${{ hashFiles('src/**', 'webview-ui/**', 'apps/vscode-e2e/**', 'packages/**', 'package.json', 'pnpm-lock.yaml', 'pnpm-workspace.yaml', 'turbo.json', '.github/workflows/e2e.yml', '.github/actions/setup-node-pnpm/**') }}
26+
27+
- name: Use cached mocked E2E result
28+
if: github.event_name == 'pull_request' && steps.e2e-marker.outputs.cache-hit == 'true'
29+
run: echo "Skipping mocked E2E tests because this source hash already passed."
30+
2631
- name: Setup Node.js and pnpm
32+
if: github.event_name != 'pull_request' || steps.e2e-marker.outputs.cache-hit != 'true'
2733
uses: ./.github/actions/setup-node-pnpm
2834
- name: Install xvfb
35+
if: github.event_name != 'pull_request' || steps.e2e-marker.outputs.cache-hit != 'true'
2936
run: sudo apt-get install -y xvfb
3037
- name: Run mocked E2E tests
38+
id: run-e2e
39+
# merge_group and workflow_dispatch always run; cache skip is pull_request only
40+
if: github.event_name != 'pull_request' || steps.e2e-marker.outputs.cache-hit != 'true'
3141
run: xvfb-run -a pnpm --filter @roo-code/vscode-e2e test:ci:mock
42+
43+
- name: Write mocked E2E pass marker
44+
if: steps.e2e-marker.outputs.cache-hit != 'true' && steps.run-e2e.outcome == 'success'
45+
run: mkdir -p .cache/e2e-pass && date -u > .cache/e2e-pass/passed
46+
47+
- name: Save mocked E2E pass marker
48+
if: steps.e2e-marker.outputs.cache-hit != 'true' && steps.run-e2e.outcome == 'success'
49+
continue-on-error: true
50+
uses: actions/cache/save@v4
51+
with:
52+
path: .cache/e2e-pass
53+
key: ${{ steps.e2e-marker.outputs.cache-primary-key }}

0 commit comments

Comments
 (0)