feat: add Jupyter notebook with e2e operations examples #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: E2E Notebook Tests | |
| on: | |
| pull_request: | |
| branches: [ main ] | |
| paths: | |
| - 'examples/**' | |
| - 'src/**' | |
| - 'tests/fixtures/**' | |
| - '.github/workflows/e2e-notebook.yml' | |
| workflow_dispatch: | |
| jobs: | |
| test-notebook-operations: | |
| name: Test E2E Notebook Operations | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js 22 | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Start Camunda 8.8 with Docker Compose | |
| run: | | |
| cd assets/c8/8.8 | |
| DATABASE=elasticsearch docker compose --profile elasticsearch up -d | |
| env: | |
| DATABASE: elasticsearch | |
| - name: Wait for Camunda to be ready | |
| run: | | |
| echo "Waiting for Camunda at localhost:8080..." | |
| # First wait for topology endpoint | |
| for i in {1..60}; do | |
| if curl -s -f -u demo:demo http://localhost:8080/v2/topology > /dev/null; then | |
| echo "Topology endpoint is ready!" | |
| break | |
| fi | |
| echo "Attempt $i: Topology not ready yet, waiting..." | |
| sleep 5 | |
| done | |
| # Then wait an additional 30 seconds for broker to fully initialize | |
| echo "Waiting additional time for broker to initialize..." | |
| sleep 30 | |
| # Verify we can actually deploy | |
| echo "Testing deployment capability..." | |
| for i in {1..30}; do | |
| if curl -s -u demo:demo http://localhost:8080/v2/topology | grep -q '"health":"healthy"'; then | |
| echo "Broker is healthy, ready for operations!" | |
| exit 0 | |
| fi | |
| echo "Attempt $i: Broker not fully ready, waiting..." | |
| sleep 2 | |
| done | |
| echo "Camunda may not be fully ready, but continuing with tests..." | |
| - name: Test - Check Version | |
| run: node src/index.ts --version | |
| - name: Test - Get Topology | |
| run: node src/index.ts get topology | |
| - name: Test - Add and Use Profile | |
| run: | | |
| node src/index.ts add profile local --baseUrl=http://localhost:8080 || true | |
| node src/index.ts use profile local | |
| node src/index.ts list profiles | |
| - name: Test - Deploy Simple Process | |
| run: node src/index.ts deploy tests/fixtures/simple.bpmn | |
| - name: Test - Deploy Building Block Process | |
| run: node src/index.ts deploy tests/fixtures/_bb-building-block/bb-process.bpmn | |
| - name: Test - Deploy Sample Project Directory | |
| run: node src/index.ts deploy tests/fixtures/sample-project | |
| - name: Test - Create Process Instance | |
| run: | | |
| OUTPUT=$(node src/index.ts create pi --bpmnProcessId=simple-process) | |
| echo "$OUTPUT" | |
| echo "$OUTPUT" | grep -q "Key:" | |
| - name: Test - Create Process Instance with Variables | |
| run: | | |
| OUTPUT=$(node src/index.ts create pi --bpmnProcessId=simple-process --variables='{"orderId":"12345","amount":100.50}') | |
| echo "$OUTPUT" | |
| echo "$OUTPUT" | grep -q "Key:" | |
| - name: Test - List Process Instances | |
| run: node src/index.ts list pi | |
| - name: Test - Filter Process Instances by BPMN Process ID | |
| run: node src/index.ts list pi --bpmnProcessId=simple-process | |
| - name: Test - Deploy Process with User Task | |
| run: node src/index.ts deploy tests/fixtures/list-pis/min-usertask.bpmn | |
| - name: Test - Create Process Instance with User Task | |
| run: | | |
| OUTPUT=$(node src/index.ts create pi --bpmnProcessId=Process_0t60ay7) | |
| echo "$OUTPUT" | |
| echo "$OUTPUT" | grep -q "Key:" | |
| - name: Test - Wait for User Task | |
| run: sleep 5 | |
| - name: Test - List User Tasks | |
| run: node src/index.ts list ut | |
| - name: Test - Complete User Task (if any exists) | |
| run: | | |
| # Try to get a user task key | |
| OUTPUT=$(node src/index.ts list ut) | |
| echo "$OUTPUT" | |
| # Extract first user task key if any exists (13+ digits) | |
| KEY=$(echo "$OUTPUT" | grep -oP '^\s*\K\d{13,}' | head -1 || true) | |
| if [ -n "$KEY" ]; then | |
| echo "Completing user task: $KEY" | |
| node src/index.ts complete ut $KEY --variables='{"approved":true,"notes":"Approved via CI"}' | |
| else | |
| echo "No user tasks to complete (expected if process completed instantly)" | |
| fi | |
| - name: Test - Run Command (Deploy + Create) | |
| run: node src/index.ts run tests/fixtures/simple.bpmn --variables='{"testRun":true}' | |
| - name: Test - Publish Message | |
| run: node src/index.ts publish msg order-placed --correlationKey=order-12345 --variables='{"status":"completed"}' | |
| - name: Test - Correlate Message with TTL | |
| run: node src/index.ts correlate msg payment-received --correlationKey=order-67890 --timeToLive=60000 | |
| - name: Test - List Incidents | |
| run: node src/index.ts list inc | |
| - name: Test - List Jobs | |
| run: node src/index.ts list jobs | |
| - name: Test - List Plugins | |
| run: node src/index.ts list plugins | |
| - name: Test - Output Mode Switching | |
| run: | | |
| node src/index.ts output json | |
| node src/index.ts output text | |
| - name: Test - Complete E2E Workflow | |
| run: | | |
| echo "=== Complete E2E Workflow Test ===" | |
| # Deploy | |
| echo "Step 1: Deploying..." | |
| node src/index.ts deploy tests/fixtures/simple.bpmn | |
| # Create instance with variables | |
| echo "Step 2: Creating instance..." | |
| OUTPUT=$(node src/index.ts create pi --bpmnProcessId=simple-process --variables='{"e2e":true,"timestamp":"2024-01-01T00:00:00Z"}') | |
| echo "$OUTPUT" | |
| KEY=$(echo "$OUTPUT" | grep -oP 'Key: \K\d+' || true) | |
| # List instances | |
| echo "Step 3: Listing instances..." | |
| node src/index.ts list pi --bpmnProcessId=simple-process | |
| # Get specific instance if key was captured | |
| if [ -n "$KEY" ]; then | |
| echo "Step 4: Getting instance $KEY..." | |
| node src/index.ts get pi $KEY || echo "Process may have completed" | |
| fi | |
| echo "✅ E2E workflow test completed!" | |
| - name: Verify All Operations Succeeded | |
| run: | | |
| echo "✅ All notebook operations tested successfully!" | |
| echo "" | |
| echo "The following operations were verified:" | |
| echo " - Environment setup and verification" | |
| echo " - Profile and session management" | |
| echo " - Deployment operations (files and directories)" | |
| echo " - Process instance operations (create, list, filter)" | |
| echo " - User task operations (deploy, create, list, complete)" | |
| echo " - Deploy and run workflow" | |
| echo " - Message correlation" | |
| echo " - Incident management" | |
| echo " - Job operations" | |
| echo " - Plugin system" | |
| echo " - Complete E2E workflow" | |
| - name: Stop Camunda | |
| if: always() | |
| run: | | |
| cd assets/c8/8.8 | |
| DATABASE=elasticsearch docker compose --profile elasticsearch down -v | |
| env: | |
| DATABASE: elasticsearch | |
| - name: Show Camunda logs on failure | |
| if: failure() | |
| run: | | |
| cd assets/c8/8.8 | |
| DATABASE=elasticsearch docker compose --profile elasticsearch logs | |
| env: | |
| DATABASE: elasticsearch |