Skip to content

Commit

Permalink
Merge pull request #71 from doximity/nexus
Browse files Browse the repository at this point in the history
Host gem on  Nexus
  • Loading branch information
davidbl authored Jan 29, 2020
2 parents 88f8f2e + d662aa4 commit fed651b
Show file tree
Hide file tree
Showing 45 changed files with 286 additions and 71 deletions.
157 changes: 99 additions & 58 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,82 +1,123 @@
version: 2
version: 2.1

workflows:
version: 2
main:
jobs:
- build_2_4
- build_2_5
- build_2_6
jobs:
build_2_4:
orbs:
gem: doximity/gem-publisher@0

executors:
ruby-latest:
resource_class: small
docker:
- image: ruby:2.4
- image: elastic/elasticsearch:6.8.2
- image: circleci/ruby:latest
environment:
- xpack.security.enabled=false
steps:
- restore_cache:
keys:
- gem-cache-2_4-v2-{{ checksum "Gemfile.lock" }}
- gem-cache-2_4-v2-
- checkout
- run:
name: Install Ruby Dependencies
command: bundle install
- run:
name: Run Tests
command: bundle exec rspec
- save_cache:
key: gem-cache-2_4-v2-{{ checksum "Gemfile.lock" }}
paths:
- ./vendor/bundle
- ./vendor/cache
build_2_5:
BUNDLE_VERSION: "~> 1.17"
ruby_2_5:
resource_class: small
docker:
- image: ruby:2.5
- image: circleci/ruby:2.5
environment:
BUNDLE_VERSION: "~> 1.17"
- image: elastic/elasticsearch:6.8.2
environment:
- xpack.security.enabled=false

# yaml anchor filters
master_only: &master_only
filters:
branches:
only: master
tags:
ignore: /.*/
pr_only: &pr_only
filters:
branches:
ignore: master
tags:
ignore: /.*/
version_tags_only: &version_tags_only
filters:
branches:
ignore: /.*/
tags:
only: /^v.*/

jobs:
build_2_5:
executor: ruby_2_5
steps:
- checkout
- run:
name: Install Bundler specific version
command: bundle check --path=vendor/bundle || bundle install --local --frozen --path=vendor/bundle --jobs=4 --retry=3
- restore_cache:
keys:
- gem-cache-2_5-v2-{{ checksum "Gemfile.lock" }}
- gem-cache-2_5-v2-
- checkout
- run:
name: Install Ruby Dependencies
command: bundle install
- run:
name: Run Tests
command: bundle exec rspec
command: bundle install --path=vendor/bundle --jobs=4 --retry=3
- save_cache:
key: gem-cache-2_5-v2-{{ checksum "Gemfile.lock" }}
paths:
- ./vendor/bundle
- ./vendor/cache
build_2_6:
resource_class: small
docker:
- image: ruby:2.5
- image: elastic/elasticsearch:6.8.2
environment:
- xpack.security.enabled=false
steps:
- restore_cache:
keys:
- gem-cache-2_6-v2-{{ checksum "Gemfile.lock" }}
- gem-cache-2_6-v2-
- checkout
- run:
name: Install Ruby Dependencies
command: bundle install
- run:
name: Run Tests
command: bundle exec rspec
- save_cache:
key: gem-cache-2_6-v2-{{ checksum "Gemfile.lock" }}
- persist_to_workspace:
root: .
paths:
- ./vendor/bundle
- ./vendor/cache
- vendor/bundle
workflows:
version: 2
trunk:
jobs:
- build_2_5:
<<: *master_only
- gem/build:
<<: *master_only
executor: ruby-latest
name: gem-build
requires:
- build_2_5

pull-requests:
jobs:
- build_2_5:
<<: *pr_only
- gem/build:
<<: *pr_only
executor: ruby-latest
name: gem-build
requires:
- build_2_5
- pre-release-approval:
<<: *pr_only
type: approval
requires:
- gem-build
- gem/publish:
<<: *pr_only
name: gem-publish
to_nexus: true
pre_release: true
requires:
- pre-release-approval
context: artifact_publishing

final-release:
jobs:
- build_2_5:
<<: *version_tags_only
- gem/build:
<<: *version_tags_only
executor: ruby-latest
name: gem-build
requires:
- build_2_5
- gem/publish:
<<: *version_tags_only
name: gem-publish
to_nexus: true
pre_release: false
requires:
- gem-build
context: artifact_publishing
17 changes: 10 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
*.a
*.bundle
*.log
*.o
*.so
.DS_Store
.rspec_status
/*.gem
/.bundle/
/.ruby-version
/.yardoc
/Gemfile.lock
/_yardoc/
/coverage/
/doc/
/pkg/
/spec/reports/
/tmp/
*.bundle
*.so
*.o
*.a
/vendor/bundle/
mkmf.log
*.log
.DS_Store
23 changes: 23 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
inherit_gem:
dox-style:
- ".rubocop.yml"

Env/UseFetch:
Exclude:
- "./bin/*"

Metrics/BlockLength:
Exclude:
- "./**/*_spec*.rb"
- "./*.gemspec"
- "./spec/*_helper*.rb"
- "Gemfile"

Metrics/ModuleLength:
Exclude:
- "./**/*_spec*.rb"

Metrics/MethodLength:
Exclude:
- "./**/*_spec*.rb"
6 changes: 6 additions & 0 deletions CHANGELOG → CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
Changelog
=========
## 0.13.2
* Release on Nexus using gem-publisher CircleCI Orb
* Packing gems
* bump the version for testing the Nexus repo
v0.13.1
- remove superfluous 'to_ary' delegation that was causing issues downstream
v0.13.0
Expand Down
8 changes: 4 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
source 'https://rubygems.org'
# frozen_string_literal: true
#
# BEFORE changing this file, read https://wiki.doximity.com/articles/gemfile-maintenance
source "https://artifacts.dox.support/repository/gems"

# Specify your gem's dependencies in elasticity.gemspec
gemspec

gem "elasticsearch", "7.2.0"
94 changes: 94 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
PATH
remote: .
specs:
es-elasticity (0.13.2)
activemodel (>= 4.0.0, < 6)
activerecord (>= 4.0.0, < 6)
activesupport (>= 4.0.0, < 6)
elasticsearch (>= 1.0)

GEM
remote: https://artifacts.dox.support/repository/gems/
specs:
activemodel (5.2.4)
activesupport (= 5.2.4)
activerecord (5.2.4)
activemodel (= 5.2.4)
activesupport (= 5.2.4)
arel (>= 9.0)
activesupport (5.2.4)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
arel (9.0.0)
byebug (11.0.1)
codeclimate-test-reporter (1.0.9)
simplecov (<= 0.13)
coderay (1.1.2)
concurrent-ruby (1.1.5)
diff-lcs (1.3)
elasticsearch (7.2.0)
elasticsearch-api (= 7.2.0)
elasticsearch-transport (= 7.2.0)
elasticsearch-api (7.2.0)
multi_json
elasticsearch-transport (7.2.0)
faraday
multi_json
faraday (0.17.1)
multipart-post (>= 1.2, < 3)
i18n (1.7.0)
concurrent-ruby (~> 1.0)
method_source (0.9.2)
minitest (5.13.0)
multi_json (1.14.1)
multipart-post (2.1.1)
oj (3.10.0)
pry (0.12.2)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
rake (10.5.0)
redis (4.1.3)
rspec (3.1.0)
rspec-core (~> 3.1.0)
rspec-expectations (~> 3.1.0)
rspec-mocks (~> 3.1.0)
rspec-core (3.1.7)
rspec-support (~> 3.1.0)
rspec-expectations (3.1.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.1.0)
rspec-mocks (3.1.3)
rspec-support (~> 3.1.0)
rspec-support (3.1.2)
rspec_junit_formatter (0.4.1)
rspec-core (>= 2, < 4, != 2.12.0)
simplecov (0.7.1)
multi_json (~> 1.0)
simplecov-html (~> 0.7.1)
simplecov-html (0.7.1)
thread_safe (0.3.6)
timecop (0.9.1)
tzinfo (1.2.5)
thread_safe (~> 0.1)

PLATFORMS
ruby

DEPENDENCIES
bundler (~> 1.7)
byebug
codeclimate-test-reporter
es-elasticity!
oj
pry
rake (~> 10.0)
redis
rspec (~> 3.1.0)
rspec_junit_formatter
simplecov (~> 0.7.1)
timecop

BUNDLED WITH
1.17.3
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,20 @@ The default persistence strategy changed from SingleIndex to AliasIndex in versi
5. Create a new Pull Request
6. Sign the CLA if you haven't yet. See CONTRIBUTING.md
## Gem documentation
You can find the documentation by going to CircleCI, looking for the `build` job, going to Artifacts and clicking on `index.html`. A visual guide on this can be found in our wiki at [Gems Development: Where to find documentation for our gems](https://wiki.doximity.com/articles/gems-development-where-to-find-documentation-for-our-gems).
## Gem development
After checking out the repo, run `bundle install` to install dependencies. Then, run `rake spec` to run the tests.
You can also run `bundle console` for an interactive prompt that will allow you to experiment.
This repository uses a gem publishing mechanism on the CI configuration, meaning most work related with cutting a new
version is done automatically.
To release a new version, follow the [wiki instructions](https://wiki.doximity.com/articles/gems-development-releasing-new-versions).
## License
MPN is licensed under an Apache 2 license. Contributors are required to sign an contributor license agreement. See LICENSE.txt and CONTRIBUTING.md for more information.
6 changes: 5 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# frozen_string_literal: true

require "bundler/gem_tasks"
require "rspec/core/rake_task"

RSpec::Core::RakeTask.new
FileList["tasks/*.rake"].each { |task| load task }

RSpec::Core::RakeTask.new(:spec)

task default: :spec
4 changes: 4 additions & 0 deletions elasticity.gemspec → es-elasticity.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ Gem::Specification.new do |spec|
spec.license = "MIT"

spec.files = `git ls-files -z`.split("\x0")
spec.files = `git ls-files -z`.split("\x0").reject do |f|
f.match(%r{^(bin|test|spec|vendor|tmp|coverage)/})
end
# spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.executables = []
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
Expand All @@ -29,6 +32,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency "codeclimate-test-reporter"
spec.add_development_dependency "redis"
spec.add_development_dependency "timecop"
spec.add_development_dependency "rspec_junit_formatter"

spec.add_dependency "activesupport", ">= 4.0.0", "< 6"
spec.add_dependency "activemodel", ">= 4.0.0", "< 6"
Expand Down
Loading

0 comments on commit fed651b

Please sign in to comment.