balvig/spyke

View on GitHub
.circleci/config.yml

Summary

Maintainability
Test Coverage
# Use the latest 2.1 version of CircleCI pipeline process engine.
# See: https://circleci.com/docs/2.0/configuration-reference
version: 2.1

# Orbs are reusable packages of CircleCI configuration that you may share across projects, enabling you to create encapsulated, parameterized commands, jobs, and executors that can be used across multiple projects.
# See: https://circleci.com/docs/2.0/orb-intro/
orbs:
  ruby: circleci/ruby@0.1.2
  coveralls: coveralls/coveralls@2.2.1
  node: circleci/node@5.0.0

# Define a job to be invoked later in a workflow.
# See: https://circleci.com/docs/2.0/configuration-reference/#jobs
jobs:
  build:
    parameters:
      ruby_version:
        type: string
      rails_version:
        type: string
      faraday_version:
        type: string
    docker:
      - image: cimg/ruby:<< parameters.ruby_version >>
    executor: ruby/default
    environment:
      RAILS_TEST_VERSION: << parameters.rails_version >>
      FARADAY_TEST_VERSION: << parameters.faraday_version >>
      EUID: 0 # not sure why this is needed, but sudo npm fails
    steps:
      - checkout
      - run:
          name: Which ruby?
          command: ruby -v
      - run:
          name: Which bundler?
          command: bundle -v
      - ruby/bundle-install
      - run:
          name: Run tests
          command: bundle exec rake
      - node/install:
          node-version: 10.0.0
      - coveralls/upload:
          parallel: true
  coverage:
    docker:
      - image: circleci/node:10.0.0
    steps:
      - coveralls/upload:
          parallel_finished: true

workflows:
  tests:
    jobs:
      - build:
          matrix:
            alias: Rails 4
            parameters:
              rails_version: ["~> 4.0"]
              ruby_version: ["2.6.9"]
              faraday_version: ["< 2.0"]
      - build:
          matrix:
            alias: Rails 5
            parameters:
              rails_version: ["~> 5.0"]
              ruby_version: ["2.6.9", "2.7.5"]
              faraday_version: ["< 2.0", ">= 2.0"]
      - build:
          matrix:
            alias: Rails 6
            parameters:
              rails_version: ["~> 6.0"]
              ruby_version: ["2.6.9", "2.7.5", "3.0.3"]
              faraday_version: ["< 2.0", ">= 2.0"]
      - build:
          matrix:
            alias: Rails 7
            parameters:
              rails_version: ["~> 7.0"]
              ruby_version: ["2.7.5", "3.0.3", "3.1.1", "3.2.0"]
              faraday_version: ["< 2.0", ">= 2.0"]
      - coverage:
          requires: ["Rails 4", "Rails 5", "Rails 6", "Rails 7"]