language: php
php:
  - '7.3'
  - '7.4'
script:
  - npm test
before_script:
  - nvm install 13
  - nvm use 13
  - npm i -g npm@6
  - npm i
  - touch tests.db
  - chmod a+w tests.db
  - cd src/api/ && composer update && cd ../../
if: fork = false
after_success:
  - echo -e "<?php\n  print phpversion();" > version.php
  - curl "https://raw.githubusercontent.com/andreafabrizi/Dropbox-Uploader/master/dropbox_uploader.sh" -o dropbox_uploader.sh
  - chmod +x dropbox_uploader.sh
  - touch ~/.dropbox_uploader
  - echo "CONFIGFILE_VERSION=2.0" > ~/.dropbox_uploader
  - echo "OAUTH_APP_KEY=$OAUTH_APP_KEY" >> ~/.dropbox_uploader
  - echo "OAUTH_APP_SECRET=$OAUTH_APP_SECRET" >> ~/.dropbox_uploader
  - echo "OAUTH_REFRESH_TOKEN=$OAUTH_REFRESH_TOKEN" >> ~/.dropbox_uploader
  - ./dropbox_uploader.sh upload coverage/api coverage-$(php version.php)/
  - ./dropbox_uploader.sh upload coverage/app/lcov-report coverage-$(php version.php)/
