Skip to content

Commit

Permalink
Bringing in standard versions of files from our wiki
Browse files Browse the repository at this point in the history
  • Loading branch information
jcwilk committed Apr 14, 2022
1 parent 5c3335d commit 9eef5d6
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 35 deletions.
57 changes: 28 additions & 29 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -35,7 +33,7 @@ version_tags_only: &version_tags_only

jobs:
build:
executor: ruby-latest
executor: ruby-2-6
steps:
- checkout
- run:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -119,5 +118,5 @@ workflows:
to_rubygems: true
pre_release: false
requires:
- gem/build
- gem-build
context: artifact_publishing
8 changes: 3 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
.rspec_status
/.ruby-version
/*.gem
/.bundle/
/.yardoc
/_yardoc/
/coverage/
/doc/
/pkg/
/spec/reports/
/tmp/

# rspec failure tracking
.rspec_status
5 changes: 4 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -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
13 changes: 13 additions & 0 deletions tasks/ci.rake
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 9eef5d6

Please sign in to comment.