-
Notifications
You must be signed in to change notification settings - Fork 1
126 lines (110 loc) · 4.14 KB
/
e2e-tests.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
name: E2E Tests
on:
push:
branches:
- main
pull_request:
# Cancels all previous workflow runs for the same branch that have not yet completed.
concurrency:
# The concurrency group contains the workflow name and the branch name.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions: {}
jobs:
e2e-tests:
name: E2E Tests (${{ matrix.wp }}${{ matrix.gb && ' + GB ' }}) (${{ matrix.shard }})
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental == true }}
strategy:
fail-fast: false
matrix:
wp: ['latest']
shard: ['1/4', '2/4', '3/4', '4/4']
experimental: [false]
include:
- wp: 'trunk'
shard: '1/4'
experimental: true
- wp: 'trunk'
shard: '2/4'
experimental: true
- wp: 'trunk'
shard: '3/4'
experimental: true
- wp: 'trunk'
shard: '4/4'
experimental: true
- wp: 'trunk'
gb: true
shard: '1/4'
experimental: true
- wp: 'trunk'
gb: true
shard: '2/4'
experimental: true
- wp: 'trunk'
gb: true
shard: '3/4'
experimental: true
- wp: 'trunk'
gb: true
shard: '4/4'
experimental: true
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: npm
- name: Install dependencies
run: npm ci
- name: Install Playwright browsers
run: npx playwright install --with-deps
- name: Build plugin
run: npm run build
env:
WP_DEVTOOL: source-map
# To get CSS source maps
NODE_ENV: development
- name: Start server
run: |
if [[ $WP_VERSION == 'trunk' ]]; then
echo "Using WordPress trunk"
echo "{\"core\":\"WordPress/WordPress#master\"}" >> .wp-env.override.json
fi
chmod -R 767 ./
npm run wp-env start
if [[ $GUTENBERG != 'true' ]]; then
echo "Deactivating Gutenberg plugin"
npm run wp-env --silent -- run tests-cli wp plugin deactivate gutenberg
fi
env:
WP_VERSION: ${{ matrix.wp }}
GUTENBERG: ${{ matrix.gb == 'true' }}
- name: Run tests
run: |
npm run test:e2e -- --shard=${{ matrix.shard }}
env:
COLLECT_COVERAGE: ${{ matrix.wp == 'latest' }}
- name: Upload code coverage report
uses: codecov/[email protected]
with:
file: artifacts/e2e-coverage/coverage/codecov.json
flags: e2e
token: ${{ secrets.CODECOV_TOKEN }}
if: ${{ matrix.wp == 'latest' }}
- name: Get debug artifact name
if: always()
run: |
ARTIFACT_NAME=${ARTIFACT_NAME//\//-}
echo "ARTIFACT_NAME=${ARTIFACT_NAME}" >> $GITHUB_ENV
env:
ARTIFACT_NAME: failures-artifacts-${{ matrix.wp }}${{ matrix.gb && '-gb' }}-${{ matrix.shard }}
- name: Archive debug artifacts (screenshots, HTML snapshots)
uses: actions/upload-artifact@v4
if: always()
with:
name: ${{ env.ARTIFACT_NAME }}
path: artifacts