-
Notifications
You must be signed in to change notification settings - Fork 231
96 lines (77 loc) · 3.03 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
name: E2E Tests
on:
pull_request:
branches: [main, next]
jobs:
run-tests:
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
node-version: [18.13.0, 20, 22]
isMain:
- ${{ github.base_ref == 'main' }}
exclude:
- isMain: false
node-version: 20
name: e2e/${{ matrix.os }}/node-${{ matrix.node-version}}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Check if only docs changed
id: docs-check
shell: bash
run: |
# Fetch the base branch
git fetch origin ${{ github.event.pull_request.base.ref }}
# Get list of changed files
CHANGED_FILES=$(git diff --name-only origin/${{ github.event.pull_request.base.ref }})
# Check if any changed files are outside sites/docs/
NON_DOCS_CHANGES=$(echo "$CHANGED_FILES" | grep -vE '^sites/docs/' || true)
if [ -z "$NON_DOCS_CHANGES" ]; then
echo "only_docs=true" >> "$GITHUB_OUTPUT"
echo "Skipping e2e tests because only docs were changed."
else
echo "only_docs=false" >> "$GITHUB_OUTPUT"
fi
- name: Set OS environment variable
if: steps.docs-check.outputs.only_docs != 'true'
run: echo "__E2E_WORKFLOW_OS__=${{ matrix.os }}" >> $GITHUB_ENV
- name: Action Setup (pnpm)
if: steps.docs-check.outputs.only_docs != 'true'
uses: pnpm/action-setup@v4
- name: Setup Node
if: steps.docs-check.outputs.only_docs != 'true'
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: pnpm
- name: Install dependencies
if: steps.docs-check.outputs.only_docs != 'true'
run: pnpm install --frozen-lockfile
- name: Install Playwright and browsers
if: steps.docs-check.outputs.only_docs != 'true'
run: pnpm playwright install --with-deps
- name: Run setup
if: steps.docs-check.outputs.only_docs != 'true'
run: pnpm --filter "./e2e/*" run --if-present setup
- name: Run sources
if: steps.docs-check.outputs.only_docs != 'true'
run: pnpm --filter "./e2e/*" run sources
- name: Run dev mode tests
if: steps.docs-check.outputs.only_docs != 'true'
run: pnpm --filter "./e2e/*" --sequential run test:dev
- name: Build
if: steps.docs-check.outputs.only_docs != 'true'
run: pnpm --filter "./e2e/*" run build
- name: Run preview mode tests
if: steps.docs-check.outputs.only_docs != 'true'
run: pnpm --filter "./e2e/*" --sequential run test:preview
- name: Upload Playwright reports
if: always() && steps.docs-check.outputs.only_docs != 'true'
uses: actions/upload-artifact@v4
with:
name: playwright-report__e2e_${{ matrix.os }}_node-${{ matrix.node-version }}
path: e2e/**/playwright-report