-
Notifications
You must be signed in to change notification settings - Fork 206
97 lines (79 loc) · 2.51 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
name: E2E tests
on:
pull_request
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 10
matrix:
checkout: [ 'Default', 'Legacy' ]
name: ${{ matrix.checkout }} WP=latest, WC=latest, PHP=7.4
steps:
- name: Checkout repo
uses: actions/checkout@v4
# PHP
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
tools: composer
coverage: none
- name: Cache Composer deps
id: composer-cache
uses: actions/cache@v4
with:
path: ./vendor
key: ${{ runner.os }}-vendor-${{ hashFiles('composer.lock') }}
- name: Install composer dependencies
if: ${{ steps.composer-cache.outputs.cache-hit == false }}
shell: bash
run: composer install --no-progress
# Node
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Cache Node deps
id: node-cache
uses: actions/cache@v4
with:
path: |
./node_modules
~/.cache/ms-playwright
key: ${{ runner.os }}-node_modules-${{ hashFiles('package-lock.json') }}
- name: Install node dependencies
if: ${{ steps.node-cache.outputs.cache-hit == false }}
shell: bash
run: npm ci
# Build
- name: Build plugin package
shell: bash
run: |
npm run build
# E2E test environment
- name: Prepare test environment
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.E2E_GH_TOKEN }}
STRIPE_PUB_KEY: ${{ secrets.E2E_STRIPE_PUBLISHABLE_KEY }}
STRIPE_SECRET_KEY: ${{ secrets.E2E_STRIPE_SECRET_KEY }}
run: npm run test:e2e-setup
- name: Run ${{ matrix.checkout }} E2E tests
shell: bash
env:
STRIPE_PUB_KEY: ${{ secrets.E2E_STRIPE_PUBLISHABLE_KEY }}
STRIPE_SECRET_KEY: ${{ secrets.E2E_STRIPE_SECRET_KEY }}
run: npm run test:e2e${{ matrix.checkout == 'Legacy' && '-legacy' || '' }}
- name: Upload ${{ matrix.checkout }} E2E test results
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.checkout }}-WP_latest-WC_latest-results
path: tests/e2e/test-results
if-no-files-found: ignore
retention-days: 14