diff --git a/.circleci/config.yml b/.circleci/config.yml index d513f3c38a..a1a28294cf 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,42 @@ -version: 2 +default_job: &default_job + working_directory: ~/administrate + steps: + - checkout + + # Restore Cached Dependencies + - type: cache-restore + name: Restore bundle cache + key: administrate-{{ checksum "Gemfile.lock" }} + + # Bundle install dependencies + - run: bundle install --path vendor/bundle + + # Install Appraisal gemfiles + - run: bundle exec appraisal install + + # Cache Dependencies + - type: cache-save + name: Store bundle cache + key: administrate-{{ checksum "Gemfile.lock" }} + paths: + - vendor/bundle + + # Wait for DB + - run: dockerize -wait tcp://localhost:5432 -timeout 1m + + # Setup the environment + - run: cp .sample.env .env + + # Setup the database + - run: bundle exec rake db:setup + + # Run the tests + - run: bundle exec rake + - run: bundle exec appraisal rake + jobs: - build: - working_directory: ~/administrate + ruby-2.4: + <<: *default_job docker: - image: circleci/ruby:2.4.1-node-browsers environment: @@ -13,36 +48,24 @@ jobs: POSTGRES_USER: administrate POSTGRES_DB: administrate-prototype_test POSTGRES_PASSWORD: "" - steps: - - checkout - - # Restore Cached Dependencies - - type: cache-restore - name: Restore bundle cache - key: administrate-{{ checksum "Gemfile.lock" }} - - # Bundle install dependencies - - run: bundle install --path vendor/bundle - - # Install Appraisal gemfiles - - run: bundle exec appraisal install - - # Cache Dependencies - - type: cache-save - name: Store bundle cache - key: administrate-{{ checksum "Gemfile.lock" }} - paths: - - vendor/bundle - # Wait for DB - - run: dockerize -wait tcp://localhost:5432 -timeout 1m - - # Setup the environment - - run: cp .sample.env .env - - # Setup the database - - run: bundle exec rake db:setup + ruby-2.3: + <<: *default_job + docker: + - image: circleci/ruby:2.3-node-browsers + environment: + PGHOST: localhost + PGUSER: administrate + RAILS_ENV: test + - image: postgres:9.5-alpine + environment: + POSTGRES_USER: administrate + POSTGRES_DB: administrate-prototype_test + POSTGRES_PASSWORD: "" - # Run the tests - - run: bundle exec rake - - run: bundle exec appraisal rake +workflows: + version: 2 + multiple-rubies: + jobs: + - ruby-2.4 + - ruby-2.3