-
Notifications
You must be signed in to change notification settings - Fork 237
153 lines (136 loc) · 5.41 KB
/
e2e-community-world.yml
File metadata and controls
153 lines (136 loc) · 5.41 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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# Reusable workflow for running E2E tests against a community world
# Supports optional service containers (mongodb, redis) via service-type input
# Called by tests.yml with specific world configuration
name: E2E Community World
on:
workflow_call:
inputs:
world-id:
description: 'World identifier (turso, mongodb, etc.)'
required: true
type: string
world-name:
description: 'Display name for the world'
required: true
type: string
world-package:
description: 'NPM package name for the world'
required: true
type: string
app-name:
description: 'App to test (default: nextjs-turbopack)'
required: false
type: string
default: 'nextjs-turbopack'
env-vars:
description: 'JSON object of environment variables to set'
required: false
type: string
default: '{}'
service-type:
description: 'Service container to run (none, mongodb, redis)'
required: false
type: string
default: 'none'
setup-command:
description: 'Setup command to run after installing the world package'
required: false
type: string
default: ''
jobs:
e2e:
name: E2E ${{ inputs.world-name }}
runs-on: ubuntu-latest
continue-on-error: true
timeout-minutes: 30
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
WORKFLOW_PUBLIC_MANIFEST: '1'
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Start MongoDB
if: ${{ inputs.service-type == 'mongodb' }}
run: |
docker run -d --name mongodb -p 27017:27017 mongo:7
echo "Waiting for MongoDB to be ready..."
for i in {1..30}; do
if docker exec mongodb mongosh --eval 'db.runCommand({ ping: 1 })' &>/dev/null; then
echo "MongoDB is ready"
break
fi
sleep 2
done
- name: Start Redis
if: ${{ inputs.service-type == 'redis' }}
run: |
docker run -d --name redis -p 6379:6379 redis:7-alpine
echo "Waiting for Redis to be ready..."
for i in {1..30}; do
if docker exec redis redis-cli ping | grep -q PONG; then
echo "Redis is ready"
break
fi
sleep 2
done
- name: Start SurrealDB
if: ${{ inputs.service-type == 'surrealdb' }}
run: |
docker run -d --name surrealdb -p 8000:8000 \
surrealdb/surrealdb:v3 \
start --user root --pass root --bind 0.0.0.0:8000 memory
echo "Waiting for SurrealDB to be ready..."
for i in {1..30}; do
if curl -sf http://localhost:8000/health &>/dev/null; then
echo "SurrealDB is ready"
break
fi
sleep 2
done
- name: Setup environment
uses: ./.github/actions/setup-workflow-dev
with:
build-packages: 'true'
- name: Install ${{ inputs.world-name }} World
run: pnpm --filter ${{ inputs.app-name }} add ${{ inputs.world-package }}
- name: Run setup command
if: ${{ inputs.setup-command != '' }}
run: ${{ inputs.setup-command }}
working-directory: workbench/${{ inputs.app-name }}
- name: Resolve symlinks
run: ./scripts/resolve-symlinks.sh workbench/${{ inputs.app-name }}
- name: Set environment variables
run: |
echo '${{ inputs.env-vars }}' | jq -r 'to_entries[] | "\(.key)=\(.value)"' >> $GITHUB_ENV
- name: Run E2E Tests
run: |
cd workbench/${{ inputs.app-name }} && pnpm dev &
echo "Waiting for dev server to start..." && sleep 15
pnpm vitest run packages/core/e2e/dev.test.ts --reporter=default --reporter=json --reporter=./packages/core/e2e/github-reporter.ts --outputFile=e2e-community-${{ inputs.world-id }}-dev.json || true
sleep 10
pnpm vitest run packages/core/e2e/e2e.test.ts --reporter=default --reporter=json --reporter=./packages/core/e2e/github-reporter.ts --outputFile=e2e-community-${{ inputs.world-id }}.json || true
env:
NODE_OPTIONS: "--enable-source-maps"
APP_NAME: ${{ inputs.app-name }}
DEPLOYMENT_URL: "http://localhost:3000"
DEV_TEST_CONFIG: '{"name":"${{ inputs.app-name }}","project":"workbench-${{ inputs.app-name }}-workflow","generatedStepPath":"app/.well-known/workflow/v1/step/route.js","generatedWorkflowPath":"app/.well-known/workflow/v1/flow/route.js","apiFilePath":"app/api/chat/route.ts","apiFileImportPath":"../../.."}'
- name: Generate E2E summary
if: always()
run: node .github/scripts/aggregate-e2e-results.js . --job-name "E2E Tests (${{ inputs.world-name }})" >> $GITHUB_STEP_SUMMARY || true
- name: Upload E2E results
uses: actions/upload-artifact@v4
if: always()
with:
name: e2e-results-community-${{ inputs.world-id }}
path: |
e2e-community-${{ inputs.world-id }}-dev.json
e2e-community-${{ inputs.world-id }}.json
retention-days: 7
if-no-files-found: ignore
- name: Stop services
if: always()
run: |
docker stop mongodb 2>/dev/null || true
docker stop redis 2>/dev/null || true
docker stop surrealdb 2>/dev/null || true