# Manual-trigger only. Validation fixtures (sample videos + expected-detections
# baseline) are not yet authored; running the e2e on push would produce red
# builds until that data lands. Flip `event: [manual]` back to
# `event: [push, pull_request, manual]` once validation fixtures are in place,
# and add `depends_on: [01-test]` to 02-build-push.yml.
#
# Tracking: see plan "CI Auto Tests Epic", story S3b — blocked by e2e validation data.

when:
  event: [manual]
  branch: [dev, stage, main]

labels:
  platform: arm64

steps:
  - name: e2e
    image: docker:24
    environment:
      COMPOSE_PROJECT_NAME: detections-e2e
    commands:
      - cd e2e
      - mkdir -p results logs
      - docker compose -f docker-compose.test.yml --profile cpu up --build --abort-on-container-exit --exit-code-from e2e-runner
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock

  - name: e2e-report
    image: docker:24
    when:
      status: [success, failure]
    environment:
      COMPOSE_PROJECT_NAME: detections-e2e
    commands:
      - cd e2e
      - docker compose -f docker-compose.test.yml --profile cpu down -v || true
      - test -f results/report.csv && cat results/report.csv || echo "no report"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
