From b3e885176444bd2641065c1bb29ecc14bc85466a Mon Sep 17 00:00:00 2001 From: Arne De Herdt Date: Fri, 13 Mar 2020 10:02:32 +0100 Subject: [PATCH] CircleCI Migration This is the first of several pull requests to bring VertexClient in line with good Rubygems standards. To reduce the size of the original pull-request, we will first perform the migration to CircleCI under the same configuration and settings currently in the source code. --- .circleci/config.yml | 78 ++++++++++++++++++++++++++++++++++++ .gitignore | 2 +- .travis.yml | 25 ------------ CHANGELOG.md | 9 +++++ Gemfile | 5 +++ README.md | 5 ++- bin/rake | 29 ++++++++++++++ lib/vertex_client/version.rb | 2 +- test/test_helper.rb | 11 +++++ 9 files changed, 138 insertions(+), 28 deletions(-) create mode 100644 .circleci/config.yml delete mode 100644 .travis.yml create mode 100644 CHANGELOG.md create mode 100755 bin/rake diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..5b014e1 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,78 @@ +--- +# --------------------------------------------------------------------------------------------------------------------- +# CircleCI Snippets +# +# Reusable snippets are defined below this section. These are yaml fragments that can injected into the standard +# CircleCI configuration, reducing the complexity of the entire block. +# --------------------------------------------------------------------------------------------------------------------- +docker_image: &docker_image + image: 322902370520.dkr.ecr.us-east-1.amazonaws.com/customink/base-ruby-ci:2.1-v2.1 + aws_auth: + aws_access_key_id: ${STAGING_AWS_ACCESS_KEY_ID} + aws_secret_access_key: ${STAGING_AWS_SECRET_ACCESS_KEY} + +# --------------------------------------------------------------------------------------------------------------------- +# CircleCI Commands Configuration +# +# Commands are re-usable steps that can be shared across jobs. For example the installation of gems using bundler or +# waiting on a database connection. By defining them inside the commands section, they can be invoked as any standard +# command on the system, but will already be preconfigured. This allows us to keep the jobs definition small and clean +# --------------------------------------------------------------------------------------------------------------------- +version: 2.1 +commands: + bundle_install: + description: "Performs the bundler installation, relying on the CircleCI cache for performance" + steps: + - restore_cache: + keys: + - bundler-cache-{{ checksum "vertex_client.gemspec" }} + - run: + name: "Bundle Install" + command: bundle install --path=.bundle + - save_cache: + key: bundler-cache-{{ checksum "vertex_client.gemspec" }} + paths: + - .bundle + rubocop: + description: "Runs RuboCop with the correct configuration so the results can be parsed by CircleCI" + steps: + - run: + name: "RuboCop" + command: | + bundle exec rubocop --format junit --out tmp/test-results/rubocop/results.xml + minitest: + description: "Runs Minitest with the correct configuration so it runs in parallel and is configured for CircleCI" + steps: + - run: + name: "Minitest Test Suite" + command: | + cc-test-reporter before-build + bin/test + cc-test-reporter after-build +# --------------------------------------------------------------------------------------------------------------------- +# CircleCI Job Configuration +# +# This section defines all the available jobs that can be executed inside a Workflow. +# Think of a Job as a batch of tasks that need to be performed to setup the environment and perform a specific task +# such as running RSpec, uploading the test results to CodeClimate etc. +# --------------------------------------------------------------------------------------------------------------------- +jobs: + tests: + working_directory: ~/vertex_client + docker: + - <<: *docker_image + environment: + RAILS_ENV: test + CC_TEST_REPORTER_ID: 88a7fd75659a6698f28c8c4c6b60c20f902e26733691b2fe449a65474f22b618 + steps: + - checkout + - bundle_install + - minitest + - store_test_results: + path: test/reports/ +workflows: + version: 2.1 + vertex_client: + jobs: + - tests: + context: customink diff --git a/.gitignore b/.gitignore index cc647b7..f289a5e 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,7 @@ /coverage/ /doc/ /pkg/ -/spec/reports/ +/test/reports/ /tmp/ Gemfile.lock .env.* diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 4f9aa9d..0000000 --- a/.travis.yml +++ /dev/null @@ -1,25 +0,0 @@ ---- -sudo: false -language: ruby -cache: bundler -rvm: - - 2.1.10 - - 2.2.4 - - 2.4.1 - - 2.5.3 - - 2.6.3 -if: branch = master OR type = pull_request -env: - global: - - CC_TEST_REPORTER_ID=88a7fd75659a6698f28c8c4c6b60c20f902e26733691b2fe449a65474f22b618 - - CI=true -before_install: - - bin/setup -before_script: - - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter - - chmod +x ./cc-test-reporter - - ./cc-test-reporter before-build -script: - - bin/test -after_success: - - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..b226131 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,9 @@ +# VertexClient Changelog + +This file tracks all the changes made to the client. +This allows parsers such as Dependabot to provide a clean overview in pull requests. + +## v0.7.0 + +- Introduced CHANGELOG.md +- Migrated to CircleCI for testing diff --git a/Gemfile b/Gemfile index f9d6374..3cd6556 100644 --- a/Gemfile +++ b/Gemfile @@ -4,3 +4,8 @@ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" } # Specify your gem's dependencies in vertex_client.gemspec gemspec + +group :test do + gem 'minitest-ci', require: false + gem 'simplecov', '< 0.18', require: false +end diff --git a/README.md b/README.md index 03a7c9a..e063782 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,9 @@ # VertexClient -[![Build Status](https://travis-ci.org/customink/vertex_client.svg?branch=master)](https://travis-ci.org/customink/vertex_client) [![Maintainability](https://api.codeclimate.com/v1/badges/5f18a48fa18ddfb942f4/maintainability)](https://codeclimate.com/github/customink/vertex_client/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/5f18a48fa18ddfb942f4/test_coverage)](https://codeclimate.com/github/customink/vertex_client/test_coverage) +[![CircleCI](https://circleci.com/gh/customink/vertex_client.svg?style=svg&circle-token=ccfd7815662866d32b9173a55820d897b162220f)](https://circleci.com/gh/customink/vertex_client) +[![Maintainability](https://api.codeclimate.com/v1/badges/5f18a48fa18ddfb942f4/maintainability)](https://codeclimate.com/github/customink/vertex_client/maintainability) +[![Test Coverage](https://api.codeclimate.com/v1/badges/5f18a48fa18ddfb942f4/test_coverage)](https://codeclimate.com/github/customink/vertex_client/test_coverage) +[![Issue Count](https://codeclimate.com/repos/5c33a0c73c23337184000c98/badges/5f18a48fa18ddfb942f4/issue_count.svg)](https://codeclimate.com/repos/5c33a0c73c23337184000c98/feed) The Vertex Client Ruby Gem provides an interface to integrate with _Vertex SMB_ which is also known as [Vertex Cloud Indirect Tax](https://www.vertexinc.com/solutions/products/vertex-cloud-indirect-tax). diff --git a/bin/rake b/bin/rake new file mode 100755 index 0000000..9275675 --- /dev/null +++ b/bin/rake @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'rake' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("rake", "rake") diff --git a/lib/vertex_client/version.rb b/lib/vertex_client/version.rb index f037197..b65d67a 100644 --- a/lib/vertex_client/version.rb +++ b/lib/vertex_client/version.rb @@ -1,3 +1,3 @@ module VertexClient - VERSION = '0.6.8' + VERSION = '0.7.0' end diff --git a/test/test_helper.rb b/test/test_helper.rb index e4fb212..6e3b027 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,3 +1,12 @@ +# frozen_string_literal: true + +# SimpleCov configuration always goes first to ensure that we are generating correct code-coverage reports. +# But we only use SimpleCov on the CI System +if ENV.fetch('CI') { false } + require 'simplecov' + SimpleCov.start +end + $LOAD_PATH.unshift File.expand_path("../../lib", __FILE__) require 'circuitbox' require "simplecov" @@ -7,6 +16,8 @@ require "vcr" require 'byebug' require "mocha/minitest" +require 'minitest-ci' if ENV.fetch('CI') { false } + SimpleCov.start VertexClient.configuration # make sure the client is configured