-
Notifications
You must be signed in to change notification settings - Fork 3.2k
101 lines (86 loc) · 3.43 KB
/
docs-visual-tests.yml
File metadata and controls
101 lines (86 loc) · 3.43 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
name: Docs Visual Tests
on:
workflow_dispatch:
inputs:
update-snapshots:
description: "Update snapshots"
type: boolean
test_env:
type: choice
description: Test enviroment
default: 'http://localhost:8080/docs'
options:
- https://dev.handsontable.com/docs
- https://handsontable.com/docs
- http://localhost:8080/docs
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
working-directory: ./docs/
jobs:
run-tests:
name: Visual tests for ${{ github.event.inputs.test_env }}
runs-on: ubuntu-latest
timeout-minutes: 60
env:
PASS_COOKIE: ${{ secrets.PASS_COOKIE }}
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # https://github.com/actions/checkout/releases/tag/v6.0.2
- name: Set up Node
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # https://github.com/actions/setup-node/releases/tag/v6.2.0
with:
cache: 'pnpm'
node-version: "20"
check-latest: true
- name: Install documentation dependencies
run: |
npm install
npx playwright install --with-deps
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # https://github.com/pnpm/action-setup/releases/tag/v4.2.0
name: Install pnpm
- name: Install the monorepo dependencies and build the packages
if: ${{inputs.test_env == 'http://localhost:8080/docs'}}
run: |
cd ..
pnpm install
npm run all build -- --e examples visual-tests
- name: Generate API refs
if: ${{inputs.test_env == 'http://localhost:8080/docs'}}
run: |
npm run docs:api
- name: Build documentation
if: ${{inputs.test_env == 'http://localhost:8080/docs'}}
run: |
npm run docs:build
- name: Set up cache
id: cache
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # https://github.com/actions/cache/releases/tag/v5.0.3
with:
key: plawyright-cache/${{github.repository}}/${{github.ref}}
restore-keys: plawyright-cache/${{github.repository}}/refs/heads/develop
path: '**/test-artifacts/**'
- name: Check if cache was restored
id: check-cache
run: |
if [[ -n "$(find . -name 'test-artifacts' -type d -not -path '*/node_modules/*' -print0 | xargs -0 -I {} find {} -type f -print -quit)" ]]; then
echo "cache-restored=true" >> $GITHUB_ENV
else
echo "cache-restored=false" >> $GITHUB_ENV
fi
- name: Initialize snapshots
if: ${{env.cache-restored != 'true' || github.event.inputs.update-snapshots == 'true'}}
run: BASE_URL=${{ github.event.inputs.test_env }} npx playwright test --update-snapshots
- name: Test
if: ${{env.cache-restored == 'true' && github.event.inputs.update-snapshots != 'true'}}
run: BASE_URL=${{ github.event.inputs.test_env }} npx playwright test
- name: Upload test report
if: always()
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # https://github.com/actions/upload-artifact/releases/tag/v7.0.0
with:
name: playwright-report
path: ./docs/tests/test-artifacts/results
retention-days: 30
overwrite: true