-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
109 lines (89 loc) · 3.58 KB
/
Copy pathe2e.yml
File metadata and controls
109 lines (89 loc) · 3.58 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
108
109
name: 🎭 Playwright Tests
on:
pull_request:
branches:
- dev
types:
- opened
- synchronize
- reopened
- ready_for_review
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
pull-requests: write
env:
TURBO_TELEMETRY_DISABLED: '1'
jobs:
e2e-shard:
name: e2e-test shard (${{ matrix.shard-index }}/${{ matrix.shard-total }})
if: github.repository == 'dream-num/univer' && (github.event_name != 'pull_request' || !github.event.pull_request.draft)
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
matrix:
shard-index: [1, 2, 3, 4]
shard-total: [4]
env:
GH_TOKEN: ${{ github.token }}
steps:
- name: Checkout
uses: actions/checkout@v7
with:
persist-credentials: false
- name: Setup Node.js
uses: ./.github/actions/setup-node
- name: Cache Playwright browsers
id: playwright-cache
uses: actions/cache/restore@v6
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ hashFiles('pnpm-lock.yaml') }}
- name: Install Playwright Browsers
run: pnpm exec playwright install --with-deps chromium
- name: Save Playwright browsers
if: matrix.shard-index == 1 && steps.playwright-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v6
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ hashFiles('pnpm-lock.yaml') }}
- name: Build E2E Client
run: pnpm build:e2e
- name: Run Playwright Tests
run: pnpm exec playwright test --shard=${{ matrix.shard-index }}/${{ matrix.shard-total }}
- name: Write Playwright Report to PR Comment
uses: daun/playwright-report-summary@v4
if: always()
with:
report-file: playwright-report.json
custom-info: 'For more information, [see full report and artifacts](https://github.com/dream-num/univer/actions/runs/${{ github.run_id }})'
- name: Upload Artifact
uses: actions/upload-artifact@v7
if: ${{ !cancelled() }}
with:
name: playwright-report-${{ matrix.shard-index }}-of-${{ matrix.shard-total }}
path: playwright-report/
retention-days: 7
- name: Upload HeapSnapshots
uses: actions/upload-artifact@v7
if: ${{ failure() }}
with:
name: snapshots-${{ matrix.shard-index }}-of-${{ matrix.shard-total }}
path: test-results/*.heapsnapshot
retention-days: 3
e2e-test:
name: e2e-test
runs-on: minimum-runner
timeout-minutes: 5
needs: e2e-shard
if: ${{ always() && github.repository == 'dream-num/univer' && (github.event_name != 'pull_request' || !github.event.pull_request.draft) }}
steps:
- name: Check shard results
run: |
if [ "${{ needs.e2e-shard.result }}" != "success" ]; then
echo "One or more e2e shards failed: ${{ needs.e2e-shard.result }}"
exit 1
fi
echo "All e2e shards passed"