-
Notifications
You must be signed in to change notification settings - Fork 1
101 lines (86 loc) · 3.6 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
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.shard }})'
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental == true }}
strategy:
fail-fast: false
matrix:
wp: ['trunk']
shard: ['1/4', '2/4', '3/4', '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
- name: Configure WordPress version
run: |
if [[ $WP_VERSION == 'trunk' ]]; then
echo "Using WordPress trunk"
echo "{\"core\":\"WordPress/WordPress#master\"}" >> .wp-env.override.json
fi
env:
WP_VERSION: ${{ matrix.wp }}
- name: Install WordPress
run: |
chmod -R 767 ./ # TODO: Possibly integrate in wp-env
npm run wp-env start
# Ensure the wp-content/languages folder exists and is writable.
# See https://github.com/WordPress/gutenberg/issues/22515
# and https://github.com/WordPress/gutenberg/tree/trunk/packages/env#installing-a-plugin-or-theme-on-the-development-instance
- name: Prepare tests
run: |
WP_ENV_DIR=$(npm run wp-env install-path --silent 2>&1 | head -1)
cd $WP_ENV_DIR
mkdir -p tests-WordPress/wp-content/languages tests-WordPress/wp-content/upgrade
chmod -R 767 tests-WordPress/wp-content/languages tests-WordPress/wp-content/upgrade
docker-compose run --rm -u $(id -u) -e HOME=/tmp tests-cli wp language core install de_CH de_DE es_ES fr_FR it_IT
cd -
- name: Run tests
run: npm run test:e2e -- --shard=${{ matrix.shard }}
env:
COLLECT_COVERAGE: ${{ matrix.wp == 'trunk' }}
- name: Upload code coverage report
uses: codecov/[email protected]
with:
file: artifacts/e2e-coverage/coverage/lcov.info
flags: e2e
token: ${{ secrets.CODECOV_TOKEN }}
if: ${{ matrix.wp == 'trunk' }}
- name: Get artifact name
if: always()
run: |
ARTIFACT_NAME=${ARTIFACT_NAME//\//-}
echo "ARTIFACT_NAME=${ARTIFACT_NAME}" >> $GITHUB_ENV
env:
ARTIFACT_NAME: failures-artifacts-${{ matrix.wp }}-${{ matrix.shard }}
- name: Archive debug artifacts (screenshots, HTML snapshots)
uses: actions/upload-artifact@v4
if: always()
with:
name: ${{ env.ARTIFACT_NAME }}
path: artifacts