Skip to content

Update examples for pipecat-ai 1.0.0 #186

Update examples for pipecat-ai 1.0.0

Update examples for pipecat-ai 1.0.0 #186

Workflow file for this run

name: Test Demos
on:
push:
branches: [main]
pull_request:
branches: ['*']
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
# Mock API keys for smoke testing
ANTHROPIC_API_KEY: mock_anthropic_api_key
AWS_ACCESS_KEY_ID: mock_aws_access_key
AWS_SECRET_ACCESS_KEY: mock_aws_secret_key
AWS_REGION: us-east-1
AZURE_SPEECH_API_KEY: mock_azure_speech_key
AZURE_SPEECH_REGION: eastus
CARTESIA_API_KEY: mock_cartesia_api_key
DAILY_API_KEY: mock_daily_api_key
DEEPGRAM_API_KEY: mock_deepgram_api_key
ELEVENLABS_API_KEY: mock_elevenlabs_api_key
GOOGLE_API_KEY: mock_google_api_key
LANGFUSE_PUBLIC_KEY: mock_langfuse_public_key
LANGFUSE_SECRET_KEY: mock_langfuse_secret_key
OPENAI_API_KEY: mock_openai_api_key
WHATSAPP_TOKEN: mock_whatsapp_token
WHATSAPP_WEBHOOK_VERIFICATION_TOKEN: mock_whatsapp_webhook_verification_token
WHATSAPP_PHONE_NUMBER_ID: mock_whatsapp_phone_number_id
jobs:
# Generate test matrix from demos.json
generate-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
changed_files: ${{ steps.changed-files.outputs.all_changed_files }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v45
with:
separator: ','
- name: Generate matrix from demos.json
id: set-matrix
run: |
python3 << 'EOF'
import json
import os
# Load demos.json
with open('scripts/demos.json') as f:
demos = json.load(f)
# Filter out skipped demos for CI
testable_demos = [
{
'name': demo['path'].replace('/', '-'),
'path': demo['path']
}
for demo in demos
if not demo.get('skip', False)
]
# Output matrix
matrix = {'include': testable_demos}
print(f"matrix={json.dumps(matrix)}")
with open(os.environ['GITHUB_OUTPUT'], 'a') as f:
f.write(f"matrix={json.dumps(matrix)}\n")
EOF
# Test demos
test-demos:
needs: generate-matrix
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 10
matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v4
- name: Check if demo changed
id: should-run
run: |
# Always run on main branch push or manual trigger
if [[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" == "refs/heads/main" ]]; then
echo "run=true" >> $GITHUB_OUTPUT
echo "Running on main branch push - testing all demos"
exit 0
elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "run=true" >> $GITHUB_OUTPUT
echo "Manual trigger - testing all demos"
exit 0
fi
# For PRs, check if this demo's files changed
CHANGED_FILES="${{ needs.generate-matrix.outputs.changed_files }}"
DEMO_PATH="${{ matrix.path }}"
# Check if any changed file starts with the demo path
# Use word boundary to match the demo path at the start of a filename
if echo "$CHANGED_FILES" | grep -qE "(^|,)$DEMO_PATH/"; then
echo "run=true" >> $GITHUB_OUTPUT
echo "Demo $DEMO_PATH changed - will test"
else
echo "run=false" >> $GITHUB_OUTPUT
echo "Demo $DEMO_PATH not changed - skipping"
fi
- name: Install uv
if: steps.should-run.outputs.run == 'true'
uses: astral-sh/setup-uv@v4
- name: Set up Python
if: steps.should-run.outputs.run == 'true'
run: uv python install 3.12
- name: Run smoke test
if: steps.should-run.outputs.run == 'true'
run: |
python scripts/smoke_test_demo.py "${{ matrix.path }}" --timeout 30