Skip to content

Commit 5b5f669

Browse files
committed
Add full e2e test: define -> implement -> execute workflow
Update the claude-code-e2e job to test the COMPLETE DeepWork workflow: 1. /deepwork_jobs.define - Create a new job from scratch 2. /deepwork_jobs.implement - Generate step instruction files 3. /fruits.identify - Execute the generated identify command 4. /fruits.classify - Execute the generated classify command This tests the actual user experience rather than just validating pre-existing fixtures. The test provides deterministic instructions for creating a 'fruits' job with identify and classify steps.
1 parent 8b2785e commit 5b5f669

1 file changed

Lines changed: 156 additions & 25 deletions

File tree

.github/workflows/claude-code-test.yml

Lines changed: 156 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ concurrency:
2626
cancel-in-progress: true
2727

2828
jobs:
29-
# Job 1: Validate command generation (always runs)
29+
# Job 1: Validate command generation from fixtures (always runs, no API key needed)
3030
validate-generation:
3131
runs-on: ubuntu-latest
3232
steps:
@@ -86,7 +86,8 @@ jobs:
8686
8787
echo "Command generation validated successfully!"
8888
89-
# Job 2: End-to-end test with Claude Code (only when API key is available)
89+
# Job 2: Full end-to-end test with Claude Code
90+
# Tests the COMPLETE workflow: define job -> implement -> execute
9091
claude-code-e2e:
9192
runs-on: ubuntu-latest
9293
needs: validate-generation
@@ -132,91 +133,221 @@ jobs:
132133
if: steps.check-key.outputs.has_key == 'true'
133134
run: uv sync
134135

135-
- name: Set up test project
136+
- name: Set up fresh test project
136137
if: steps.check-key.outputs.has_key == 'true'
137138
run: |
138-
mkdir -p test_project/.deepwork/jobs
139-
mkdir -p test_project/.claude # Required for platform detection
140-
cp -r tests/fixtures/jobs/fruits test_project/.deepwork/jobs/
139+
# Create a fresh project with NO pre-existing job definitions
140+
mkdir -p test_project/.claude
141141
142142
cd test_project
143143
git init
144144
git config user.email "test@test.com"
145145
git config user.name "Test"
146-
echo "# CI Test Project" > README.md
146+
echo "# CI Test Project - DeepWork E2E Test" > README.md
147147
git add . && git commit -m "init"
148148
cd ..
149149
150-
# Run deepwork install to set up the project (this also runs sync)
150+
# Install deepwork (this sets up .deepwork/ with standard jobs only)
151151
uv run deepwork install --platform claude --path test_project
152152
153-
echo "Test project setup complete"
153+
echo "Fresh test project setup complete"
154+
echo "Available commands:"
154155
ls -la test_project/.claude/commands/
155156
156-
- name: Run Claude Code - Identify Step
157+
# STEP 1: Use /deepwork_jobs.define to CREATE the fruits job
158+
- name: Create job with /deepwork_jobs.define
159+
if: steps.check-key.outputs.has_key == 'true'
160+
working-directory: test_project
161+
timeout-minutes: 10
162+
run: |
163+
echo "=== Running /deepwork_jobs.define to create fruits job ==="
164+
165+
# Provide detailed, deterministic instructions for creating the job
166+
claude --yes --print "/deepwork_jobs.define" <<'PROMPT_EOF'
167+
I want to create a simple job called "fruits" for identifying and classifying fruits.
168+
169+
Here are the EXACT specifications - please create the job.yml with these exact details:
170+
171+
Job name: fruits
172+
Version: 1.0.0
173+
Summary: Identify and classify fruits from a mixed list of items
174+
175+
Description: A simple workflow that takes a list of mixed items, identifies which are fruits, then classifies them by category. Designed for CI testing.
176+
177+
Steps:
178+
1. Step ID: identify
179+
Name: Identify Fruits
180+
Description: Filter a list of items to identify only the fruits
181+
Input: raw_items (user parameter) - A comma-separated list of items
182+
Output: identified_fruits.md
183+
Dependencies: none
184+
185+
2. Step ID: classify
186+
Name: Classify Fruits
187+
Description: Organize identified fruits into categories (citrus, tropical, berries, etc.)
188+
Input: identified_fruits.md (file from step identify)
189+
Output: classified_fruits.md
190+
Dependencies: identify
191+
192+
Please create this job definition now. Do not ask questions - use these exact specifications.
193+
PROMPT_EOF
194+
195+
# Verify the job.yml was created
196+
echo "=== Checking job.yml was created ==="
197+
if [ -f ".deepwork/jobs/fruits/job.yml" ]; then
198+
echo "SUCCESS: job.yml created"
199+
cat .deepwork/jobs/fruits/job.yml
200+
else
201+
echo "ERROR: job.yml was not created"
202+
echo "Contents of .deepwork/jobs/:"
203+
ls -la .deepwork/jobs/ || echo "No jobs directory"
204+
exit 1
205+
fi
206+
207+
# STEP 2: Use /deepwork_jobs.implement to generate step instructions
208+
- name: Generate step instructions with /deepwork_jobs.implement
209+
if: steps.check-key.outputs.has_key == 'true'
210+
working-directory: test_project
211+
timeout-minutes: 10
212+
run: |
213+
echo "=== Running /deepwork_jobs.implement to generate step instructions ==="
214+
215+
claude --yes --print "/deepwork_jobs.implement" <<'PROMPT_EOF'
216+
Please implement the "fruits" job that was just defined.
217+
218+
For the identify step, create instructions that:
219+
- Parse the comma-separated raw_items input
220+
- Identify which items are fruits (apple, banana, orange, mango, grape, etc.)
221+
- Output a markdown file listing the identified fruits
222+
223+
For the classify step, create instructions that:
224+
- Read identified_fruits.md from the previous step
225+
- Classify fruits into categories: Citrus (orange, lemon), Tropical (banana, mango), Pome (apple, pear), Berries, etc.
226+
- Output a markdown file with fruits organized by category
227+
228+
Generate the step instruction files now.
229+
PROMPT_EOF
230+
231+
# Verify step files were created
232+
echo "=== Checking step files were created ==="
233+
if [ -f ".deepwork/jobs/fruits/steps/identify.md" ] && [ -f ".deepwork/jobs/fruits/steps/classify.md" ]; then
234+
echo "SUCCESS: Step instruction files created"
235+
echo "--- identify.md ---"
236+
cat .deepwork/jobs/fruits/steps/identify.md
237+
echo ""
238+
echo "--- classify.md ---"
239+
cat .deepwork/jobs/fruits/steps/classify.md
240+
else
241+
echo "ERROR: Step files were not created"
242+
ls -la .deepwork/jobs/fruits/steps/ || echo "No steps directory"
243+
exit 1
244+
fi
245+
246+
# Run sync to generate the slash commands
247+
echo "=== Running deepwork sync to generate commands ==="
248+
cd ..
249+
uv run deepwork sync --path test_project
250+
251+
echo "=== Checking generated commands ==="
252+
ls -la test_project/.claude/commands/
253+
254+
if [ -f "test_project/.claude/commands/fruits.identify.md" ] && [ -f "test_project/.claude/commands/fruits.classify.md" ]; then
255+
echo "SUCCESS: Slash commands generated"
256+
else
257+
echo "ERROR: Slash commands were not generated"
258+
exit 1
259+
fi
260+
261+
# STEP 3: Execute the generated /fruits.identify command
262+
- name: Run /fruits.identify
157263
if: steps.check-key.outputs.has_key == 'true'
158264
working-directory: test_project
159265
timeout-minutes: 5
160266
run: |
161-
# Run the identify step with a deterministic input
162-
# Using --print to output result, --yes to auto-accept
163-
claude --yes --print "/fruits.identify" <<EOF
164-
raw_items: apple, car, banana, chair, orange, table, mango, laptop
165-
EOF
267+
echo "=== Running /fruits.identify with test input ==="
268+
269+
claude --yes --print "/fruits.identify" <<'PROMPT_EOF'
270+
raw_items: apple, car, banana, chair, orange, table, mango, laptop, grape, bicycle
271+
PROMPT_EOF
166272
167273
# Verify output was created
168274
if [ -f "identified_fruits.md" ]; then
169-
echo "Identify step completed successfully!"
275+
echo "SUCCESS: identified_fruits.md created"
170276
echo "--- Output ---"
171277
cat identified_fruits.md
172278
else
173279
echo "ERROR: identified_fruits.md was not created"
174280
exit 1
175281
fi
176282
177-
- name: Run Claude Code - Classify Step
283+
# STEP 4: Execute the generated /fruits.classify command
284+
- name: Run /fruits.classify
178285
if: steps.check-key.outputs.has_key == 'true'
179286
working-directory: test_project
180287
timeout-minutes: 5
181288
run: |
182-
# Run the classify step
289+
echo "=== Running /fruits.classify ==="
290+
183291
claude --yes --print "/fruits.classify"
184292
185293
# Verify output was created
186294
if [ -f "classified_fruits.md" ]; then
187-
echo "Classify step completed successfully!"
295+
echo "SUCCESS: classified_fruits.md created"
188296
echo "--- Output ---"
189297
cat classified_fruits.md
190298
else
191299
echo "ERROR: classified_fruits.md was not created"
192300
exit 1
193301
fi
194302
195-
- name: Validate outputs
303+
# STEP 5: Validate the complete workflow output
304+
- name: Validate complete workflow
196305
if: steps.check-key.outputs.has_key == 'true'
197306
working-directory: test_project
198307
run: |
199-
echo "=== Validating outputs ==="
308+
echo "=== Validating complete workflow ==="
200309
201310
# Check identified_fruits.md contains expected fruits
202311
echo "Checking identified_fruits.md..."
203312
grep -qi "apple" identified_fruits.md || (echo "Missing: apple" && exit 1)
204313
grep -qi "banana" identified_fruits.md || (echo "Missing: banana" && exit 1)
205314
grep -qi "orange" identified_fruits.md || (echo "Missing: orange" && exit 1)
206315
grep -qi "mango" identified_fruits.md || (echo "Missing: mango" && exit 1)
316+
grep -qi "grape" identified_fruits.md || (echo "Missing: grape" && exit 1)
317+
echo " ✓ All expected fruits found in identified_fruits.md"
207318
208319
# Check classified_fruits.md has expected structure
209320
echo "Checking classified_fruits.md..."
210-
grep -qi "citrus\|tropical\|pome" classified_fruits.md || (echo "Missing fruit categories" && exit 1)
211-
212-
echo "All validations passed!"
321+
grep -qi "citrus\|tropical\|pome\|berr" classified_fruits.md || (echo "Missing fruit categories" && exit 1)
322+
echo " ✓ Fruit categories found in classified_fruits.md"
323+
324+
# Verify job structure was created correctly
325+
echo "Checking job structure..."
326+
test -f .deepwork/jobs/fruits/job.yml || (echo "Missing job.yml" && exit 1)
327+
test -f .deepwork/jobs/fruits/steps/identify.md || (echo "Missing identify.md" && exit 1)
328+
test -f .deepwork/jobs/fruits/steps/classify.md || (echo "Missing classify.md" && exit 1)
329+
echo " ✓ Job structure is complete"
330+
331+
echo ""
332+
echo "=========================================="
333+
echo " ALL E2E TESTS PASSED SUCCESSFULLY!"
334+
echo "=========================================="
335+
echo ""
336+
echo "Workflow tested:"
337+
echo " 1. /deepwork_jobs.define - Created job specification"
338+
echo " 2. /deepwork_jobs.implement - Generated step instructions"
339+
echo " 3. /fruits.identify - Executed identify step"
340+
echo " 4. /fruits.classify - Executed classify step"
341+
echo ""
213342
214343
- name: Upload test artifacts
215344
if: steps.check-key.outputs.has_key == 'true' && always()
216345
uses: actions/upload-artifact@v4
217346
with:
218-
name: claude-code-test-outputs
347+
name: claude-code-e2e-outputs
219348
path: |
349+
test_project/.deepwork/jobs/fruits/
350+
test_project/.claude/commands/fruits.*.md
220351
test_project/identified_fruits.md
221352
test_project/classified_fruits.md
222353
retention-days: 7

0 commit comments

Comments
 (0)