Skip to content

Commit

Permalink
Upgrading to CircleCI 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hugocorbucci committed Sep 9, 2018
1 parent d88e3d4 commit ef781f5
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 13 deletions.
73 changes: 73 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
version: 2

jobs:
test:
docker:
- image: circleci/ruby:2.4.3
environment:
DATABASE_URL: "postgres://ubuntu@localhost:5432/circle_ruby_test"
- image: circleci/postgres:9.6.2-alpine
environment:
POSTGRES_USER: ubuntu
POSTGRES_DB: circle_ruby_test
environment:
CIRCLE_ARTIFACTS: /tmp/circleci-artifacts
CIRCLE_TEST_REPORTS: /tmp/circleci-test-results
RAILS_ENV: test
RACK_ENV: test
steps:
- checkout
- run: mkdir -p $CIRCLE_ARTIFACTS $CIRCLE_TEST_REPORTS
- restore_cache:
keys:
# This branch if available
- v1-dep-{{ .Branch }}-
# Default branch if not
- v1-dep-master-
# Any branch if there are none on the default branch - this should be unnecessary if you have your default branch configured correctly
- v1-dep-
- run: gem update --system
- run: gem install bundler -v 1.16.1
- run: sed -i.bak "/gem ['\"]growl_notify\|autotest-fsevent\|rb-appscript\|rb-fsevent['\"].*, *$/ N; s/\n *//g; /gem ['\"]growl_notify\|autotest-fsevent\|rb-appscript\|rb-fsevent['\"]/ d" Gemfile
- run: bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3
- save_cache:
key: v1-dep-{{ .Branch }}-{{ epoch }}
paths:
# This is a broad list of cache paths to include many possible development environments
# You can probably delete some of these entries
- vendor/bundle
- ~/.bundle
- run: cp ./config/database.circle ./config/database.yml
- run:
name: Wait for DB
command: dockerize -wait tcp://127.0.0.1:5432 -timeout 120s
- run: bundle exec rake db:create db:schema:load --trace
- run: bundle exec rake ci
# Save test results
- store_test_results:
path: /tmp/circleci-test-results
# Save artifacts
- store_artifacts:
path: /tmp/circleci-artifacts
- store_artifacts:
path: /tmp/circleci-test-results
deploy:
docker:
- image: buildpack-deps:trusty
steps:
- checkout
- run:
name: Deploy Master to Heroku
command: git push https://heroku:[email protected]/$HEROKU_APP_NAME.git master

workflows:
version: 2
test-and-deploy:
jobs:
- test
- deploy:
filters:
branches:
only: master
requires:
- test
13 changes: 0 additions & 13 deletions circle.yml

This file was deleted.

6 changes: 6 additions & 0 deletions config/database.circle
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
test:
database: circle_ruby_test
adapter: postgresql
url: <%= ENV["DATABASE_URL"] %>
username: ubuntu
host: localhost

0 comments on commit ef781f5

Please sign in to comment.