Skip to content

Commit 18c66bc

Browse files
grichaclaude
andauthored
Add Playwright e2e tests to CI (#15)
- Add new e2e job that runs in parallel with test and binary jobs - Install Playwright browsers (chromium only) - Start agent, create test workspace, run Playwright tests - Exclude OpenCode tests that require API keys - Upload Playwright report as artifact 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent e48fd27 commit 18c66bc

File tree

1 file changed

+97
-0
lines changed

1 file changed

+97
-0
lines changed

.github/workflows/test.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,3 +197,100 @@ jobs:
197197
# Skip Docker build in test setup since we already have the image
198198
export SKIP_DOCKER_BUILD=true
199199
bun run test
200+
201+
e2e:
202+
runs-on: ubuntu-latest
203+
needs: build
204+
steps:
205+
- uses: actions/checkout@v4
206+
with:
207+
fetch-depth: 0
208+
209+
- name: Download build artifacts
210+
uses: actions/download-artifact@v4
211+
with:
212+
name: dist
213+
path: dist/
214+
215+
- name: Set up Bun
216+
uses: oven-sh/setup-bun@v2
217+
with:
218+
bun-version: latest
219+
220+
- name: Cache bun dependencies
221+
uses: actions/cache@v4
222+
with:
223+
path: |
224+
~/.bun/install/cache
225+
node_modules
226+
web/node_modules
227+
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock', '**/package.json') }}
228+
restore-keys: |
229+
${{ runner.os }}-bun-
230+
231+
- name: Install dependencies
232+
run: |
233+
bun install
234+
cd web && bun install
235+
236+
- name: Install Playwright browsers
237+
run: cd web && bun x playwright install chromium --with-deps
238+
239+
- name: Set up Docker Buildx
240+
uses: docker/setup-buildx-action@v3
241+
242+
- name: Log in to Container Registry
243+
uses: docker/login-action@v3
244+
with:
245+
registry: ${{ env.REGISTRY }}
246+
username: ${{ github.actor }}
247+
password: ${{ secrets.GITHUB_TOKEN }}
248+
249+
- name: Check for Dockerfile changes
250+
id: docker-changes
251+
run: |
252+
if [ "${{ github.event_name }}" = "pull_request" ]; then
253+
BASE_SHA="${{ github.event.pull_request.base.sha }}"
254+
else
255+
BASE_SHA="${{ github.event.before }}"
256+
fi
257+
258+
if git diff --name-only "$BASE_SHA" HEAD 2>/dev/null | grep -q "^perry/"; then
259+
echo "changed=true" >> $GITHUB_OUTPUT
260+
else
261+
echo "changed=false" >> $GITHUB_OUTPUT
262+
fi
263+
264+
- name: Build workspace image (with cache)
265+
uses: docker/build-push-action@v6
266+
with:
267+
context: ./perry
268+
load: true
269+
tags: perry:latest
270+
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache-test
271+
cache-to: ${{ steps.docker-changes.outputs.changed == 'true' && format('type=registry,ref={0}/{1}:buildcache-test,mode=max', env.REGISTRY, env.IMAGE_NAME) || '' }}
272+
273+
- name: Start agent
274+
run: |
275+
bun run src/index.ts agent run --port 7391 &
276+
sleep 5
277+
curl -s http://localhost:7391/health || (echo "Agent failed to start" && exit 1)
278+
279+
- name: Create test workspace
280+
run: |
281+
bun run src/index.ts start test
282+
bun run src/index.ts list
283+
284+
- name: Run Playwright tests
285+
run: |
286+
cd web && bun run test:e2e --grep-invert "OpenCode"
287+
env:
288+
CI: true
289+
290+
- name: Upload Playwright report
291+
uses: actions/upload-artifact@v4
292+
if: ${{ !cancelled() }}
293+
with:
294+
name: playwright-report
295+
path: web/playwright-report/
296+
retention-days: 7

0 commit comments

Comments
 (0)