--- version: 2.1 commands: restore_bundle_cache: description: "Restore gems installed by bundler" parameters: # Use this parameter to bust the cache, if needed cache_prefix: type: string default: "8-6-2020-A" ruby_version: type: string default: '2.7.1' rails_version: type: string default: '6.0.3.2' steps: - restore_cache: keys: - << parameters.cache_prefix >>-{{ checksum "geoblacklight.gemspec" }}-{{ checksum "Gemfile" }}-<< parameters.ruby_version >>-<< parameters.rails_version >> paths: - /home/circleci/geoblacklight/vendor/bundle save_bundle_cache: description: "Save gems installed by bundler" parameters: # Use this parameter to bust the cache, if needed cache_prefix: type: string default: "8-6-2020-A" ruby_version: type: string default: '2.7.1' rails_version: type: string default: '6.0.3.2' steps: - save_cache: key: << parameters.cache_prefix >>-{{ checksum "geoblacklight.gemspec" }}-{{ checksum "Gemfile" }}-<< parameters.ruby_version >>-<< parameters.rails_version >> paths: - /home/circleci/geoblacklight/vendor/bundle jobs: build: working_directory: ~/geoblacklight parameters: ruby_version: type: string default: '2.7.1' solr_port: type: string default: '8983' rails_version: type: string default: '6.0.3.2' coverage: type: boolean default: false docker: - image: circleci/ruby:<< parameters.ruby_version >>-node-browsers - image: solr:7-alpine command: bin/solr -cloud -noprompt -f -p <> environment: GEM_HOME: /home/circleci/geoblacklight/vendor/bundle BUNDLE_PATH: /home/circleci/geoblacklight/vendor/bundle BUNDLE_JOBS: 4 BUNDLE_RETRY: 3 RAILS_ENV: test RACK_ENV: test RAILS_VERSION: <> steps: - checkout - restore_bundle_cache: ruby_version: << parameters.ruby_version >> rails_version: << parameters.rails_version >> # Install gems - run: bundle check || bundle install # Generate the internal test app - run: name: Generate test app command: | [ -e ./.internal_test_app ] || bundle exec rake engine_cart:generate - save_bundle_cache: ruby_version: << parameters.ruby_version >> rails_version: << parameters.rails_version >> - run: name: Wait for Solr command: dockerize -wait tcp://localhost:<> -timeout 1m - run: name: Load config into solr command: | cd .internal_test_app/solr/conf zip -1 -r solr_config.zip ./* curl -H "Content-type:application/octet-stream" --data-binary @solr_config.zip "http://localhost:8983/solr/admin/configs?action=UPLOAD&name=solrconfig" curl -H 'Content-type: application/json' http://localhost:<>/api/collections/ -d '{create: {name: blacklight-core, config: solrconfig, numShards: 1}}' - run: name: Seed Solr command: | cd .internal_test_app bundle check || bundle install bundle exec rake geoblacklight:index:seed bundle exec rake geoblacklight:downloads:mkdir - when: condition: <> steps: - run: name: Ensure simplecov is installed command: gem install simplecov - run: name: Run the RSpec test suites command: bundle exec rspec - run: name: Stash Coverage Results command: | cp -R coverage/ coverage_results/ cp -R coverage/ /tmp/coverage_results/ - persist_to_workspace: root: '~/geoblacklight' paths: 'coverage_results' - store_artifacts: path: /tmp/coverage_results/ - unless: condition: <> steps: - run: name: Run the RSpec test suites command: bundle exec rspec - run: name: Run the Teaspoon test suites command: bundle exec rake teaspoon rubocop: working_directory: ~/geoblacklight parameters: ruby_version: type: string default: '2.7.1' rails_version: type: string default: '6.0.3.2' docker: - image: circleci/ruby:<< parameters.ruby_version >>-node-browsers environment: GEM_HOME: /home/circleci/geoblacklight/vendor/bundle BUNDLE_PATH: /home/circleci/geoblacklight/vendor/bundle BUNDLE_JOBS: 4 BUNDLE_RETRY: 3 RAILS_ENV: test RACK_ENV: test RAILS_VERSION: <> steps: - checkout - restore_bundle_cache: ruby_version: << parameters.ruby_version >> rails_version: << parameters.rails_version >> # Install gems and run rubocop - run: bundle check || bundle install - run: bundle exec rake rubocop coverage_report: working_directory: ~/geoblacklight parameters: ruby_version: type: string default: '2.7.1' rails_version: type: string default: '6.0.3.2' docker: - image: circleci/ruby:<< parameters.ruby_version >>-node-browsers environment: GEM_HOME: /home/circleci/geoblacklight/vendor/bundle BUNDLE_PATH: /home/circleci/geoblacklight/vendor/bundle BUNDLE_JOBS: 4 BUNDLE_RETRY: 3 RAILS_ENV: test RACK_ENV: test RAILS_VERSION: <> steps: - checkout - attach_workspace: at: '~/geoblacklight' - restore_bundle_cache: ruby_version: << parameters.ruby_version >> rails_version: << parameters.rails_version >> # Install gems and check coverage - run: bundle check || bundle install - run: name: Merge and check coverage command: | RAILS_ENV=test bundle exec ruby ./bin/coverage.rb - store_artifacts: path: ~/geoblacklight/coverage destination: coverage workflows: version: 2.1 build: jobs: - build: ruby_version: 2.7.1 rails_version: 6.0.3.2 coverage: true name: "ruby2-7_rails6-0" - build: ruby_version: 2.6.6 rails_version: 6.0.3.2 name: "ruby2-6_rails6-0" - build: ruby_version: 2.7.1 rails_version: 5.2.4.3 name: "ruby2-7_rails5-2" - build: ruby_version: 2.6.6 rails_version: 5.2.4.3 name: "ruby2-6_rails5-2" - rubocop: requires: - ruby2-7_rails6-0 - coverage_report: requires: - ruby2-7_rails6-0 nightly: triggers: - schedule: cron: "0 0 * * *" filters: branches: only: - master jobs: - build: ruby_version: 2.7.1 rails_version: 6.0.3.2 coverage: true name: "ruby2-7_rails6-0" - build: ruby_version: 2.6.6 rails_version: 6.0.3.2 name: "ruby2-6_rails6-0" - build: ruby_version: 2.7.1 rails_version: 5.2.4.3 name: "ruby2-7_rails5-2" - build: ruby_version: 2.6.6 rails_version: 5.2.4.3 name: "ruby2-6_rails5-2" - rubocop: requires: - ruby2-7_rails6-0 - coverage_report: requires: - ruby2-7_rails6-0