-
Notifications
You must be signed in to change notification settings - Fork 1
141 lines (124 loc) · 3.48 KB
/
ci_cd.yml
File metadata and controls
141 lines (124 loc) · 3.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
name: CI/CD
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches:
- master
paths-ignore:
- "README.md"
pull_request:
branches:
- master
paths-ignore:
- "README.md"
workflow_dispatch:
jobs:
test:
runs-on: ${{ matrix.os }}
name: Test Site (${{ matrix.os }})
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
node: [lts/*]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node }}
- name: Install dependencies
run: npm ci
- name: Lint code
run: npm run lint
- name: Install Playwright Browsers
shell: bash
run: |
if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
npx playwright install --with-deps
else
npx playwright install
fi
- name: Run tests on CI
run: npm test
- uses: actions/upload-artifact@v7
if: ${{ !cancelled() }}
with:
name: playwright-ci-report-${{ matrix.os }}
path: playwright-report/
retention-days: 7
build:
name: Upload build for GH pages
if: github.ref == 'refs/heads/master'
needs: test
runs-on: ubuntu-latest
permissions:
contents: read
pages: read
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: lts/*
- name: Setup Pages
id: pages
uses: actions/configure-pages@v5
- name: Install dependencies
run: npm ci
- name: Build website
run: npm run build
# GitHub Pages configuration (supports custom domains)
env:
BASE_PUBLIC_PATH: ${{ steps.pages.outputs.base_path }}/
SITE_URL: ${{ steps.pages.outputs.base_url }}
- name: Upload Build Artifact
# only run on pushes to master or workflow_dispatch
if: github.ref == 'refs/heads/master'
uses: actions/upload-pages-artifact@v4
with:
path: dist
deploy:
name: Deploy to GitHub Pages
needs: build
outputs:
page_url: ${{ steps.deployment.outputs.page_url }}
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
test_deployment:
name: Test the deployed version
needs: deploy
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: lts/*
- name: Install dependencies
run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run tests on deployed site
run: npm test
env:
URL: ${{ needs.deploy.outputs.page_url }}
- uses: actions/upload-artifact@v7
if: ${{ !cancelled() }}
with:
name: playwright-report
path: playwright-report/
retention-days: 7