Skip to content

Commit

Permalink
Run tests in CircleCI
Browse files Browse the repository at this point in the history
This switches from running the CI pipeline for Coach in CircleCI,
which we generally use across GoCardless, rather than TravisCI.
The configured workflow will test the project on Ruby 2.3, 2.4
and 2.5 using Rails versions 4.2.10 and 5.1.5.

As part of this process, we:

* Start testing against Ruby 2.5.x, which we weren't doing before
* Move to the most recent versions of Rails in 4.x and 5.x, rather
than slightly out of date versions
* Add `rspec_junit_formatter` to the gem's development
dependencies to get nicely-formatted test results in Circle
  • Loading branch information
Tim Rogers committed Mar 6, 2018
1 parent 565c621 commit b1270d1
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 16 deletions.
96 changes: 96 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
version: 2

references:
steps: &steps
- checkout

- type: shell
name: Write RAILS_VERSION to a file so we can use it for caching purposes
command: echo "$RAILS_VERSION" > ~/RAILS_VERSION.txt

- type: cache-restore
key: coach-bundler-{{ checksum "coach.gemspec" }}-{{ checksum "~/RAILS_VERSION.txt" }}

- run: gem install bundler

- run: bundle install --path vendor/bundle

- type: cache-save
key: coach-bundler-{{ checksum "coach.gemspec" }}-{{ checksum "~/RAILS_VERSION.txt" }}
paths:
- vendor/bundle

- type: shell
command: |
bundle exec rspec --profile 10 \
--format RspecJunitFormatter \
--out /tmp/test-results/rspec.xml \
--format progress \
spec
- type: store_test_results
path: /tmp/test-results

- run: bundle exec rubocop
jobs:
build-ruby22-rails515:
docker:
- image: ruby:2.2
environment:
- RAILS_VERSION=5.1.5
steps: *steps
build-ruby22-rails4210:
docker:
- image: ruby:2.2
environment:
- RAILS_VERSION=4.2.10
steps: *steps
build-ruby23-rails515:
docker:
- image: ruby:2.3
environment:
- RAILS_VERSION=5.1.5
steps: *steps
build-ruby23-rails4210:
docker:
- image: ruby:2.3
environment:
- RAILS_VERSION=4.2.10
steps: *steps
build-ruby24-rails515:
docker:
- image: ruby:2.4
environment:
- RAILS_VERSION=5.1.5
steps: *steps
build-ruby24-rails4210:
docker:
- image: ruby:2.4
environment:
- RAILS_VERSION=4.2.10
steps: *steps
build-ruby25-rails515:
docker:
- image: ruby:2.5
environment:
- RAILS_VERSION=5.1.5
steps: *steps
build-ruby25-rails4210:
docker:
- image: ruby:2.5
environment:
- RAILS_VERSION=4.2.10
steps: *steps

workflows:
version: 2
tests:
jobs:
- build-ruby22-rails515
- build-ruby22-rails4210
- build-ruby23-rails515
- build-ruby23-rails4210
- build-ruby24-rails515
- build-ruby24-rails4210
- build-ruby25-rails515
- build-ruby25-rails4210
16 changes: 0 additions & 16 deletions .travis.yml

This file was deleted.

1 change: 1 addition & 0 deletions coach.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ Gem::Specification.new do |spec|
spec.add_development_dependency "pry", "~> 0.10"
spec.add_development_dependency "rspec", "~> 3.2"
spec.add_development_dependency "rspec-its", "~> 1.2"
spec.add_development_dependency "rspec_junit_formatter", "~> 0.3.0"
spec.add_development_dependency "rubocop", "~> 0.52.0"
end

0 comments on commit b1270d1

Please sign in to comment.