Skip to content

Commit deb8b5d

Browse files
committed
another cool codex experiment to reduce action minutes
Signed-off-by: Tyler Slaton <[email protected]>
1 parent f18e190 commit deb8b5d

File tree

1 file changed

+131
-64
lines changed

1 file changed

+131
-64
lines changed

.github/workflows/dojo-e2e.yml

Lines changed: 131 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -7,61 +7,142 @@ on:
77
branches: [main]
88

99
jobs:
10+
changes:
11+
name: Determine suites to run
12+
runs-on: ubuntu-latest
13+
outputs:
14+
matrix: ${{ steps.set-matrix.outputs.matrix }}
15+
should_run: ${{ steps.set-matrix.outputs.should_run }}
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Detect changed areas
23+
id: filter
24+
uses: dorny/paths-filter@v3
25+
with:
26+
filters: |
27+
core_ts:
28+
- 'typescript-sdk/packages/**'
29+
- 'typescript-sdk/package.json'
30+
- 'typescript-sdk/pnpm-lock.yaml'
31+
- 'typescript-sdk/pnpm-workspace.yaml'
32+
- 'typescript-sdk/tsconfig.json'
33+
- 'typescript-sdk/turbo.json'
34+
core_py:
35+
- 'python-sdk/**'
36+
e2e_tests:
37+
- 'typescript-sdk/apps/dojo/e2e/**'
38+
- 'typescript-sdk/apps/dojo/scripts/**'
39+
workflow_self:
40+
- '.github/workflows/dojo-e2e.yml'
41+
agno:
42+
- 'typescript-sdk/integrations/agno/**'
43+
crew_ai:
44+
- 'typescript-sdk/integrations/crewai/**'
45+
langgraph:
46+
- 'typescript-sdk/integrations/langgraph/**'
47+
llama_index:
48+
- 'typescript-sdk/integrations/llamaindex/**'
49+
mastra:
50+
- 'typescript-sdk/integrations/mastra/**'
51+
middleware_starter:
52+
- 'typescript-sdk/integrations/middleware-starter/**'
53+
pydantic_ai:
54+
- 'typescript-sdk/integrations/pydantic-ai/**'
55+
server_starter:
56+
- 'typescript-sdk/integrations/server-starter/**'
57+
server_starter_all:
58+
- 'typescript-sdk/integrations/server-starter-all-features/**'
59+
vercel_ai_sdk:
60+
- 'typescript-sdk/integrations/vercel-ai-sdk/**'
61+
62+
- name: Build dynamic matrix
63+
id: set-matrix
64+
env:
65+
CORE_TS: ${{ steps.filter.outputs.core_ts }}
66+
CORE_PY: ${{ steps.filter.outputs.core_py }}
67+
E2E_TESTS: ${{ steps.filter.outputs.e2e_tests }}
68+
WORKFLOW_SELF: ${{ steps.filter.outputs.workflow_self }}
69+
AGNO: ${{ steps.filter.outputs.agno }}
70+
CREW_AI: ${{ steps.filter.outputs.crew_ai }}
71+
LANGGRAPH: ${{ steps.filter.outputs.langgraph }}
72+
LLAMA_INDEX: ${{ steps.filter.outputs.llama_index }}
73+
MASTRA: ${{ steps.filter.outputs.mastra }}
74+
MIDDLEWARE_STARTER: ${{ steps.filter.outputs.middleware_starter }}
75+
PYDANTIC_AI: ${{ steps.filter.outputs.pydantic_ai }}
76+
SERVER_STARTER: ${{ steps.filter.outputs.server_starter }}
77+
SERVER_STARTER_ALL: ${{ steps.filter.outputs.server_starter_all }}
78+
VERCEL_AI_SDK: ${{ steps.filter.outputs.vercel_ai_sdk }}
79+
run: |
80+
python3 - << 'PY'
81+
import os, json
82+
83+
all_entries = [
84+
{"suite": "agno", "test_path": "tests/agnoTests", "services": ["dojo","agno"], "wait_on": "http://localhost:9999,tcp:localhost:8002"},
85+
{"suite": "crew-ai", "test_path": "tests/crewAITests", "services": ["dojo","crew-ai"], "wait_on": "http://localhost:9999,tcp:localhost:8003"},
86+
{"suite": "langgraph", "test_path": "tests/langgraphTests", "services": ["dojo","langgraph-platform-python","langgraph-platform-typescript"], "wait_on": "http://localhost:9999,tcp:localhost:8005,tcp:localhost:8006"},
87+
{"suite": "langgraph-fastapi", "test_path": "tests/langgraphFastAPITests", "services": ["dojo","langgraph-fastapi"], "wait_on": "http://localhost:9999,tcp:localhost:8004"},
88+
{"suite": "llama-index", "test_path": "tests/llamaIndexTests", "services": ["dojo","llama-index"], "wait_on": "http://localhost:9999,tcp:localhost:8007"},
89+
{"suite": "mastra", "test_path": "tests/mastraTests", "services": ["dojo","mastra"], "wait_on": "http://localhost:9999,tcp:localhost:8008"},
90+
{"suite": "mastra-agent-local", "test_path": "tests/mastraAgentLocalTests", "services": ["dojo"], "wait_on": "http://localhost:9999"},
91+
{"suite": "middleware-starter", "test_path": "tests/middlewareStarterTests", "services": ["dojo"], "wait_on": "http://localhost:9999"},
92+
{"suite": "pydantic-ai", "test_path": "tests/pydanticAITests", "services": ["dojo","pydantic-ai"], "wait_on": "http://localhost:9999,tcp:localhost:8009"},
93+
{"suite": "server-starter", "test_path": "tests/serverStarterTests", "services": ["dojo","server-starter"], "wait_on": "http://localhost:9999,tcp:localhost:8000"},
94+
{"suite": "server-starter-all", "test_path": "tests/serverStarterAllFeaturesTests", "services": ["dojo","server-starter-all"], "wait_on": "http://localhost:9999,tcp:localhost:8001"},
95+
{"suite": "vercel-ai-sdk", "test_path": "tests/vercelAISdkTests", "services": ["dojo"], "wait_on": "http://localhost:9999"},
96+
]
97+
98+
entry_by_suite = {e["suite"]: e for e in all_entries}
99+
core_changed = (
100+
(os.environ.get('CORE_TS') == 'true') or
101+
(os.environ.get('CORE_PY') == 'true') or
102+
(os.environ.get('E2E_TESTS') == 'true') or
103+
(os.environ.get('WORKFLOW_SELF') == 'true')
104+
)
105+
106+
include = []
107+
if core_changed:
108+
include = all_entries
109+
else:
110+
if os.environ.get('AGNO') == 'true':
111+
include.append(entry_by_suite['agno'])
112+
if os.environ.get('CREW_AI') == 'true':
113+
include.append(entry_by_suite['crew-ai'])
114+
if os.environ.get('LANGGRAPH') == 'true':
115+
include.append(entry_by_suite['langgraph'])
116+
include.append(entry_by_suite['langgraph-fastapi'])
117+
if os.environ.get('LLAMA_INDEX') == 'true':
118+
include.append(entry_by_suite['llama-index'])
119+
if os.environ.get('MASTRA') == 'true':
120+
include.append(entry_by_suite['mastra'])
121+
include.append(entry_by_suite['mastra-agent-local'])
122+
if os.environ.get('MIDDLEWARE_STARTER') == 'true':
123+
include.append(entry_by_suite['middleware-starter'])
124+
if os.environ.get('PYDANTIC_AI') == 'true':
125+
include.append(entry_by_suite['pydantic-ai'])
126+
if os.environ.get('SERVER_STARTER') == 'true':
127+
include.append(entry_by_suite['server-starter'])
128+
if os.environ.get('SERVER_STARTER_ALL') == 'true':
129+
include.append(entry_by_suite['server-starter-all'])
130+
if os.environ.get('VERCEL_AI_SDK') == 'true':
131+
include.append(entry_by_suite['vercel-ai-sdk'])
132+
133+
matrix = {"include": include}
134+
with open(os.environ['GITHUB_OUTPUT'], 'a') as fh:
135+
fh.write(f"matrix={json.dumps(matrix)}\n")
136+
fh.write(f"should_run={'true' if include else 'false'}\n")
137+
PY
10138
e2e:
139+
needs: changes
140+
if: ${{ needs.changes.outputs.should_run == 'true' }}
11141
name: ${{ matrix.suite }}
12142
runs-on: depot-ubuntu-24.04
13143
strategy:
14144
fail-fast: false
15-
matrix:
16-
include:
17-
- suite: agno
18-
test_path: tests/agnoTests
19-
services: ["dojo","agno"]
20-
wait_on: "http://localhost:9999,tcp:localhost:8002"
21-
- suite: crew-ai
22-
test_path: tests/crewAITests
23-
services: ["dojo","crew-ai"]
24-
wait_on: "http://localhost:9999,tcp:localhost:8003"
25-
- suite: langgraph
26-
test_path: tests/langgraphTests
27-
services: ["dojo","langgraph-platform-python","langgraph-platform-typescript"]
28-
wait_on: "http://localhost:9999,tcp:localhost:8005,tcp:localhost:8006"
29-
- suite: langgraph-fastapi
30-
test_path: tests/langgraphFastAPITests
31-
services: ["dojo","langgraph-fastapi"]
32-
wait_on: "http://localhost:9999,tcp:localhost:8004"
33-
- suite: llama-index
34-
test_path: tests/llamaIndexTests
35-
services: ["dojo","llama-index"]
36-
wait_on: "http://localhost:9999,tcp:localhost:8007"
37-
- suite: mastra
38-
test_path: tests/mastraTests
39-
services: ["dojo","mastra"]
40-
wait_on: "http://localhost:9999,tcp:localhost:8008"
41-
- suite: mastra-agent-local
42-
test_path: tests/mastraAgentLocalTests
43-
services: ["dojo"]
44-
wait_on: "http://localhost:9999"
45-
- suite: middleware-starter
46-
test_path: tests/middlewareStarterTests
47-
services: ["dojo"]
48-
wait_on: "http://localhost:9999"
49-
- suite: pydantic-ai
50-
test_path: tests/pydanticAITests
51-
services: ["dojo","pydantic-ai"]
52-
wait_on: "http://localhost:9999,tcp:localhost:8009"
53-
- suite: server-starter
54-
test_path: tests/serverStarterTests
55-
services: ["dojo","server-starter"]
56-
wait_on: "http://localhost:9999,tcp:localhost:8000"
57-
- suite: server-starter-all
58-
test_path: tests/serverStarterAllFeaturesTests
59-
services: ["dojo","server-starter-all"]
60-
wait_on: "http://localhost:9999,tcp:localhost:8001"
61-
- suite: vercel-ai-sdk
62-
test_path: tests/vercelAISdkTests
63-
services: ["dojo"]
64-
wait_on: "http://localhost:9999"
145+
matrix: ${{ fromJSON(needs.changes.outputs.matrix) }}
65146

66147
steps:
67148
- name: Checkout code
@@ -128,20 +209,6 @@ jobs:
128209
run: |
129210
pnpm install
130211
131-
# Cache Playwright browsers to avoid re-downloading on each run
132-
- name: Cache Playwright browsers
133-
uses: actions/cache@v4
134-
with:
135-
path: ~/.cache/ms-playwright
136-
key: ${{ runner.os }}-ms-playwright-${{ hashFiles('typescript-sdk/apps/dojo/e2e/package.json') }}
137-
restore-keys: |
138-
${{ runner.os }}-ms-playwright-
139-
140-
- name: Install Playwright browsers
141-
working-directory: typescript-sdk/apps/dojo/e2e
142-
run: |
143-
pnpm exec playwright install --with-deps
144-
145212
- name: write langgraph env files
146213
working-directory: typescript-sdk/integrations/langgraph
147214
env:

0 commit comments

Comments
 (0)