Skip to content

Commit 3ca5ea7

Browse files
committed
add github workflows for test, deploy, and pr previews.
1 parent 2377be6 commit 3ca5ea7

File tree

3 files changed

+105
-0
lines changed

3 files changed

+105
-0
lines changed

.github/workflows/deploy.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Deploy to GitHub Pages.
2+
#
3+
# Based on https://github.com/JamesIves/github-pages-deploy-action
4+
# and https://github.com/marketplace/actions/deploy-pr-preview#ensure-your-main-deployment-is-compatible
5+
6+
name: Deploy
7+
on:
8+
push:
9+
branches:
10+
- main
11+
permissions:
12+
contents: write
13+
jobs:
14+
build-and-deploy:
15+
concurrency: ci-${{ github.ref }}
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout 🛎️
19+
uses: actions/checkout@v4
20+
21+
- name: Install and Build 🔧
22+
run: |
23+
npm ci
24+
npm run build
25+
npm run obfuscate
26+
27+
- name: Deploy 🚀
28+
uses: JamesIves/github-pages-deploy-action@v4
29+
with:
30+
folder: build
31+
clean-exclude: pr-preview/
32+
force: false

.github/workflows/preview.yml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Preview PRs by deploying to a pemanent subdirectory in GitHub Pages.
2+
#
3+
# Based on https://github.com/marketplace/actions/deploy-pr-preview#usage.
4+
5+
name: Deploy PR previews
6+
7+
on:
8+
pull_request:
9+
branches:
10+
- main
11+
types:
12+
- opened
13+
- synchronize
14+
paths:
15+
- '**.js'
16+
- '**.ts'
17+
- '**.json'
18+
- 'src/**'
19+
- 'static/**'
20+
- '.env'
21+
- '.env.*'
22+
23+
concurrency: preview-${{ github.ref }}
24+
25+
jobs:
26+
deploy-preview:
27+
runs-on: ubuntu-latest
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v3
31+
32+
- name: Install and Build
33+
run: |
34+
npm ci
35+
npm run build
36+
npm run obfuscate
37+
38+
- name: Deploy preview
39+
uses: rossjrw/pr-preview-action@v1
40+
with:
41+
source-dir: ./build/
42+
action: deploy

.github/workflows/test.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Run unit and integration tests.
2+
#
3+
# Based on https://playwright.dev/docs/ci#via-containers.
4+
name: Test
5+
on:
6+
push:
7+
branches: main
8+
pull_request:
9+
branches: main
10+
jobs:
11+
test:
12+
name: 'Test'
13+
runs-on: ubuntu-latest
14+
container:
15+
image: mcr.microsoft.com/playwright
16+
options: --user 1001
17+
steps:
18+
- uses: actions/checkout@v4
19+
- uses: actions/setup-node@v4
20+
with:
21+
node-version: lts/*
22+
- name: Install dependencies
23+
run: npm ci
24+
- name: Run tests
25+
run: npm run test
26+
- uses: actions/upload-artifact@v4
27+
if: ${{ !cancelled() }}
28+
with:
29+
name: playwright-report
30+
path: playwright-report/
31+
retention-days: 30

0 commit comments

Comments
 (0)