Scan your staging site in CircleCI after each deploy, fail the workflow on what you choose, and see each test in the job's Tests tab.
Before you start
- A verified domain for the site.
- An API key. Use a team key in CI: see Keys for CI.
Add the job
.circleci/config.yml
jobs:
valiqai:
docker:
- image: cimg/node:20.19
environment:
STAGING_URL: https://staging.example.com
steps:
- run: npx -y @valiqai/cli scan "$STAGING_URL" --fail-on blocker --output test-results/valiqai/junit.xml
- store_test_results:
path: test-resultsThe key goes in: Project settings › Environment variables. Results show in: the job's Tests tab.
Deploy, then scan
Run the scan in a job that requires the deploy:
YAML
version: 2.1
jobs:
deploy:
docker:
- image: cimg/node:22.11
steps:
- checkout
- run: ./scripts/deploy-staging.sh
valiqai:
docker:
- image: cimg/node:22.11
environment:
STAGING_URL: https://staging.example.com
steps:
- run: npx -y @valiqai/cli scan "$STAGING_URL" --fail-on blocker --output test-results/valiqai/junit.xml
- store_test_results:
path: test-results
workflows:
deploy-and-scan:
jobs:
- deploy
- valiqai:
requires: [deploy]What you'll see
- The job's Tests tab: each test the scan ran. A test fails when it found an open problem at
--fail-onor above. - The job log: progress, the summary, and a link to the scan.
- The scan's page in ValiqAI says CircleCI · main · a1b2c3d, linking back to the job.