diff --git a/ama-entity-mapper.gemspec b/ama-entity-mapper.gemspec index a95e8cd..f6c12e9 100644 --- a/ama-entity-mapper.gemspec +++ b/ama-entity-mapper.gemspec @@ -29,4 +29,5 @@ Gem::Specification.new do |spec| spec.add_development_dependency 'rspec', '~> 3.6' spec.add_development_dependency 'rubocop', '~> 0.49' spec.add_development_dependency 'allure-rspec', '~> 0.8.0' + spec.add_development_dependency 'coveralls', '~> 0.8.0' end diff --git a/bin/setup b/bin/setup index 8638873..dce67d8 100755 --- a/bin/setup +++ b/bin/setup @@ -3,6 +3,6 @@ set -euo pipefail IFS=$'\n\t' set -vx -bundle install --path vendor/bundle +bundle install # Do any other automated setup that you need to do here diff --git a/circle.yml b/circle.yml index 0f7c87d..eba6ef4 100644 --- a/circle.yml +++ b/circle.yml @@ -1,17 +1,89 @@ +parameters: + jabba: + version: &jabba_version 0.7.0 + cache_key: &jabba_cache_key v2-jabba-0.7.0 + java: + version: &java_version zulu@1.8.131 + allure: + version: &allure_version 2.2.1 + cache_key: &allure_cache_key v2-allure-2.2.1 + bundler: + cache_key: &bundler_cache_key v2-bundler-{{ checksum "Gemfile" }} + version: 2 jobs: - default: + build: + working_directory: /tmp/workspace docker: - image: circleci/ruby:2.3.4 + environment: + JABBA_VERSION: *jabba_version + JAVA_VERSION: *java_version + ALLURE_VERSION: *allure_version steps: - checkout - - type: cache-restore - key: bundler-{{ checksum "Gemfile" }} - - run: bin/setup - - type: cache-save - key: bundler-{{ checksum "Gemfile" }} + - run: + name: Chores + command: | + mkdir -p test/metadata + - restore-cache: + key: *bundler_cache_key + - restore-cache: + key: *jabba_cache_key + - restore-cache: + key: *allure_cache_key + - run: + name: Install dependencies + command: bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3 + - type: save-cache + key: *bundler_cache_key paths: - vendor/bundle - - type: store_artifacts + - Gemfile.lock + - run: + name: Install Jabba & Java + command: | + set -euxo pipefail + sudo ln -sf ~/.jabba/bin/jabba /usr/local/bin/jabba + [ ! -d ~/.jabba ] || exit 0 + curl -sL https://github.com/shyiko/jabba/raw/master/install.sh | bash && . ~/.jabba/jabba.sh + jabba install $JAVA_VERSION + - type: save-cache + key: *jabba_cache_key + paths: + - ~/.jabba + - run: + name: Install Allure + command: | + set -euxo pipefail + sudo ln -sf ~/allure/bin/allure /usr/local/bin/allure + [ ! $(which allure) ] || exit 0 + curl -L "https://dl.bintray.com/qameta/generic/io/qameta/allure/allure/$ALLURE_VERSION/allure-$ALLURE_VERSION.zip" > /tmp/allure.zip + unzip /tmp/allure.zip -d /tmp/allure + mkdir -p ~/allure + sudo mv /tmp/allure/*/* ~/allure + - type: save-cache + key: *allure_cache_key + paths: + - ~/allure + - run: + name: Lint + command: bundle exec rake lint + - run: + name: Test + command: bundle exec rake test + when: always + - type: store-artifacts + path: test/metadata + destination: metadata + when: always + - run: + name: Generate Allure report + command: | + export JAVA_HOME="$(jabba which $JAVA_VERSION)" + bundle exec rake test:report + when: always + - type: store-artifacts path: test/report/allure destination: allure + when: always diff --git a/test/support/rspec/configurator.rb b/test/support/rspec/configurator.rb index 3e6c451..05ee762 100644 --- a/test/support/rspec/configurator.rb +++ b/test/support/rspec/configurator.rb @@ -1,5 +1,8 @@ +# frozen_string_literal: true + require 'rspec' require 'allure-rspec' +require 'coveralls' module AMA module Entity @@ -9,6 +12,7 @@ module RSpec class Configurator class << self def configure(test_type) + Coveralls.wear! ::RSpec.configure do |config| # Enable flags like --only-failures and --next-failure config.example_status_persistence_file_path = '.rspec_status'