.unit-test:
    image: ${REGISTRY_URL}/${PROJECT_NAME}/${SERVICE_NAME}:${CI_COMMIT_SHORT_SHA}
    script:
        - |
            ([ ! -z ${USER} ] && su vlapipe -c "cd /code && ./bin/run-tests.sh -b") || cd /code && ./bin/run-tests.sh -b
        - mv .coverage ${CI_PROJECT_DIR}/.coverage.${SERVICE_NAME}.${CI_COMMIT_SHORT_SHA}
    artifacts:
        paths:
            - .coverage.${SERVICE_NAME}.${CI_COMMIT_SHORT_SHA}
    rules:
        - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
        - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
    dependencies: []
