Files
copilotkit__copilotkit/.github/workflows/starter-smoke.yml
Jordan Ritter 10edf630f6 fix: clean Slack alert formatting across showcase workflows (#3914)
## Summary

- **drift-detection**: Split inline payload into `jq`-built file +
`payload-file-path`; sanitize playwright output (strip ANSI, head -3,
cap 200 chars)
- **starter-smoke**: Replace `toJSON(format(...))` double-encoding with
`jq` payload builder
- **showcase_deploy**: Replace 300-char inline ternary with readable
shell conditional + `jq`

All three workflows now use the same pattern: build a sanitized JSON
file with `jq -n`, then reference it via `payload-file-path`. This
eliminates raw `%0A` in Slack messages, unformatted stack traces, and
double-encoded JSON.

## Test plan

- [ ] Trigger `showcase_drift-detection.yml` manually — verify Slack
alert formats correctly on failure
- [ ] Trigger `starter-smoke.yml` manually — verify Slack alert on a
known-failing starter
- [ ] Trigger `showcase_deploy.yml` with `service: shell` — verify
deploy notification renders cleanly
- [ ] Confirm no `%0A` or raw escape sequences appear in any Slack
message
2026-04-14 15:38:07 -07:00

157 lines
6.6 KiB
YAML

name: Starter Smoke Tests
on:
schedule:
# Every 6 hours — catches floating dep breakage
- cron: "0 */6 * * *"
workflow_run:
workflows: ["publish / release"]
types: [completed]
pull_request:
paths:
- "examples/integrations/**"
- ".github/workflows/starter-smoke.yml"
workflow_dispatch: {}
permissions:
contents: read
packages: read
issues: write
jobs:
starter-smoke:
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
matrix:
starter:
- langgraph-python
- mastra
- langgraph-js
- crewai-crews
- pydantic-ai
- adk
- agno
- llamaindex
- langgraph-fastapi
- strands-python
- ms-agent-framework-python
- ms-agent-framework-dotnet
fail-fast: false
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
lfs: false
- name: Run starter smoke tests
working-directory: examples/integrations/${{ matrix.starter }}
env:
STARTER: ${{ matrix.starter }}
run: |
docker compose -f docker-compose.test.yml up --abort-on-container-exit --exit-code-from tests
- name: Capture failure cause
if: failure()
id: failure-cause
working-directory: examples/integrations/${{ matrix.starter }}
run: |
{
echo "summary<<CAUSE_EOF"
# Capture error from container logs (containers still running at this point)
build_err=$(docker compose -f docker-compose.test.yml logs app 2>&1 | grep -E "ERR_|Error:|error:|Build error|failed to" | head -3)
agent_err=$(docker compose -f docker-compose.test.yml logs agent 2>&1 | grep -E "Error:|Traceback|ModuleNotFoundError|ImportError" | head -3)
test_err=$(docker compose -f docker-compose.test.yml logs tests 2>&1 | grep -E "✘|FAIL|Error:|expect\(" | head -5)
if [ -n "$build_err" ]; then
echo "Build failure:"
echo "$build_err"
elif [ -n "$agent_err" ]; then
echo "Agent crash:"
echo "$agent_err"
elif [ -n "$test_err" ]; then
echo "Test failure:"
echo "$test_err"
else
echo "Unknown failure — check run logs"
fi
echo ""
# Identify recent changes that may have caused the failure
if [ "${{ github.event_name }}" = "pull_request" ]; then
echo "Triggered by PR #${{ github.event.pull_request.number }} (${{ github.event.pull_request.user.login }}): ${{ github.event.pull_request.title }}"
echo "Head: ${{ github.event.pull_request.head.sha }}"
elif [ "${{ github.event_name }}" = "schedule" ] || [ "${{ github.event_name }}" = "workflow_run" ]; then
# Use GitHub API instead of git log (avoids needing deep clone)
echo "Recent commits touching this starter (last 12h):"
gh api "repos/${{ github.repository }}/commits?path=examples/integrations/${{ matrix.starter }}&since=$(date -u -d '12 hours ago' +%Y-%m-%dT%H:%M:%SZ 2>/dev/null || date -u -v-12H +%Y-%m-%dT%H:%M:%SZ)&per_page=5" \
--jq '.[] | "\(.sha[0:7]) \(.commit.message | split("\n")[0])"' 2>/dev/null || true
starter_commits=$(gh api "repos/${{ github.repository }}/commits?path=examples/integrations/${{ matrix.starter }}&since=$(date -u -d '12 hours ago' +%Y-%m-%dT%H:%M:%SZ 2>/dev/null || date -u -v-12H +%Y-%m-%dT%H:%M:%SZ)&per_page=1" --jq 'length' 2>/dev/null || echo "0")
if [ "$starter_commits" = "0" ]; then
echo "No starter code changes — likely a floating dependency update or upstream CopilotKit release"
echo "Recent releases:"
gh api "repos/${{ github.repository }}/releases?per_page=3" \
--jq '.[] | "\(.tag_name) (\(.published_at[0:10]))"' 2>/dev/null | head -3 || true
fi
fi
echo "CAUSE_EOF"
} >> "$GITHUB_OUTPUT"
- name: Tear down
if: always()
working-directory: examples/integrations/${{ matrix.starter }}
run: docker compose -f docker-compose.test.yml down -v
- name: Upload test artifacts on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: starter-smoke-${{ matrix.starter }}
path: showcase/tests/test-results/
retention-days: 7
- name: Build Slack payload
if: failure() && (github.event_name == 'schedule' || github.event_name == 'workflow_run')
run: |
SUMMARY=$(echo "${{ steps.failure-cause.outputs.summary }}" | head -3 | sed 's/\x1b\[[0-9;]*m//g' | cut -c1-200)
URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
jq -n --arg text ":x: *Starter smoke test failing: ${{ matrix.starter }}*\n<$URL|View run>\n\`\`\`$SUMMARY\`\`\`" \
'{text: $text}' > /tmp/slack-payload.json
- name: Alert Slack on failure
if: failure() && (github.event_name == 'schedule' || github.event_name == 'workflow_run')
uses: slackapi/slack-github-action@v2.1.0
with:
webhook: ${{ secrets.SLACK_WEBHOOK_OSS_ALERTS }}
webhook-type: incoming-webhook
payload-file-path: /tmp/slack-payload.json
- name: Create GitHub issue on failure
if: failure() && github.event_name == 'schedule'
uses: actions/github-script@v7
env:
FAILURE_SUMMARY: ${{ steps.failure-cause.outputs.summary }}
with:
script: |
const title = `[Drift] Starter smoke test failing: ${{ matrix.starter }}`;
const cause = (process.env.FAILURE_SUMMARY || 'Unknown').replace(/`/g, "'");
const { data: issues } = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
labels: 'starter-drift',
state: 'open',
});
const existing = issues.find(i => i.title === title);
if (!existing) {
await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title,
labels: ['starter-drift'],
body: `The scheduled starter smoke test for \`${{ matrix.starter }}\` is failing.\n\n**Cause:**\n\`\`\`\n${cause}\n\`\`\`\n\n**Run:** ${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}\n\nThis likely means a floating dependency update broke the starter.`,
});
}