stages:
  - test
  - deploy

unitTest:
  image: edbizarro/gitlab-ci-pipeline-php:7.4-alpine
  before_script:
    - composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
    - composer install --prefer-dist --no-ansi --no-interaction --no-progress
  stage: test
  cache:
    paths:
      - vendor
  script:
    - ./vendor/bin/phpunit -v --coverage-text --colors=never --log-junit phpunit-report.xml
  artifacts:
    reports:
      junit:
        - phpunit-report.xml
  coverage: '/^\s*Lines:\s*\d+.\d+\%/'

#composerPublish:
#  image: curlimages/curl:latest
#  only:
#    - tags
#  stage: deploy
#  script:
#    - curl --data "tag=${CI_COMMIT_TAG}" "http://__token__:${CI_JOB_TOKEN}@gitlab/api/v4/projects/${CI_PROJECT_ID}/packages/composer"
#  dependencies:
#    - unitTest