-
Notifications
You must be signed in to change notification settings - Fork 15
119 lines (104 loc) · 3.59 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
name: E2E test
on:
push:
branches:
- smoke-testing
pull_request:
types: [ opened, synchronize, reopened, labeled ]
branches:
- trunk
jobs:
e2e:
if: "${{ ( github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'needs: e2e testing') ) || github.event_name == 'push' }}"
name: E2E Test
runs-on: ubuntu-latest
env:
PAYFAST_MERCHANT_ID: ${{secrets.PAYFAST_MERCHANT_ID}}
PAYFAST_MERCHANT_KEY: ${{secrets.PAYFAST_MERCHANT_KEY}}
PAYFAST_PASSPHRASE: ${{secrets.PAYFAST_PASSPHRASE}}
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Node cache
uses: actions/cache@v4
with:
path: |
node_modules
~/.npm
key: node-${{ hashFiles('package-lock.json') }}
- name: Node install
run: npm ci
- name: Build
run: npm run build
- name: Install Playwright Browsers
run: npx playwright install chromium
- name: Set the core version
if: "${{ contains(github.event.pull_request.labels.*.name, 'needs: WP RC test') }}"
id: run-rc-test
run: ./tests/e2e/bin/set-core-version.js WordPress/WordPress#master
- name: Install required WP plugins
run: |
URL_CONFIG="url.https://${{ secrets.BOT_GITHUB_TOKEN }}:[email protected]/.insteadOf [email protected]:"
git config --global $URL_CONFIG
npm run env:install-plugins
git config --global --unset $URL_CONFIG
- name: Setup WP environment
run: npm run env:start
- name: Run E2E Foundational Test
id: payfast_e2e_tests
if: ${{ github.event_name == 'pull_request' }}
run: |
rm -rf ./tests/e2e/test-plugins/woocommerce-subscriptions/tests
npm run test:e2e-foundational
- name: Update Success Label
if: |
always() &&
steps.payfast_e2e_tests.conclusion == 'success'
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: ['needs: e2e testing']
})
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.payfast_e2e_tests.conclusion == 'failure'
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: ['needs: e2e testing']
})
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' }}
run: npm run test:e2e
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: tests/e2e/test-results/report
retention-days: 2