version: 2.1 orbs: samvera: samvera/circleci-orb@0 jobs: bundle: parameters: ruby_version: type: string default: 2.5.9 bundler_version: type: string default: 1.17.3 rails_version: type: string default: '5.2.6' executor: name: 'samvera/ruby' ruby_version: << parameters.ruby_version >> resource_class: medium+ environment: RAILS_VERSION: << parameters.rails_version >> NOKOGIRI_USE_SYSTEM_LIBRARIES: true steps: - samvera/cached_checkout - run: name: Check for a branch named 'master' command: | git fetch --all --quiet --prune --prune-tags if [[ -n "$(git branch --all --list master */master)" ]]; then echo "A branch named 'master' was found. Please remove it." echo "$(git branch --all --list master */master)" fi [[ -z "$(git branch --all --list master */master)" ]] - samvera/bundle: ruby_version: << parameters.ruby_version >> bundler_version: << parameters.bundler_version >> # Run rubocop in parallel with caching # This should get added to the orb once proven here - restore_cache: name: Restore rubocop cache keys: - v1-ruby<< parameters.ruby_version >>-bundle{{ checksum "Gemfile.lock" }} - v1-ruby<< parameters.ruby_version >> - v1 - run: name: Run rubocop in parallel command: bundle exec rubocop --parallel - save_cache: name: Save rubocop cache key: v1-ruby<< parameters.ruby_version >>-bundle{{ checksum "Gemfile.lock" }} paths: - ~/.cache - persist_to_workspace: root: ~/ paths: - project/* - project/**/* build: parameters: ruby_version: type: string default: 2.5.9 bundler_version: type: string default: 1.17.3 rails_version: type: string default: '5.2.6' executor: name: 'samvera/ruby_fcrepo_solr_redis_postgres' ruby_version: << parameters.ruby_version >> resource_class: medium+ environment: RAILS_VERSION: << parameters.rails_version >> NOKOGIRI_USE_SYSTEM_LIBRARIES: true ENGINE_CART_RAILS_OPTIONS: --database=postgresql --skip-git --skip-bundle --skip-listen --skip-spring --skip-keeps --skip-test --skip-bootsnap DATABASE_URL: postgresql://postgres@127.0.0.1/circle_test # Hard-coded with data from CircleCI orb, related to https://github.com/samvera-labs/samvera-circleci-orb/issues/42 steps: - attach_workspace: at: ~/ - when: condition: equal: [ '2.5.9', << parameters.ruby_version >> ] steps: - run: name: "Lock browse everything for Ruby 2.5" command: | sed -i.bak "s/browse-everything.*/browse-everything\', \'1.1.2\'/" hyrax.gemspec bundle - samvera/engine_cart_generate: cache_key: v1-internal-test-app-{{ checksum "hyrax.gemspec" }}-{{ checksum ".regen" }}-{{ checksum ".circleci/config.yml" }}-<< parameters.rails_version >>-<< parameters.ruby_version >> - samvera/bundle: ruby_version: << parameters.ruby_version >> bundler_version: << parameters.bundler_version >> - persist_to_workspace: root: ~/ paths: - project/* - project/**/* test: parameters: ruby_version: type: string default: 2.5.9 bundler_version: type: string default: 1.17.3 hyrax_valkyrie: type: string default: "false" executor: name: 'samvera/ruby_fcrepo_solr_redis_postgres' ruby_version: << parameters.ruby_version >> resource_class: medium+ parallelism: 10 environment: HYRAX_VALKYRIE: << parameters.hyrax_valkyrie >> VALKYRIE_SOLR_PORT: 8985 DATABASE_URL: postgresql://postgres@127.0.0.1/circle_test # Hard-coded with data from CircleCI orb, related to https://github.com/samvera-labs/samvera-circleci-orb/issues/42 steps: - attach_workspace: at: ~/ - samvera/install_solr_core: solr_config_path: .internal_test_app/solr/conf - samvera/install_solr_core: solr_config_path: .internal_test_app/solr/conf core_name: hyrax-valkyrie-test # Rerun bundler in case this is a different ruby version than bundle and build steps - samvera/bundle: ruby_version: << parameters.ruby_version >> bundler_version: << parameters.bundler_version >> - run: command: bundle exec rake app:db:migrate - samvera/parallel_rspec # Trigger a workflow on the nurax repository that will deploy the most recent hyrax gem code to https://nurax-dev.curationexperts.com/ deploy: docker: - image: ubuntu steps: - run: name: Install curl command: apt-get update && apt-get install -y curl - run: name: "Trigger Nurax deploy" command: | curl -X POST https://circleci.com/api/v2/project/gh/curationexperts/nurax/pipeline \ --header "Circle-Token: $NURAX_CIRCLECI_TOKEN" \ --header 'Accept: text/plain' \ --header 'Content-Type: application/json' workflows: version: 2 ruby2-5: jobs: - bundle: ruby_version: "2.5.9" rails_version: "5.2.6" - build: ruby_version: "2.5.9" rails_version: "5.2.6" requires: - bundle - test: name: "ruby2-5" ruby_version: "2.5.9" requires: - build ruby2-6: jobs: - bundle: ruby_version: "2.6.7" rails_version: "5.2.6" - build: ruby_version: "2.6.7" rails_version: "5.2.6" requires: - bundle - test: name: "ruby2-6" ruby_version: "2.6.7" requires: - build - test: name: "ruby2-6-valkyrie" ruby_version: "2.6.7" hyrax_valkyrie: "true" requires: - build ruby2-7: jobs: - bundle: ruby_version: "2.7.4" rails_version: "5.2.6" bundler_version: "2.1.4" - build: ruby_version: "2.7.4" rails_version: "5.2.6" bundler_version: "2.1.4" requires: - bundle - test: name: "ruby2-7" ruby_version: "2.7.4" bundler_version: "2.1.4" requires: - build nurax-dev_deploy: jobs: - deploy: filters: branches: only: - main