Skip to content

Commit

Permalink
Adding CI support
Browse files Browse the repository at this point in the history
  • Loading branch information
etki committed Jul 7, 2017
1 parent 308a2c8 commit 73864eb
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 8 deletions.
1 change: 1 addition & 0 deletions ama-entity-mapper.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion bin/setup
Original file line number Diff line number Diff line change
Expand Up @@ -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
86 changes: 79 additions & 7 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions test/support/rspec/configurator.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# frozen_string_literal: true

require 'rspec'
require 'allure-rspec'
require 'coveralls'

module AMA
module Entity
Expand All @@ -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'
Expand Down

0 comments on commit 73864eb

Please sign in to comment.