Skip to content

ingest-results

ingest-results #451

name: Ingest Benchmark Results
on:
repository_dispatch:
types: [ingest-results]
jobs:
ingest:
timeout-minutes: 15
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Wait for source run to finish
run: sleep 300
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: pnpm/action-setup@8912a9102ac27614460f54aedde9e1e7f9aec20d # v6.0.5
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: '24'
cache: pnpm
- name: Install dependencies
run: pnpm install --filter @semianalysisai/inferencex-db...
env:
CYPRESS_INSTALL_BINARY: '0'
- name: Run migrations
env:
DATABASE_WRITE_URL: ${{ secrets.DATABASE_WRITE_URL }}
run: pnpm admin:db:migrate --yes
- name: Download artifacts from InferenceX run
env:
GH_TOKEN: ${{ secrets.INFX_MAIN_PAT }}
RUN_ID: ${{ github.event.client_payload.run-id }}
ARTIFACTS_PATH: ${{ github.workspace }}/artifacts
run: |
mkdir -p "$ARTIFACTS_PATH"
# Download all artifacts for the run, deduplicated by name (keep latest).
gh api "repos/SemiAnalysisAI/InferenceX/actions/runs/${RUN_ID}/artifacts" --paginate \
| jq -r '
[.artifacts[]]
| group_by(.name) | map(sort_by(.created_at) | last)[]
| "\(.name)\t\(.archive_download_url)"' \
| while IFS=$'\t' read -r name url; do
echo "Downloading artifact: ${name}"
ok=false
for attempt in 1 2 3; do
if gh api "${url}" > artifact.zip; then
ok=true
break
fi
echo " Attempt ${attempt}/3 failed, retrying in ${attempt}s..."
sleep "$attempt"
done
if [ "$ok" = false ]; then
echo "::error::Failed to download artifact after 3 attempts: ${name} — skipping"
rm -f artifact.zip
echo 1 >> "$ARTIFACTS_PATH/.failures"
continue
fi
mkdir -p "${ARTIFACTS_PATH}/${name}"
unzip -o artifact.zip -d "${ARTIFACTS_PATH}/${name}"
rm artifact.zip
done
echo "Downloaded artifacts:"
ls "$ARTIFACTS_PATH/"
if [ -f "$ARTIFACTS_PATH/.failures" ]; then
count=$(wc -l < "$ARTIFACTS_PATH/.failures")
rm "$ARTIFACTS_PATH/.failures"
echo "::error::${count} artifact(s) failed to download"
exit 1
fi
- name: Flatten reused ingest artifact bundle
env:
ARTIFACTS_PATH: ${{ github.workspace }}/artifacts
run: |
bundle="$ARTIFACTS_PATH/reused-ingest-artifacts"
if [ ! -d "$bundle" ]; then
echo "No reused ingest artifact bundle found."
exit 0
fi
echo "Flattening reused ingest artifact bundle:"
for child in "$bundle"/*; do
[ -e "$child" ] || continue
name=$(basename "$child")
dest="$ARTIFACTS_PATH/$name"
if [ -e "$dest" ]; then
echo "::error::Cannot flatten reused artifact '$name'; destination already exists"
exit 1
fi
mv "$child" "$dest"
echo " $name"
done
rmdir "$bundle"
echo "Artifacts after flattening:"
ls "$ARTIFACTS_PATH/"
- name: Ingest results to DB
env:
DATABASE_WRITE_URL: ${{ secrets.DATABASE_WRITE_URL }}
GITHUB_TOKEN: ${{ secrets.INFX_MAIN_PAT }}
INGEST_RUN_ID: ${{ github.event.client_payload.run-id }}
INGEST_RUN_ATTEMPT: ${{ github.event.client_payload.run-attempt }}
INGEST_ARTIFACTS_PATH: ${{ github.workspace }}/artifacts
INGEST_REPO: SemiAnalysisAI/InferenceX
UNMAPPED_ENTITIES_OUTPUT: ${{ github.workspace }}/unmapped-entities.json
run: pnpm admin:db:ingest:ci
- name: Apply run overrides
env:
DATABASE_WRITE_URL: ${{ secrets.DATABASE_WRITE_URL }}
run: pnpm admin:db:apply-overrides --yes
- name: Verify database
env:
DATABASE_WRITE_URL: ${{ secrets.DATABASE_WRITE_URL }}
run: pnpm admin:db:verify
- name: Invalidate Vercel cache
env:
VERCEL_INVALIDATE_SECRET: ${{ secrets.VERCEL_INVALIDATE_SECRET }}
run: |
curl -sSf -X POST "https://inferencex.semianalysis.com/api/v1/invalidate" \
-H "Authorization: Bearer $VERCEL_INVALIDATE_SECRET" || true
- name: Check for unmapped entities
if: always()
id: unmapped
run: |
f="${{ github.workspace }}/unmapped-entities.json"
if [ -f "$f" ]; then
echo "found=true" >> "$GITHUB_OUTPUT"
models=$(jq -r '.models // [] | join(", ")' "$f")
hardware=$(jq -r '.hardware // [] | join(", ")' "$f")
precisions=$(jq -r '.precisions // [] | join(", ")' "$f")
msg=""
[ -n "$models" ] && msg="${msg}Models: ${models}\n"
[ -n "$hardware" ] && msg="${msg}Hardware: ${hardware}\n"
[ -n "$precisions" ] && msg="${msg}Precisions: ${precisions}\n"
{
echo 'summary<<EOF'
echo -e "$msg"
echo 'EOF'
} >> "$GITHUB_OUTPUT"
fi
- name: Notify Slack on unmapped entities
if: steps.unmapped.outputs.found == 'true'
uses: slackapi/slack-github-action@45a88b9581bfab2566dc881e2cd66d334e621e2c # v3.0.3
with:
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
webhook-type: incoming-webhook
payload: |
{
"text": ":warning: *Unrecognized entities during ingest*\nRun ID: ${{ github.event.client_payload.run-id }}\n```${{ steps.unmapped.outputs.summary }}```\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View run>"
}
- name: Notify Slack on failure
if: failure()
uses: slackapi/slack-github-action@45a88b9581bfab2566dc881e2cd66d334e621e2c # v3.0.3
with:
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
webhook-type: incoming-webhook
payload: |
{
"text": ":rotating_light: *Ingest results workflow failed*\nRun ID: ${{ github.event.client_payload.run-id }}\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View run>"
}