version: 2 workflows: version: 2 test: jobs: - test-misc-rubies - test-2.2 - test-2.3 - test-2.4 - test-2.5 - test-jruby-9.2 ruby-docker-template: &ruby-docker-template steps: - checkout - run: | if [[ $CIRCLE_JOB == test-jruby* ]]; then gem install jruby-openssl; # required by bundler, no effect on Ruby MRI fi - run: ruby -v - run: gem install bundler -v 1.17.3 - run: bundle install - run: mkdir ./rspec - run: bundle exec rspec --format progress --format RspecJunitFormatter -o ./rspec/rspec.xml spec - store_test_results: path: ./rspec - store_artifacts: path: ./rspec jobs: test-2.2: <<: *ruby-docker-template docker: - image: circleci/ruby:2.2.10-jessie - image: consul - image: redis - image: amazon/dynamodb-local test-2.3: <<: *ruby-docker-template docker: - image: circleci/ruby:2.3.7-jessie - image: consul - image: redis - image: amazon/dynamodb-local test-2.4: <<: *ruby-docker-template docker: - image: circleci/ruby:2.4.5-stretch - image: consul - image: redis - image: amazon/dynamodb-local test-2.5: <<: *ruby-docker-template docker: - image: circleci/ruby:2.5.3-stretch - image: consul - image: redis - image: amazon/dynamodb-local test-jruby-9.2: <<: *ruby-docker-template docker: - image: circleci/jruby:9-jdk - image: consul - image: redis - image: amazon/dynamodb-local # The following very slow job uses an Ubuntu container to run the Ruby versions that # CircleCI doesn't provide Docker images for. test-misc-rubies: machine: image: circleci/classic:latest environment: - RUBIES: "jruby-9.1.17.0" steps: - run: sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" - run: sudo apt-get -q update - run: sudo apt-get -qy install redis-server - run: sudo apt-cache policy docker-ce - run: sudo apt-get -qy install docker-ce - checkout - run: name: install all Ruby versions command: "parallel rvm install ::: $RUBIES" - run: name: bundle install for all versions shell: /bin/bash -leo pipefail # need -l in order for "rvm use" to work command: | set -e; for i in $RUBIES; do rvm use $i; if [[ $i == jruby* ]]; then gem install jruby-openssl; # required by bundler, no effect on Ruby MRI fi # bundler 2.0 may be preinstalled, we need to remove it if so yes | gem uninstall bundler --version '>=2.0' || true; gem install bundler -v 1.17.3; bundle install; mv Gemfile.lock "Gemfile.lock.$i" done - run: name: start DynamoDB command: docker run -p 8000:8000 amazon/dynamodb-local background: true - run: name: download Consul command: wget https://releases.hashicorp.com/consul/0.8.0/consul_0.8.0_linux_amd64.zip - run: name: extract Consul command: unzip consul_0.8.0_linux_amd64.zip - run: name: start Consul command: ./consul agent -dev background: true - run: name: run tests for all versions shell: /bin/bash -leo pipefail command: | set -e; for i in $RUBIES; do rvm use $i; cp "Gemfile.lock.$i" Gemfile.lock; bundle exec rspec spec; done