-
Notifications
You must be signed in to change notification settings - Fork 37
115 lines (92 loc) · 2.97 KB
/
screenshot_capture.yaml
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
name: Screenshot Capture
# This workflow is triggered when a workflow run of the "Release to Production" workflow is completed or when manually triggered.
# The primary purpose of this workflow is to take screenshots of the website using Playwright and upload them as artifacts.
# The screenshots can be used to compare the visual appearance of the website before and after a release.
# The workflow Visual Comparison uses these screenshots to generate a visual comparison report.
# on:
# workflow_run:
# workflows: ["Release to Production"]
# types: [completed]
# workflow_dispatch:
on:
push:
branches:
- visual-tests
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
APPZI_TOKEN: ${{ secrets.APPZI_TOKEN }}
MENDABLE_API_KEY: ${{ secrets.MENDABLE_API_KEY }}
FULLSTORY_ORGID: ${{ secrets.FULLSTORY_ORGID }}
ALGOLIA_ADMIN_KEY: ${{ secrets.ALGOLIA_ADMIN_KEY }}
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }}
ALGOLIA_SEARCH_KEY: ${{ secrets.ALGOLIA_SEARCH_KEY }}
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup Node.js Environment
uses: actions/setup-node@v4
with:
node-version: "18"
cache: "npm"
- name: Install Dependencies
run: npm ci
- name: Install Playwright browsers
run: npx playwright install --with-deps chromium
- name: Build Website
run: make build
- name: Upload Build
uses: actions/upload-artifact@v4
with:
name: "build"
path: |
build/
if-no-files-found: error
retention-days: 1
visual-snapshots:
runs-on: ubuntu-latest
needs: [build]
strategy:
fail-fast: false
matrix:
shardIndex: [1, 2, 3, 4]
shardTotal: [4]
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup Node.js Environment
uses: actions/setup-node@v4
with:
node-version: "18"
cache: "npm"
- name: Download Build
uses: Wandalen/wretry.action@v3
with:
command: npm ci
attempt_limit: 3
attempt_delay: 60000 # 1 minute
- name: Install Playwright browsers
run: npx playwright install --with-deps chromium
- name: retry action
uses: Wandalen/wretry.action@v3
with:
attempt_limit: 3
action: actions/download-artifact@v4
with: |
name: build
path: build
attempt_delay: 60000 # 1 minute
- name: Take Screenshots with Playwright
run: npx playwright test --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} || exit 0
- name: Upload Screenshots
uses: actions/upload-artifact@v4
id: screenshots
with:
name: "snapshots"
path: |
screenshots/
if-no-files-found: error
retention-days: 3