-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (63 loc) · 2.08 KB
/
Copy pathtest.yml
File metadata and controls
74 lines (63 loc) · 2.08 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
---
name: Screenshot Tests
on:
workflow_dispatch:
inputs:
screenshots:
description: 'Run screenshot tests (slow, requires Hugo build)'
type: boolean
default: true
update-baselines:
description: 'Re-record screenshot baselines and commit'
type: boolean
default: false
permissions:
contents: write
pull-requests: write
concurrency:
group: screenshots-${{ github.ref }}
cancel-in-progress: true
jobs:
screenshots:
name: Screenshot Tests
if: ${{ inputs.screenshots || inputs.update-baselines }}
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v7
with:
ref: ${{ github.head_ref || github.ref }}
- uses: snap-diff/snap_diff-capybara/.github/actions/setup-ruby-and-dependencies@master
with:
ruby-version: '4.0'
cache-apt-packages: true
- uses: ./.github/actions/setup-hugo
- name: Run screenshot tests
if: ${{ !inputs.update-baselines }}
run: bundle exec rake test
env:
SCREENSHOT_DRIVER: vips
PRECOMPILED_ASSETS: '1'
HUGO_DEFAULT_PATH: _dest/public-test
- name: Record baselines
if: ${{ inputs.update-baselines }}
run: FORCE_SCREENSHOT_UPDATE=true bundle exec rake test
env:
SCREENSHOT_DRIVER: vips
PRECOMPILED_ASSETS: '1'
HUGO_DEFAULT_PATH: _dest/public-test
- name: Commit updated baselines
if: ${{ inputs.update-baselines }}
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add test/fixtures/screenshots/
git diff --staged --quiet || git commit -m "chore: update screenshot baselines [ci skip]"
git push
- name: Upload screenshot report
if: failure()
uses: snap-diff/snap_diff-capybara/.github/actions/upload-screenshots@master
with:
name: screenshots
report-path: test/fixtures/screenshots
pr-comment: 'true'