diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 00000000..1444378b --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,69 @@ +version: 2.1 +orbs: + samvera: samvera/circleci-orb@0 +jobs: + bundle_lint_test: + parameters: + ruby_version: + type: string + default: 2.5.5 + bundler_version: + type: string + default: '2.0.1' + rails_version: + type: string + default: '5.1.6' + solr_config_path: + type: string + fcrepo_version: + type: string + default: '4.7' + solr_port: + type: string + default: '8985' + redis_version: + type: string + default: '4' + docker: + - image: circleci/ruby:<< parameters.ruby_version >>-node-browsers-legacy + - image: ualbertalib/docker-fcrepo4:<< parameters.fcrepo_version>> + environment: + CATALINA_OPTS: "-Djava.awt.headless=true -Dfile.encoding=UTF-8 -server -Xms512m -Xmx1024m -XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=256m -XX:MaxPermSize=256m -XX:+DisableExplicitGC" + - image: solr:7-alpine + command: bin/solr -cloud -noprompt -f -p <> + - image: circleci/redis:<> + - image: circleci/postgres:9.6.2-alpine + parallelism: 4 + environment: + RAILS_VERSION: << parameters.rails_version >> + POSTGRES_DB: circle_test + POSTGRES_HOST: 127.0.0.1 + POSTGRES_USER: postgres + TEST_DB: circle_test + BUNDLE_PATH: vendor/bundle + COVERALLS_PARALLEL: true + BUNDLE_JOBS: 4 + BUNDLE_RETRY: 3 + RAILS_ENV: test + RACK_ENV: test + FCREPO_TEST_PORT: 8080/fcrepo + SPEC_OPTS: --profile 10 --format RspecJunitFormatter --out /tmp/test-results/rspec.xml --format progress + steps: + - samvera/cached_checkout + + - samvera/bundle: + ruby_version: << parameters.ruby_version >> + bundler_version: << parameters.bundler_version >> + + - samvera/install_solr_core: + solr_config_path: << parameters.solr_config_path >> + - samvera/rubocop + - run: bundle exec rake db:create db:schema:load zookeeper:upload + - samvera/parallel_rspec +workflows: + ci: + jobs: + - bundle_lint_test: + ruby_version: "2.5.5" + name: "ruby2-5-5" + solr_config_path: 'solr/config' diff --git a/.coveralls.yml b/.coveralls.yml index 91600595..e50cd9cb 100644 --- a/.coveralls.yml +++ b/.coveralls.yml @@ -1 +1 @@ -service_name: travis-ci +service_name: circleci diff --git a/Gemfile b/Gemfile index 2bc66e1d..e94737b6 100644 --- a/Gemfile +++ b/Gemfile @@ -61,6 +61,7 @@ group :test do # rack-test >= 0.71 does not work with older Capybara versions (< 2.17). See #214 for more details gem 'rack-test', '0.7.0' gem 'rails-controller-testing' + gem 'rspec_junit_formatter' gem 'selenium-webdriver' gem 'webmock' end diff --git a/README.md b/README.md index 1b5045ca..91244437 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Hyku, the Hydra-in-a-Box Repository Application Code: -[![Build Status](https://travis-ci.org/samvera/hyku.svg)](https://travis-ci.org/samvera/hyku) +[![Build Status](https://circleci.com/gh/samvera/hyku.svg?style=svg)](https://circleci.com/gh/samvera/hyku) [![Coverage Status](https://coveralls.io/repos/samvera/hyku/badge.svg?branch=master&service=github)](https://coveralls.io/github/samvera/hyku?branch=master) [![Stories in Ready](https://img.shields.io/waffle/label/samvera/hyku/ready.svg)](https://waffle.io/samvera/hyku) diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 3fd9880a..5748e3c2 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -166,6 +166,10 @@ end config.after do - DatabaseCleaner.clean + begin + DatabaseCleaner.clean + rescue NoMethodError + 'This can happen which the database is gone, which depends on load order of tests' + end end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index a1986576..a34fa547 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -62,7 +62,7 @@ # only run aws tests from CI (or w/ `--tag aws`) and only run it on the main repo, since that # is where the valid aws keys live. TRAVIS_PULL_REQUEST_SLUG is "" when the job is a push job - unless ENV['CI'] && + unless ENV['TRAVIS'] && (ENV['TRAVIS_PULL_REQUEST_SLUG'].match('samvera-labs/hyku') || ENV['TRAVIS_PULL_REQUEST_SLUG'].blank?) config.filter_run_excluding(aws: true) end diff --git a/spec/tasks/rake_spec.rb b/spec/tasks/rake_spec.rb index 1ee5e64f..76315256 100644 --- a/spec/tasks/rake_spec.rb +++ b/spec/tasks/rake_spec.rb @@ -59,8 +59,8 @@ end after(:all) do - Account.find_by(name: 'first').destroy - Account.find_by(name: 'second').destroy + Account.find_by(name: 'first')&.destroy + Account.find_by(name: 'second')&.destroy end before do