Skip to content

Commit 16c3475

Browse files
committed
Add workflows for everything
1 parent b6f59a2 commit 16c3475

File tree

1 file changed

+37
-12
lines changed

1 file changed

+37
-12
lines changed

.github/workflows/playwright.yml

Lines changed: 37 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,72 @@
1-
name: Next.js App Router - PostHog Tests
1+
name: PostHog Examples - Playwright Tests
22

33
on:
44
push:
55
branches: [ main ]
66
pull_request:
77
branches: [ main ]
8+
schedule:
9+
# Runs nightly at 12am PST (which is 8am UTC)
10+
- cron: '0 8 * * *'
811

912
jobs:
13+
discover:
14+
runs-on: ubuntu-latest
15+
outputs:
16+
examples: ${{ steps.set-examples.outputs.examples }}
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Discover examples with Playwright configs
21+
id: set-examples
22+
run: |
23+
examples=$(find basics -maxdepth 2 -name "playwright.config.ts" -exec dirname {} \; | sed 's|^basics/||' | jq -R -s -c 'split("\n")[:-1]')
24+
echo "examples=$examples" >> $GITHUB_OUTPUT
25+
echo "Found examples: $examples"
26+
1027
test:
28+
needs: discover
29+
if: needs.discover.outputs.examples != '[]'
1130
timeout-minutes: 60
1231
runs-on: ubuntu-latest
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
example: ${{ fromJson(needs.discover.outputs.examples) }}
1336
steps:
1437
- uses: actions/checkout@v4
15-
38+
1639
- uses: actions/setup-node@v4
1740
with:
1841
node-version: lts/*
19-
42+
2043
- uses: pnpm/action-setup@v4
2144
with:
2245
version: latest
23-
46+
2447
- name: Install dependencies
2548
run: |
26-
cd basics/next-app-router
49+
cd basics/${{ matrix.example }}
2750
pnpm install
28-
51+
2952
- name: Install Playwright Browsers
3053
run: |
31-
cd basics/next-app-router
54+
cd basics/${{ matrix.example }}
3255
pnpm exec playwright install chromium --with-deps
33-
56+
3457
- name: Run Playwright tests
3558
run: |
36-
cd basics/next-app-router
59+
cd basics/${{ matrix.example }}
3760
pnpm exec playwright test
3861
env:
3962
NEXT_PUBLIC_POSTHOG_KEY: ${{ vars.NEXT_PUBLIC_POSTHOG_KEY }}
4063
NEXT_PUBLIC_POSTHOG_HOST: ${{ vars.NEXT_PUBLIC_POSTHOG_HOST }}
41-
64+
4265
- uses: actions/upload-artifact@v4
4366
if: always()
4467
with:
45-
name: playwright-report
46-
path: basics/next-app-router/playwright-report/
68+
name: playwright-report-${{ matrix.example }}
69+
path: basics/${{ matrix.example }}/playwright-report/
4770
retention-days: 30
71+
72+
# TODO: report to PostHog which will warn in channel for failure.

0 commit comments

Comments
 (0)