integration:
  image: registry.gitlab.com/openstapps/openstapps/node-builder
  stage: test
  needs: ['build']
  variables:
    DOCKER_DRIVER: overlay2
    WAIT_FOR_SERVICES_TIMEOUT: 1
  services:
    - name: registry.gitlab.com/openstapps/openstapps/database:latest
      alias: elasticsearch
  script:
    - pnpm --filter=@openstapps/backend install
    - pnpm test:integration:backend
  artifacts:
    when: on_failure
    paths:
      - backend/backend/coverage/integration-report-junit.xml
    reports:
      junit:
        - backend/backend/coverage/integration-report-junit.xml
  rules:
    - if: $CI_PIPELINE_SOURCE == 'merge_request_event' || $CI_COMMIT_BRANCH == 'main' || $CI_COMMIT_BRANCH == 'develop'
