# .gitlab-ci.yml (excerpt) # Runs the CallQA suite after the staging deploy and fails the pipeline when # the score is under the threshold. # # Setup: CI/CD variables CALLQA_API_KEY (masked, protected) and CALLQA_SCENARIO_ID. # Copy examples/cli/callqa to ci/callqa in your repository. stages: [deploy, voice-test] voice-test: stage: voice-test image: python:3.12-slim needs: ["deploy-staging"] timeout: 40m variables: CALLQA_THRESHOLD: "80" script: - python3 ci/callqa run --scenario "$CALLQA_SCENARIO_ID" --threshold "$CALLQA_THRESHOLD" --code-version "$CI_COMMIT_SHORT_SHA" --git-sha "$CI_COMMIT_SHA" --git-ref "$CI_COMMIT_REF_NAME" --tag "gitlab" --tag "$CI_COMMIT_REF_SLUG" --wait --summary callqa-summary.md artifacts: when: always paths: [callqa-summary.md] expire_in: 30 days # Without the CLI: one curl, the server waits and answers 200 / 412 / 202. # Do not rely on `curl --fail` alone: 202 (still running) is a success for curl. voice-test-curl: stage: voice-test image: curlimages/curl:8.10.1 needs: ["deploy-staging"] when: manual script: - | code=$(curl -sS -o run.json -w '%{http_code}' -X POST --max-time 960 \ -H "Authorization: Bearer $CALLQA_API_KEY" \ -H "Content-Type: application/json" \ -d "{\"version\": \"$CI_COMMIT_SHORT_SHA\", \"git_sha\": \"$CI_COMMIT_SHA\", \"tags\": [\"gitlab\"]}" \ "https://app.callqa.dev/api/v1/scenarios/$CALLQA_SCENARIO_ID/runs?wait=true&timeout=900&threshold=80") cat run.json [ "$code" = "200" ] || { echo "CallQA gate failed (HTTP $code)"; exit 1; }