stages:
    - test
    - staging

test:
  image: python:3.8
  stage: test
  script:
  # this configures Django application to use attached postgres database that is run on `postgres` hostsdsss
    - cd backend/secfit
    - apt-get update -qy
    - pip install -r requirements.txt
    - python manage.py test workouts --testrunner django_nose.NoseTestSuiteRunner --with-coverage --cover-package workouts, users --cover-erase

staging:
  type: deploy
  image: ruby
  stage: staging
  script:
    - apt-get update -qy
    - apt-get install -y ruby-dev
    - gem install dpl
    - dpl --provider=heroku --app=tdt4242-base-frontend --api-key=$HEROKU_STAGING_API_KEY
    - dpl --provider=heroku --app=tdt4242-base-backend --api-key=$HEROKU_STAGING_API_KEY
  only:
    - master