-
Notifications
You must be signed in to change notification settings - Fork 87
135 lines (121 loc) · 4.23 KB
/
playground-e2e-tests.yml
File metadata and controls
135 lines (121 loc) · 4.23 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: Playground E2E Tests
on:
push:
branches:
- main
paths-ignore:
- "docs/**"
- ".notes/**"
- "*.md"
pull_request:
branches:
- main
paths-ignore:
- "docs/**"
- ".notes/**"
- "*.md"
workflow_dispatch:
inputs:
os:
description: "OS to run on (e.g., ubuntu-latest, macos-latest)"
required: true
type: choice
default: "all"
options:
- all
- ubuntu-latest
- macos-latest
package-manager:
description: "Package manager to use (e.g., pnpm, npm)"
required: true
type: choice
default: "all"
options:
- all
- pnpm
- npm
- yarn
- yarn-classic
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
jobs:
setup-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- id: set-matrix
run: |
if [ "${{ github.event_name }}" == "pull_request" ]; then
echo 'matrix={"include":[{"os":"ubuntu-latest","package-manager":"pnpm"}]}' >> $GITHUB_OUTPUT
elif [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
OS_INPUT=${{ github.event.inputs.os }}
PM_INPUT=${{ github.event.inputs.package-manager }}
[ "$OS_INPUT" == "all" ] && OS_LIST='ubuntu-latest macos-latest' || OS_LIST=$OS_INPUT
[ "$PM_INPUT" == "all" ] && PM_LIST='pnpm npm yarn yarn-classic' || PM_LIST=$PM_INPUT
MATRIX="{\"include\":[]}"
for o in $OS_LIST; do
for p in $PM_LIST; do
MATRIX=$(echo $MATRIX | jq ".include += [{\"os\":\"$o\",\"package-manager\":\"$p\"}]")
done
done
echo "matrix=$MATRIX" >> $GITHUB_OUTPUT
else
echo 'matrix={"include":[{"os":"ubuntu-latest","package-manager":"pnpm"},{"os":"ubuntu-latest","package-manager":"npm"},{"os":"ubuntu-latest","package-manager":"yarn"},{"os":"ubuntu-latest","package-manager":"yarn-classic"},{"os":"macos-latest","package-manager":"pnpm"},{"os":"macos-latest","package-manager":"npm"},{"os":"macos-latest","package-manager":"yarn"},{"os":"macos-latest","package-manager":"yarn-classic"}]}' >> $GITHUB_OUTPUT
fi
playground-e2e:
needs: setup-matrix
name: Playground E2E - ${{ matrix.os }} - ${{ matrix.package-manager }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }}
timeout-minutes: 60
# context(justinvdm, 2025-09-20):
# Only run this job for PRs from the same repository and pushes to main
# For security, GH won't expose secrets for fork PRs
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Install dependencies
shell: bash
run: |
corepack enable
if [ "${{ matrix.package-manager }}" = "yarn" ]; then
corepack prepare yarn@stable --activate
elif [ "${{ matrix.package-manager }}" = "yarn-classic" ]; then
npm i -g yarn@1.22.19 --force
fi
pnpm install
- name: Build SDK
shell: bash
run: |
cd sdk
pnpm build
- name: Run playground E2E tests
shell: bash
run: |
cd playground
pnpm install
../scripts/retry.sh pnpm test:e2e
env:
CI: 1
PACKAGE_MANAGER: ${{ matrix.package-manager }}
- name: Upload playground artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: playground-e2e-artifacts-${{ matrix.os }}-${{ matrix.package-manager }}
path: |
/tmp/*-e2e-test-*
playground/**/node_modules/.cache/wrangler
retention-days: 7