-
Notifications
You must be signed in to change notification settings - Fork 8
112 lines (108 loc) · 3.5 KB
/
cypress.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
106
107
108
109
110
111
112
name: E2E test
on:
push:
branches: [trunk, develop]
pull_request:
# The branches below must be a subset of the branches above
branches: [develop]
schedule:
- cron: '36 7 * * 6'
jobs:
changed-files:
name: Changed Files
outputs:
status: ${{ steps.changed-files.outputs.any_changed }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- id: changed-files
uses: tj-actions/changed-files@v41
with:
files: |
.github/workflows/cypress.yml
src/*
tests/*
cypress-wp-utils.php
.wp-env.json
package.json
package-lock.json
build:
name: Build
needs: changed-files
if: ${{ needs.changed-files.outputs.status == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cache Node
uses: actions/cache@v3
with:
path: |
node_modules
~/.cache
~/.npm
key: ${{ runner.os }}-build-${{ hashFiles('package-lock.json') }}
- name: Cache Build
uses: actions/cache@v3
with:
path: lib
key: ${{ runner.os }}-build-${{ hashFiles('src/**') }}
- name: Install dependencies
run: npm install
- name: Build
run: npm run build
cypress:
name: ${{ matrix.core.name }}
needs: [changed-files, build]
if: ${{ needs.changed-files.outputs.status == 'true' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
core:
- { name: 'WP latest', version: 'latest', number: '6.3' }
- { name: 'WP trunk', version: 'WordPress/WordPress#master', number: '6.3' }
- { name: 'WP minimum', version: 'WordPress/WordPress#5.7', number: '5.7' }
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cache Node
uses: actions/cache@v3
with:
path: |
node_modules
~/.cache
~/.npm
key: ${{ runner.os }}-build-${{ hashFiles('package-lock.json') }}
- name: Cache Build
uses: actions/cache@v3
with:
path: lib
key: ${{ runner.os }}-build-${{ hashFiles('src/**') }}
- name: Set the core version
run: ./tests/bin/set-core-version.js ${{ matrix.core.version }}
- name: Set up WP environment
run: npm run env:start
- name: Test
run: npm run cypress:run
env:
CYPRESS_WORDPRESS_CORE: ${{ matrix.core.number }}
- name: Update summary
run: |
npx mochawesome-merge ./tests/cypress/reports/*.json -o tests/cypress/reports/mochawesome.json
rm -rf ./tests/cypress/reports/mochawesome-*.json
npx mochawesome-json-to-md -p ./tests/cypress/reports/mochawesome.json -o ./tests/cypress/reports/mochawesome.md
npx mochawesome-report-generator tests/cypress/reports/mochawesome.json -o tests/cypress/reports/
cat ./tests/cypress/reports/mochawesome.md >> $GITHUB_STEP_SUMMARY
- name: Make artifacts available
uses: actions/upload-artifact@v3
if: failure()
with:
name: cypress-artifact
retention-days: 2
path: |
${{ github.workspace }}/tests/cypress/screenshots/
${{ github.workspace }}/tests/cypress/videos/
${{ github.workspace }}/tests/cypress/logs/
${{ github.workspace }}/tests/cypress/reports/