forked from facebook/lexical
-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (83 loc) · 3.68 KB
/
call-e2e-test.yml
File metadata and controls
86 lines (83 loc) · 3.68 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
name: Lexical e2e test runner
on:
workflow_call:
inputs:
# Make sure that all of these are present in the name of the actions/upload-artifact@v7 action below
os: {required: true, type: string}
node-version: {required: true, type: string}
browser: {required: true, type: string}
editor-mode: {required: true, type: string}
prod: {required: false, type: boolean}
flaky: {required: false, type: boolean} # Defaults to false: dont run flaky
override-react-version: {required: false, type: string}
permissions: {}
jobs:
e2e-test:
runs-on: ${{ inputs.os }}
continue-on-error: ${{ inputs.flaky }}
if: (inputs.browser != 'webkit' || inputs.os == 'macos-latest')
env:
CI: true
E2E_EDITOR_MODE: ${{ inputs.editor-mode }}
E2E_PORT: 4000
OVERRIDE_REACT_VERSION: ${{ inputs.override-react-version }}
cache_playwright_path: ${{ inputs.os == 'macos-latest' && '~/Library/Caches/ms-playwright' || inputs.os == 'windows-latest' && 'C:\Users\runneradmin\AppData\Local\ms-playwright' || '~/.cache/ms-playwright' }}
test_results_path: 'test-results/'
steps:
- uses: actions/checkout@v6
- uses: pnpm/action-setup@v6
- name: Use Node.js ${{ inputs.node-version }}
uses: actions/setup-node@v6
with:
node-version: ${{ inputs.node-version }}
cache: 'pnpm'
- name: Install required ubuntu-latest packages
if: inputs.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install xvfb
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Install React ${{ inputs.override-react-version }}
if: inputs.override-react-version != ''
run: |
node ./scripts/override-react.mjs --version=${{ inputs.override-react-version }}
grep version node_modules/{react,react-dom}/package.json
- name: Restore playwright from cache
uses: actions/cache/restore@v5
id: playwright-cache
with:
path: ${{ env.cache_playwright_path }}
key: playwright-v2-${{ inputs.node-version }}-${{ runner.os }}-${{ runner.arch }}-v${{ secrets.CACHE_VERSION }}-${{ hashFiles('pnpm-lock.yaml') }}
- name: Install playwright
run: |
pnpm exec playwright install
pnpm exec playwright install --list
- name: Restore build cache
uses: actions/cache/restore@v5
id: build-cache
with:
path: |
packages/lexical-playground/build
packages/*/dist
key: build-${{ inputs.prod && 'prod' || 'dev' }}-v1-${{ github.sha }}
- name: Build
if: steps.build-cache.outputs.cache-hit != 'true'
run: pnpm run ${{ inputs.prod && 'prepare-ci-prod' || 'prepare-ci' }}
- name: Run tests
if: inputs.editor-mode != 'rich-text-with-collab'
run: pnpm run test-e2e-${{ inputs.prod && 'prod-' || '' }}${{ inputs.browser }} --grep-invert "@flaky"
- name: Run collab tests
if: inputs.editor-mode == 'rich-text-with-collab'
shell: bash
run: |
pnpm exec concurrently -k -s first \
"pnpm run collab" \
"pnpm run test-e2e-collab-${{ inputs.prod && 'prod-' || '' }}${{ inputs.browser }} --grep-invert @flaky"
- name: Upload Artifacts
if: failure()
uses: actions/upload-artifact@v7
with:
name: Test Results ${{ inputs.os }}-${{ inputs.browser }}-${{ inputs.editor-mode }}-${{ inputs.prod && 'prod' || 'dev' }}-${{ inputs.node-version }}-${{ inputs.override-react-version }}-${{ inputs.flaky && 'flaky' || ''}}
path: ${{ env.test_results_path }}
retention-days: 7