Skip to content

Instantly share code, notes, and snippets.

@scherztc
Created June 11, 2020 21:59
Show Gist options
  • Save scherztc/4514526262f834111da150e81b9bde03 to your computer and use it in GitHub Desktop.
Save scherztc/4514526262f834111da150e81b9bde03 to your computer and use it in GitHub Desktop.
version: 2.1
orbs:
samvera: samvera/circleci-orb@0.3.2
jobs:
build:
parameters:
gemfile:
description: "Gemfile to run"
default: "Gemfile"
type: "string"
ruby_version:
description: "Ruby version"
default: "2.6.5"
type: "string"
bundler_version:
type: string
default: '1.17.3'
solr_port:
type: string
default: '8985'
fcrepo_port:
type: string
default: '8986'
fcrepo_version:
type: string
default: '4.7.5'
redis_version:
type: string
default: '4'
mysql_version:
type: string
default: '8.0.19'
executor:
name: 'samvera/ruby_fcrepo_solr_redis'
ruby_version: << parameters.ruby_version >>
# docker:
# specify the version you desire here
# - image: circleci/ruby:<< parameters.ruby_version >>-node-browsers-legacy
# - image: circleci/redis:<<parameters.redis_version>>
# - image: circleci/mysql:<<parameters.mysql_version>>
working_directory: ~/ucrate
environment:
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true
- ENGINE_CART_RAILS_OPTIONS='--skip-git --skip-bundle --skip-listen --skip-spring --skip-yarn --skip-keeps --skip-action-cable --skip-coffee --skip-puma --skip-test'
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "Gemfile.lock" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run:
name: Configure Bundler
command: |
echo 'export BUNDLER_VERSION=$(cat Gemfile.lock | tail -1 | tr -d " ")' >> $BASH_ENV
source $BASH_ENV
gem install bundler -v << parameters.bundler_version >>
- run:
name: Install Dependencies
command: |
bundle install --jobs=4 --retry=3 --path vendor/bundle
sudo apt-get update
sudo apt-get install xvfb libfontconfig wkhtmltopdf
- save_cache:
paths:
- ./vendor/bundle
key: v1-dependencies-{{ checksum "Gemfile.lock" }}
- run: bundle exec rake db:create
- run: bundle exec rake db:schema:load
- run: bundle exec rake db:migrate
# - run: bundle exec rake ci
- run:
name: Rubocop
command: |
gem install rubocop
bundle exec rubocop
# run tests!
- run:
name: Run Tests
command: |
mkdir /tmp/test-results
TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | \
circleci tests split --split-by=timings)"
bundle exec rspec \
--format progress \
--out /tmp/test-results/rspec.xml \
--format progress \
$TEST_FILES
# collect reports
- store_test_results:
path: /tmp/test-results
- store_artifacts:
path: /tmp/test-results
destination: test-results
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment