Skip to content

Commit

Permalink
Add additional Rubies using Workflows.
Browse files Browse the repository at this point in the history
A recent issue (#1010) highlighted an deprecation under certain Ruby
versions that we should be aware of. So far, we've been using CircleCI
for running tests and previously they didn't support multiple builds.

With 2.0, Workflows allows for something like this to be setup. This
uses YAML inheritance to share a job definition across multiple build
types (defined as different Docker configurations).

This introduces Ruby 2.3 in addition to 2.4.1.
  • Loading branch information
nickcharlton committed Nov 24, 2017
1 parent 2bc89d6 commit 234196f
Showing 1 changed file with 57 additions and 34 deletions.
91 changes: 57 additions & 34 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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

0 comments on commit 234196f

Please sign in to comment.