mirror of
https://github.com/dream-num/univer.git
synced 2026-09-19 02:18:42 +08:00
102 lines
3.2 KiB
YAML
102 lines
3.2 KiB
YAML
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
|
|
actions: 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
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
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
|
|
uses: actions/cache@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: 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: 30
|
|
|
|
- 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: ubuntu-latest
|
|
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"
|