-
Notifications
You must be signed in to change notification settings - Fork 10
139 lines (122 loc) · 4.74 KB
/
e2e.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
name: Run E2E tests
on:
push:
branches:
- smoke-testing
pull_request:
types: [opened, synchronize, reopened]
branches:
- trunk
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
e2e:
if: "${{ ( github.event_name == 'pull_request' ) || github.event_name == 'push' }}"
runs-on: ubuntu-latest
strategy:
matrix:
type: [ '@general', '@cashapp', '@sync', '@giftcard' ]
env:
WP_ADMIN_USERNAME: ${{ secrets.WP_ADMIN_USERNAME }}
WP_ADMIN_PASSWORD: ${{ secrets.WP_ADMIN_PASSWORD }}
SQUARE_APPLICATION_ID: ${{ secrets.SQUARE_APPLICATION_ID }}
SQUARE_ACCESS_TOKEN: ${{ secrets.SQUARE_ACCESS_TOKEN }}
SQUARE_LOCATION_ID: ${{ secrets.SQUARE_LOCATION_ID }}
GH_TOKEN: ${{ secrets.BOT_GH_TOKEN }}
permissions:
pull-requests: write
name: E2E tests (${{ matrix.type }})
steps:
- uses: actions/checkout@v3
- uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
tools: composer:v2
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- name: Install Node dependencies
run: npm ci && npm run build
- name: Install playwright
run: npx playwright install
# Use compiled versions to avoid need for npm and composer installation and build step.
- name: Install required WP plugins
run: |
gh release download --repo woocommerce/woocommerce-pre-orders --pattern woocommerce-pre-orders.zip --dir ./test-plugins
gh release download --repo woocommerce/woocommerce-subscriptions --pattern woocommerce-subscriptions.zip --dir ./test-plugins
cd ./test-plugins
unzip -o woocommerce-pre-orders.zip
unzip -o woocommerce-subscriptions.zip
cd ..
- name: Set the core version
if: "${{ contains(github.event.pull_request.labels.*.name, 'needs: WP RC test') }}"
id: run-rc-test
run: ./tests/bin/set-core-version.js WordPress/WordPress#master
- name: Setup E2E environment
run: npm run env:start
- name: Run E2E tests
id: square_e2e_tests
if: ${{ github.event_name == 'pull_request' && matrix.type != '@general' }}
run: npm run test:e2e -- --grep ${{ matrix.type }}
- name: Run E2E tests (General)
id: square_e2e_tests_general
if: ${{ github.event_name == 'pull_request' && matrix.type == '@general' }}
run: npm run test:e2e -- --grep-invert "@cashapp|@sync|@giftcard"
- name: Remove existing labels
uses: actions/github-script@v6
continue-on-error: true
with:
script: |
github.rest.issues.removeLabel({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
name: ['status: e2e tests passing']
})
github.rest.issues.removeLabel({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
name: ['status: e2e tests failing']
})
- name: Update Success Label
if: |
always() &&
( steps.square_e2e_tests.conclusion == 'success' || steps.square_e2e_tests_general.conclusion == 'success' )
uses: actions/github-script@v6
continue-on-error: true
with:
script: |
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['status: e2e tests passing']
})
- name: Update Failure Label
if: |
always() &&
( steps.square_e2e_tests.conclusion == 'failure' || steps.square_e2e_tests_general.conclusion == 'failure' )
uses: actions/github-script@v6
continue-on-error: true
with:
script: |
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['status: e2e tests failing']
})
- name: Run E2E Smoke Test
if: ${{ github.event_name == 'push' && matrix.type != '@general' }}
run: npm run test:e2e -- --grep ${{ matrix.type }}
- name: Run E2E Smoke Test (General)
if: ${{ github.event_name == 'push' && matrix.type == '@general' }}
run: npm run test:e2e -- --grep-invert "@cashapp|@sync|@giftcard"
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report-${{ matrix.type }}
path: tests/e2e/test-results/report
retention-days: 2