version: 2.1 executors: ruby: description: The official CircleCI Ruby Docker image parameters: tag: description: The circleci/ruby Docker image version tag type: string default: latest docker: - image: circleci/ruby:<< parameters.tag >> environment: - BUNDLE_JOBS: 4 - BUNDLE_RETRY: 3 working_directory: ~/n1_loader jobs: checkout: executor: ruby steps: - checkout - persist_to_workspace: root: ~/n1_loader paths: - . build: parameters: ruby-version: type: string gemfile: type: string executor: name: ruby tag: << parameters.ruby-version >> steps: - attach_workspace: at: ~/n1_loader - run: name: Use << parameters.gemfile >> as the Gemfile command: bundle config --global gemfile << parameters.gemfile >> - run: name: Install the gems specified by the Gemfile command: bundle install - run: name: Run RSpec command: | bundle exec rspec --profile 10 \ --format RspecJunitFormatter \ --out test_results/rspec.xml \ --format progress \ $(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings) - store_test_results: path: test_results rubocop: executor: name: ruby tag: "2.5" steps: - attach_workspace: at: ~/n1_loader - run: name: Install the gems specified by the Gemfile command: bundle install - run: name: Lint Ruby code with RuboCop command: bundle exec rubocop --parallel workflows: version: 2 default: &default jobs: - checkout - build: requires: - checkout matrix: parameters: ruby-version: [ "2.5", "2.6", "2.7", "3.0", "latest" ] gemfile: [ "gemfiles/ar_5_latest.gemfile", "gemfiles/ar_6_latest.gemfile" ] exclude: - ruby-version: "3.0" gemfile: "gemfiles/ar_5_latest.gemfile" - ruby-version: "latest" gemfile: "gemfiles/ar_5_latest.gemfile" name: << matrix.gemfile >>-build-ruby-<< matrix.ruby-version >> - rubocop: requires: - checkout nightly: triggers: - schedule: cron: "0 0 * * *" filters: branches: only: - master <<: *default