Skip to content

Commit bd24fdf

Browse files
committed
playwright ci
1 parent 2de82de commit bd24fdf

File tree

1 file changed

+99
-0
lines changed

1 file changed

+99
-0
lines changed

.github/workflows/playwright.yml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: "CI"
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
- 'releases/*'
9+
workflow_dispatch:
10+
schedule:
11+
- cron: '40 0 * * *' # Runs daily at 00:40 UTC
12+
13+
jobs:
14+
test-linux:
15+
name: Playwright@${{ matrix.playwright }} on ${{ matrix.os }} (headless=${{ matrix.headless }})
16+
runs-on: ubuntu-20.04 # Specify the Ubuntu version you prefer
17+
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
playwright: [1.8.0, 1.12.0, 1.18.0, next, beta]
22+
headless: [true, false]
23+
exclude:
24+
- playwright: 1.8.0
25+
headless: false
26+
- playwright: 1.12.0
27+
headless: false
28+
29+
steps:
30+
# 1. Checkout the repository
31+
- uses: actions/checkout@v3
32+
33+
# 2. Setup Node.js
34+
- name: Setup Node.js
35+
uses: actions/setup-node@v3
36+
with:
37+
node-version: 18
38+
39+
# 3. Setup pnpm
40+
- name: Setup pnpm
41+
uses: pnpm/action-setup@v2
42+
with:
43+
version: 7.x
44+
45+
# 4. Cache pnpm dependencies
46+
- name: Cache pnpm dependencies
47+
uses: actions/cache@v3
48+
with:
49+
path: ~/.pnpm-store
50+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
51+
restore-keys: |
52+
${{ runner.os }}-pnpm-store-
53+
54+
# 5. Install dependencies
55+
- name: Install dependencies
56+
run: pnpm install
57+
58+
# 6. Build the @instructure/idb-cache package
59+
- name: Build idb-cache package
60+
run: pnpm --filter @instructure/idb-cache build
61+
62+
# 7. Build the idb-cache-app
63+
- name: Build idb-cache-app
64+
run: pnpm --filter idb-cache-app build
65+
66+
# 8. Serve the idb-cache-app
67+
- name: Serve idb-cache-app
68+
run: pnpm --filter idb-cache-app preview -- --port 3000 &
69+
# The '&' runs the serve command in the background
70+
71+
# 9. Wait for the server to be ready
72+
- name: Wait for idb-cache-app to be ready
73+
run: |
74+
for i in {1..60}; do
75+
if curl -s http://localhost:3000 > /dev/null; then
76+
echo "Server is ready!"
77+
break
78+
fi
79+
echo "Waiting for server to be ready... ($i/60)"
80+
sleep 1
81+
done
82+
83+
# 10. Install Playwright with the specified version
84+
- name: Install Playwright
85+
run: |
86+
pnpm add -D playwright@${{ matrix.playwright }}
87+
npx playwright install
88+
89+
# 11. Run Playwright tests in headless mode
90+
- name: Run Playwright tests (Headless)
91+
if: ${{ matrix.headless == true }}
92+
run: npx playwright test
93+
94+
# 12. Run Playwright tests in headful mode on Linux
95+
- name: Run Playwright tests (Headful)
96+
if: ${{ matrix.headless == false }}
97+
run: |
98+
export HEADFUL=true
99+
xvfb-run --auto-servernum -- npx playwright test

0 commit comments

Comments
 (0)