Skip to content

Commit 1bb8bee

Browse files
authored
Add GitHub Actions workflow for testing and deployment
1 parent 01c27ab commit 1bb8bee

1 file changed

Lines changed: 66 additions & 0 deletions

File tree

‎.github/workflows/deploy.yml‎

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Test and deploy
2+
3+
on:
4+
push:
5+
branches: [main]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
13+
concurrency:
14+
group: pages
15+
cancel-in-progress: false
16+
17+
jobs:
18+
test:
19+
name: Run test suite
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Set up Node
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: 20
29+
30+
- name: Install test tooling
31+
run: npm install --no-save playwright@1 http-server@14 wait-on@7
32+
33+
- name: Install headless Chromium
34+
run: npx playwright install --with-deps chromium
35+
36+
- name: Serve site
37+
run: npx http-server -p 8080 -c-1 . &
38+
39+
- name: Wait for server
40+
run: npx wait-on http://127.0.0.1:8080/tests.html
41+
42+
- name: Run browser test suite
43+
run: node .github/scripts/run-tests.mjs
44+
45+
deploy:
46+
name: Deploy to GitHub Pages
47+
needs: test
48+
runs-on: ubuntu-latest
49+
environment:
50+
name: github-pages
51+
url: ${{ steps.deployment.outputs.page_url }}
52+
steps:
53+
- name: Checkout
54+
uses: actions/checkout@v4
55+
56+
- name: Configure Pages
57+
uses: actions/configure-pages@v5
58+
59+
- name: Upload artifact
60+
uses: actions/upload-pages-artifact@v3
61+
with:
62+
path: .
63+
64+
- name: Deploy to GitHub Pages
65+
id: deployment
66+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)