Last active
November 15, 2016 03:08
-
-
Save tarla/43fe5047a55007350d0314b3aaccb780 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
image: "ruby:2.3.1" | |
variables: | |
POSTGRES_DB: "your_project-test" | |
POSTGRES_USER: "postgres" | |
POSTGRES_PASSWORD: "" | |
RAILS_ENV: "test" | |
SETUP_DB: "false" | |
DATABASE_URL: "postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@postgres:5432/$POSTGRES_DB" | |
cache: | |
key: "ruby-231" | |
untracked: true | |
paths: | |
- vendor/ruby | |
- vendor/apt | |
before_script: | |
- mkdir -p vendor/apt | |
- ruby -v | |
- which ruby | |
- apt-get update -qq && apt-get -o dir::cache::archives="vendor/apt" install -yqq nodejs | |
- gem install bundler dpl --no-ri --no-rdoc | |
- bundle install -j $(nproc) --path vendor | |
- '[ "$SETUP_DB" != "true" ] || bundle exec rake db:drop db:create db:schema:load db:migrate' | |
.use-db: &use-db | |
services: | |
- postgres:latest | |
variables: | |
SETUP_DB: "true" | |
rubocop: | |
stage: test | |
script: bundle exec rubocop | |
rspec: | |
stage: test | |
<<: *use-db | |
script: | |
- bundle exec rspec | |
deploy: | |
stage: deploy | |
environment: production | |
script: | |
- dpl --provider=heroku --app=$HEROKU_PRODUCTION_APP_NAME --api-key=$HEROKU_PRODUCTION_KEY | |
only: | |
- master |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment