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 activerecord-gemfile: type: string ar_lazy_preload-gemfile: type: string environment: ACTIVERECORD_GEMFILE: << parameters.activerecord-gemfile >> AR_LAZY_PRELOAD_GEMFILE: << parameters.ar_lazy_preload-gemfile >> executor: name: ruby tag: << parameters.ruby-version >> steps: - attach_workspace: at: ~/n1_loader - run: name: Install the gems specified by the Gemfile command: bundle install - run: name: Run Core RSpec command: | bundle exec rspec --profile 10 \ --format RspecJunitFormatter \ --out test_results/core.xml \ --format progress \ spec/n1_loader_spec.rb - run: name: Run ActiveRecord integration RSpec command: | bundle exec rspec --profile 10 \ --format RspecJunitFormatter \ --out test_results/activerecord-integration.xml \ --format progress \ spec/n1_loader_spec.rb \ spec/activerecord_spec.rb - run: name: Run ActiveRecord integration RSpec command: | bundle exec rspec --profile 10 \ --format RspecJunitFormatter \ --out test_results/ar-lazy-preload-integration.xml \ --format progress \ spec/n1_loader_spec.rb \ spec/activerecord_spec.rb \ spec/ar_lazy_preload_spec.rb - 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.7", "latest" ] activerecord-gemfile: [ "ar_5_latest", "ar_6_latest", "ar_7_latest" ] ar_lazy_preload-gemfile: [ "ar_lazy_preload_0.6.1", "ar_lazy_preload_master" ] exclude: # Ruby 2.5 and AR Lazy Preload 1+ - ruby-version: "2.5" ar_lazy_preload-gemfile: "ar_lazy_preload_master" activerecord-gemfile: "ar_5_latest" - ruby-version: "2.5" ar_lazy_preload-gemfile: "ar_lazy_preload_master" activerecord-gemfile: "ar_6_latest" - ruby-version: "2.5" ar_lazy_preload-gemfile: "ar_lazy_preload_master" activerecord-gemfile: "ar_7_latest" # AR 5 and ruby 3+ - ruby-version: "latest" activerecord-gemfile: "ar_5_latest" ar_lazy_preload-gemfile: "ar_lazy_preload_0.6.1" - ruby-version: "latest" activerecord-gemfile: "ar_5_latest" ar_lazy_preload-gemfile: "ar_lazy_preload_master" # AR 7 and ar_lazy_preload < 1 - ruby-version: "2.5" activerecord-gemfile: "ar_7_latest" ar_lazy_preload-gemfile: "ar_lazy_preload_0.6.1" - ruby-version: "2.7" activerecord-gemfile: "ar_7_latest" ar_lazy_preload-gemfile: "ar_lazy_preload_0.6.1" - ruby-version: "latest" activerecord-gemfile: "ar_7_latest" ar_lazy_preload-gemfile: "ar_lazy_preload_0.6.1" name: ruby-<< matrix.ruby-version >>-<< matrix.activerecord-gemfile >>-<< matrix.ar_lazy_preload-gemfile >> - rubocop: requires: - checkout nightly: triggers: - schedule: cron: "0 0 * * *" filters: branches: only: - master <<: *default