machine:
  timezone:
    Europe/London
  java:
    version: oraclejdk8
  environment:
    TERM: dumb

dependencies:
  cache_directories:
    - ~/.gradle
  override:
    - chmod +x gradlew
    - ./gradlew resolveAllDependencies

test:
  override:
    - ./gradlew test
  post:
    - mkdir -p $CIRCLE_TEST_REPORTS/junit/
    - find . -type f -regex ".*/build/test-results/TEST-.*xml" -exec cp {} $CIRCLE_TEST_REPORTS/junit/ \;

## Customize deployment commands
deployment:
  staging:
    branch: master
    heroku:
      appname: moviesroom
machine:
  timezone:
    Europe/London
  java:
    version: oraclejdk8
  environment:
    TERM: dumb

dependencies:
  cache_directories:
    - ~/.gradle
  override:
    - chmod +x gradlew
    - ./gradlew resolveAllDependencies

test:
  override:
    - ./gradlew test
  post:
    - mkdir -p $CIRCLE_TEST_REPORTS/junit/
    - find . -type f -regex ".*/build/test-results/TEST-.*xml" -exec cp {} $CIRCLE_TEST_REPORTS/junit/ \;

## Customize deployment commands
deployment:
  staging:
    branch: master
    heroku:
      appname: moviesroom
    commands:
          - |
            cat >~/.netrc <<EOF
            machine api.heroku.com
              login $HEROKU_EMAIL
              password $HEROKU_TOKEN
            machine git.heroku.com
              login $HEROKU_EMAIL
              password $HEROKU_TOKEN
            EOF
          - chmod 600 ~/.netrc # Heroku cli complains about permissions without this
          - heroku maintenance:on --app moviesroom
          - heroku scale worker=0 --app moviesroom
          - git push git@heroku.com:moviesroom.git $CIRCLE_SHA1:refs/heads/master
          - heroku run rake db:migrate --app moviesroom
          - heroku scale worker=x --app moviesroom
          - heroku maintenance:off --app moviesroom
Fix CI and CD config from CircleCi on Heroku
Fix CI and CD config from CircleCi on Heroku
