-
Notifications
You must be signed in to change notification settings - Fork 157
140 lines (120 loc) · 3.9 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: E2E Tests
on:
push:
branches:
- develop
- trunk
pull_request:
branches:
- develop
jobs:
build:
name: NPM Install
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use desired version of NodeJS
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Cache Node
uses: actions/cache@v4
with:
path: |
node_modules
~/.cache
~/.npm
key: ${{ hashFiles('package-lock.json') }}
- name: Install dependencies
run: npm install
cypress:
name: ${{ matrix.core.name }} / ${{ matrix.php.name }}
needs: [build]
## Pending upgrade of `@wordpress/env` package.
continue-on-error: ${{ matrix.core.version == 'WordPress/WordPress#master' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php:
- {name: 'PHP Default', version: null}
core:
- {name: 'WP stable', version: 'latest'}
- {name: 'WP minimum', version: 'WordPress/WordPress#6.5'}
- {name: 'WP trunk', version: 'WordPress/WordPress#master'}
include:
- php: {name: 'PHP 7.4', version: '7.4'}
core: {name: 'WP minimum', version: 'WordPress/WordPress#6.5'}
- php: {name: 'PHP 8.1', version: '8.1'}
core: {name: 'WP stable', version: 'latest'}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use desired version of NodeJS
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Check versions
run: npm -v; node -v
- name: Cache Node
uses: actions/cache@v4
with:
path: |
node_modules
~/.cache
~/.npm
key: ${{ hashFiles('package-lock.json') }}
- name: Install dependencies
run: npm install
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
id: cache-composer
uses: actions/cache@v4
env:
cache-name: cache-composer
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/composer.lock') }}
- name: Set PHP version
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php.version }}
coverage: none
tools: composer:v2
- name: Composer install
run: composer install
- name: Build
run: npm run build
- name: Set the core version
run: |
./tests/bin/set-core-version.js ${{ matrix.core.version }} ${{ matrix.php.version }}
- name: Set up WP environment
run: npm run env:start
- name: Log WP environment versions
run: |
npm run env run cli -- wp core version
npm run env run cli -- php --version
- name: Test
run: npm run cypress:run
- name: Update summary
if: always()
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@v4
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/