-
Notifications
You must be signed in to change notification settings - Fork 9
105 lines (94 loc) · 2.95 KB
/
e2e.yml
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
name: Automation Testing (Draft)
on:
push:
branches: [ main, main-beta, epic/* ]
workflow_dispatch:
inputs:
updateSnapshots:
type: boolean
default: false
required: false
description: 'Create a pull request to update snapshots on the current branch'
env:
node-version: 20.x
DIFF_REPORT_BRANCH: diff-report
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
e2e-tests:
name: Automation Testing
runs-on: ubuntu-latest
if: ${{ !inputs.updateSnapshots }}
permissions:
contents: write
pull-requests: write
pages: none
deployments: none
steps:
- uses: actions/checkout@v4
- name: Use Node v${{ env.node-version }}
uses: actions/setup-node@v4
with:
cache: 'npm'
node-version: ${{ env.node-version }}
- name: Install NPM Dependencies
run: npm ci
- name: Run Tests
run: npm run test:e2e
- name: Collect Report & Upload Artifact
if: failure()
uses: actions/upload-artifact@v4
with:
name: automation-diff-report
path: e2e/.diff
- name: Deploy Latest Issued Report To Branch
if: failure()
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: e2e/.diff
publish_branch: ${{ env.DIFF_REPORT_BRANCH }}
- name: Render Report
if: always()
shell: bash
run: |
cat e2e/.diff/index.md >> $GITHUB_STEP_SUMMARY
e2e-tests-update-snapshots:
name: Update Automation Testing Snapshots
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_dispatch' && inputs.updateSnapshots }}
env:
UPD_COMMIT_MSG: 'test(e2e): update snapshots (via GitHub Actions)'
permissions:
actions: write
checks: write
contents: write
id-token: write
issues: write
pull-requests: write
statuses: write
steps:
- uses: actions/checkout@v4
- name: Use Node v${{ env.node-version }}
uses: actions/setup-node@v4
with:
cache: 'npm'
node-version: ${{ env.node-version }}
- name: Install NPM Dependencies
run: npm ci
- name: Update Test Snapshots
run: npm run test:e2e:update
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: ${{ env.UPD_COMMIT_MSG }}
title: ${{ env.UPD_COMMIT_MSG }} for ${{ github.ref }}
body: |
This PR was automatically created by the e2e-tests-update-snapshots workflow to actualize snapshots on the ${{ github.ref }} branch.
branch: tests/snapshots-patch
branch-suffix: timestamp
labels: automation, update-snapshots
reviewers: ${{ github.actor }}
assignees: ${{ github.actor }}