-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (74 loc) · 3.01 KB
/
applitools-visual.yml
File metadata and controls
86 lines (74 loc) · 3.01 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
name: Applitools Visual
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
permissions:
contents: read
jobs:
applitools-visual:
name: Applitools Visual
runs-on: ubuntu-latest
defaults:
run:
working-directory: frontend/webcoder_ui
env:
APPLITOOLS_PR_ORIGIN: ${{ (github.actor == 'dependabot[bot]') || (github.event.pull_request.user.login == 'dependabot[bot]') }}
HAS_APPLITOOLS_KEY: ${{ secrets.APPLITOOLS_API_KEY != '' }}
E2E_BASE_URL: http://127.0.0.1:3100
APPLITOOLS_RESULTS_PATH: applitools/results.json
APPLITOOLS_BATCH_NAME: GitHub-${{ github.workflow }}-${{ github.ref_name }}
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
persist-credentials: false
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: "24"
cache: "npm"
cache-dependency-path: frontend/webcoder_ui/package-lock.json
- name: Validate Applitools credentials
id: applitools
env:
APPLITOOLS_API_KEY: ${{ secrets.APPLITOOLS_API_KEY }}
run: |
set -euo pipefail
if [ -z "${APPLITOOLS_API_KEY}" ]; then
if [ "${APPLITOOLS_PR_ORIGIN}" = "true" ]; then
echo "available=false" >> "$GITHUB_OUTPUT"
echo "Applitools was skipped because APPLITOOLS_API_KEY is unavailable in this Dependabot context."
exit 0
fi
echo "APPLITOOLS_API_KEY is not configured for this repository." >&2
exit 1
fi
status="$(curl -sS -o /tmp/applitools-renderinfo.json -w '%{http_code}' \
-H "X-Api-Key: ${APPLITOOLS_API_KEY}" \
"https://eyesapi.applitools.com/api/sessions/renderinfo")"
if [ "${status}" = "200" ]; then
echo "available=true" >> "$GITHUB_OUTPUT"
exit 0
fi
if [ "${APPLITOOLS_PR_ORIGIN}" = "true" ]; then
echo "available=false" >> "$GITHUB_OUTPUT"
echo "Applitools was skipped because credentials validation failed with HTTP ${status} in this Dependabot context."
exit 0
fi
echo "Applitools credentials validation failed with HTTP ${status}." >&2
exit 1
- name: Install dependencies
if: steps.applitools.outputs.available == 'true'
run: npm ci
- name: Install Playwright browser
if: steps.applitools.outputs.available == 'true'
run: npx playwright install --with-deps chromium
- name: Run Applitools snapshots
if: steps.applitools.outputs.available == 'true'
env:
APPLITOOLS_API_KEY: ${{ secrets.APPLITOOLS_API_KEY }}
run: npm run e2e:applitools
- name: Note skipped Applitools run
if: steps.applitools.outputs.available != 'true'
run: echo "Applitools visual validation was skipped because credentials are unavailable in this Dependabot context."