diff --git a/.circleci/config.yml b/.circleci/config.yml index f5ff52b..8ca8a7e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,49 +1,51 @@ -version: 2.0 +version: 2.1 + +commands: + run-tests: + description: Install dependencies, load db and run tests + steps: + - checkout + - run: bundle install --path vendor/bundle + - run: bundle exec rake db:create db:schema:load + - run: rake + +executors: + docker-ruby: + parameters: + tag: + type: string + docker: + - image: circleci/ruby:<< parameters.tag >> + - image: circleci/postgres:9.4.12-alpine + +workflows: + ruby-test: + jobs: # run test suite concurrently on different versions of Ruby + - ruby-2-2 + - ruby-2-3 + - ruby-2-4 jobs: - "ruby-2.2": - docker: - - image: circleci/ruby:2.2-node - - image: circleci/postgres:9.4.12-alpine + ruby-2-2: + executor: + name: docker-ruby + tag: "2.2-node" working_directory: ~/circleci-demo-workflows steps: - - checkout - - run: bundle install --path vendor/bundle - - run: bundle exec rake db:create db:schema:load - - run: - name: Run tests - command: rake + - run-tests - "ruby-2.3": - docker: - - image: circleci/ruby:2.3-node - - image: circleci/postgres:9.4.12-alpine + ruby-2-3: + executor: + name: docker-ruby + tag: "2.3-node" working_directory: ~/circleci-demo-workflows steps: - - checkout - - run: bundle install --path vendor/bundle - - run: bundle exec rake db:create db:schema:load - - run: - name: Run tests - command: rake + - run-tests - "ruby-2.4": - docker: - - image: circleci/ruby:2.4-node - - image: circleci/postgres:9.4.12-alpine + ruby-2-4: + executor: + name: docker-ruby + tag: "2.4-node" working_directory: ~/circleci-demo-workflows steps: - - checkout - - run: bundle install --path vendor/bundle - - run: bundle exec rake db:create db:schema:load - - run: - name: Run tests - command: rake - -workflows: - version: 2 - build: - jobs: - - "ruby-2.2" - - "ruby-2.3" - - "ruby-2.4" + - run-tests