-
Notifications
You must be signed in to change notification settings - Fork 67
107 lines (103 loc) · 3.83 KB
/
Copy pathe2e-tests.yml
File metadata and controls
107 lines (103 loc) · 3.83 KB
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
name: E2E Tests
on:
push:
branches: [ master, develop ]
pull_request:
branches: [ master, develop ]
# One run per PR or branch. A new push cancels the previous run.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
cache: npm
cache-dependency-path: package-lock.json
- name: Build Stackable Free Plugin
run: |
npm ci --legacy-peer-deps
npm run build:e2e
- name: Archive plugin build
run: tar --exclude=./node_modules --exclude=./.git -czf /tmp/stackable-e2e-build.tar.gz .
- uses: actions/upload-artifact@v4
with:
name: stackable-e2e-build
path: /tmp/stackable-e2e-build.tar.gz
retention-days: 1
test:
needs: build
timeout-minutes: 60
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
# stackable-playwright-matrix-start
- php_version: '8.5'
wp_version: '7.0'
- php_version: '7.4'
wp_version: '6.8'
# stackable-playwright-matrix-end
name: Free e2e PHP ${{ matrix.php_version }} WP ${{ matrix.wp_version }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
cache: npm
cache-dependency-path: package-lock.json
- name: Restore plugin build
uses: actions/download-artifact@v4
with:
name: stackable-e2e-build
- name: Extract plugin build
run: tar -xzf stackable-e2e-build.tar.gz
- name: Install dependencies
run: npm ci --legacy-peer-deps
- name: Set the version suffix for the output
run: echo VERSION_SUFFIX=${GITHUB_REF_NAME//\//-} >> $GITHUB_ENV
- name: Cache Playwright Browsers
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-playwright-
- name: Install Playwright Browsers
timeout-minutes: 15
run: |
for attempt in 1 2 3; do
npx playwright install chromium --with-deps && exit 0
echo "Playwright install failed on attempt $attempt"
sleep $((attempt * 30))
done
exit 1
- name: Run free Playwright e2e suite
id: run-playwright-tests
env:
WP_PHP_VERSION: ${{ matrix.php_version }}
WP_VERSION: ${{ matrix.wp_version }}
run: npm run test:e2e
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() && steps.run-playwright-tests.outcome == 'failure' }}
id: artifact-upload-step
with:
name: playwright-report-php_${{ matrix.php_version }}-wp_${{ matrix.wp_version }}-${{ env.VERSION_SUFFIX }}
path: playwright-report/
overwrite: true
retention-days: 30
- uses: markpatterson27/markdown-to-output@v1
id: mto
if: ${{ !cancelled() && steps.run-playwright-tests.outcome == 'failure' }}
with:
filepath: ./playwright-stk/errors.md
- name: Add test results to summary
if: ${{ !cancelled() && steps.run-playwright-tests.outcome == 'failure' }}
run: |
echo "${{ steps.mto.outputs.body }}" >> $GITHUB_STEP_SUMMARY
echo "Report: [playwright-report-php_${{ matrix.php_version }}-wp_${{ matrix.wp_version }}-${{ env.VERSION_SUFFIX }}.zip](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts/${{ steps.artifact-upload-step.outputs.artifact-id }})" >> $GITHUB_STEP_SUMMARY