diff --git a/.circleci/config.yml b/.circleci/config.yml index d3bbd53..308fb6a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,17 +1,15 @@ ---- - version: 2.1 orbs: gem: doximity/gem-publisher@0 executors: - ruby-latest: + ruby-2-6: resource_class: small docker: - - image: circleci/ruby:2.7.2 + - image: cimg/ruby:2.6 environment: - BUNDLE_VERSION: "~> 2.1.4" + BUNDLE_VERSION: "~> 1.17" # yaml anchor filters master_only: &master_only @@ -35,7 +33,7 @@ version_tags_only: &version_tags_only jobs: build: - executor: ruby-latest + executor: ruby-2-6 steps: - checkout - run: @@ -45,29 +43,22 @@ jobs: - restore_cache: keys: - v1-bundle-{{ checksum "Gemfile.lock" }}- - - run: - name: Install Bundler specific version - command: | - gem install bundler --version "~> 1.17" --force - run: name: Install Ruby Dependencies - command: bundle check --path=vendor/bundle || bundle install + command: bundle check --path=vendor/bundle || bundle install --local --frozen --path=vendor/bundle --jobs=4 --retry=3 && bundle clean - save_cache: key: v1-bundle-{{ checksum "Gemfile.lock" }}- paths: - vendor/bundle - run: name: Run Tests - command: bundle exec rspec + command: bundle exec rake ci:specs - store_test_results: name: Store test results path: tmp/test-results - run: name: Run StandardRB command: bundle exec standardrb - - store_artifacts: - name: Saves documentation - path: doc - persist_to_workspace: root: . paths: @@ -76,41 +67,49 @@ jobs: workflows: version: 2 + trunk: + jobs: + - build: + <<: *master_only + - gem/build: + <<: *master_only + executor: ruby-2-6 + name: gem-build + requires: + - build + pull-requests: jobs: - build: <<: *pr_only - gem/build: - executor: ruby-latest + <<: *pr_only + executor: ruby-2-6 + name: gem-build requires: - build - pre-release-approval: + <<: *pr_only type: approval requires: - - gem/build + - gem-build - gem/publish: - to_nexus: true + <<: *pr_only + name: gem-publish + to_rubygems: true pre_release: true requires: - pre-release-approval context: artifact_publishing - trunk: - jobs: - - build: - <<: *master_only - - gem/build: - executor: ruby-latest - requires: - - build - final-release: jobs: - build: <<: *version_tags_only - gem/build: <<: *version_tags_only - executor: ruby-latest + executor: ruby-2-6 + name: gem-build requires: - build - gem/publish: @@ -119,5 +118,5 @@ workflows: to_rubygems: true pre_release: false requires: - - gem/build + - gem-build context: artifact_publishing diff --git a/.gitignore b/.gitignore index b04a8c8..51e89d0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,9 @@ +.rspec_status +/.ruby-version +/*.gem /.bundle/ -/.yardoc -/_yardoc/ /coverage/ /doc/ /pkg/ /spec/reports/ /tmp/ - -# rspec failure tracking -.rspec_status diff --git a/Rakefile b/Rakefile index c92b11e..2b18c34 100644 --- a/Rakefile +++ b/Rakefile @@ -1,6 +1,9 @@ -require "bundler/gem_tasks" +# frozen_string_literal: true + require "rspec/core/rake_task" +FileList["tasks/*.rake"].each { |task| load task } + RSpec::Core::RakeTask.new(:spec) task default: :spec diff --git a/tasks/ci.rake b/tasks/ci.rake new file mode 100644 index 0000000..a4c996f --- /dev/null +++ b/tasks/ci.rake @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +namespace :ci do + desc "Run specs" + task :specs do + reports = "tmp/test-results/rspec" + sh "mkdir -p #{reports}" + sh "bundle exec rspec ./spec " \ + "--format progress "\ + "--format RspecJunitFormatter " \ + "-o #{reports}/results.xml" + end +end