image: tetraweb/php

stages:
  - test
  - deploy

before_script:
  - apt-get update
  - apt-get install zip unzip
  - cd api
  - php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
  - php composer-setup.php
  - php -r "unlink('composer-setup.php');"
  - php composer.phar update

test:
  stage: test
  script:
    - composer install
    - cd Tests
    - phpunit

deploy:
  when: manual
  stage: deploy
  script:
    - composer install --no-dev
    - cd ../ci
    - bash build_zip.sh
  artifacts:
    paths:
      - release.zip