Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
213 changes: 213 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,213 @@
---

version: 2.1

defaults: &defaults
working_directory: ~/ruby-rspec-mock
docker:
- image: cimg/ruby:<< parameters.ruby-version >>

orbs:
ruby: circleci/[email protected]

references:
bundle_install: &bundle_install
run:
name: Installing gems
command: |
bundle config set --local path '~/vendor/bundle'
bundle install

install_linters: &install_linters
run:
name: Installing bunch of linters
command: |
curl -1sLf 'https://dl.cloudsmith.io/public/evilmartians/lefthook/setup.deb.sh' | sudo -E bash
sudo apt-get update -y
sudo apt-get install -y lefthook shellcheck yamllint
npm install --prefix='~/.local' --global --save-dev git+https://github.com/streetsidesoftware/cspell-cli markdownlint-cli
cp .circleci/linter_configs/.fasterer.yml .fasterer.yml
cp .circleci/linter_configs/.lefthook.yml lefthook.yml

install_codeclimate_reporter: &install_codeclimate_reporter
run:
name: Installing CodeClimate test reporter
command: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter

use_latest_bundler: &use_latest_bundler
run:
name: Using latest bundler
command: gem install bundler

use_latest_gemspec: &use_latest_gemspec
run:
name: Using latest gemspec
command: cp .circleci/gemspecs/latest rspec-mock.gemspec

use_compatible_gemspec: &use_compatible_gemspec
run:
name: Using compatible gemspec
command: cp .circleci/gemspecs/compatible rspec-mock.gemspec

jobs:
linters-ruby:
parameters:
ruby-version:
type: string

<<: *defaults

steps:
- checkout

- <<: *use_latest_bundler
- <<: *use_latest_gemspec
- <<: *bundle_install
- <<: *install_linters

- run:
name: Running commit linters
command: lefthook run commit-linters

- run:
name: Running code style linters
command: lefthook run code-style-linters

- run:
name: Running code performance linters
command: lefthook run code-performance-linters

- run:
name: Running code vulnerability linters
command: lefthook run code-vulnerability-linters

- run:
name: Running code documentation linters
command: lefthook run code-documentation-linters

- run:
name: Running release linters
command: lefthook run release-linters

tests-ruby:
parameters:
ruby-version:
type: string

<<: *defaults

steps:
- checkout

- <<: *use_latest_bundler
- <<: *use_latest_gemspec
- <<: *bundle_install
- <<: *install_codeclimate_reporter

- run:
name: Running RSpec
command: |
./cc-test-reporter before-build
bundle exec rspec

# - run:
# name: Creating CodeClimate test coverage report
# command: |
# ./cc-test-reporter format-coverage -t simplecov -o "coverage/codeclimate.$CIRCLE_NODE_INDEX.json"

- store_artifacts:
name: Saving Simplecov coverage artifacts
path: ~/ruby-rspec-mock/coverage
destination: coverage

# - deploy:
# name: Uploading CodeClimate test coverage report
# command: |
# ./cc-test-reporter sum-coverage --output - --parts $CIRCLE_NODE_TOTAL coverage/codeclimate.*.json | ./cc-test-reporter upload-coverage --debug --input -

compatibility-ruby:
parameters:
ruby-version:
type: string

<<: *defaults

steps:
- checkout

- <<: *use_compatible_gemspec

- ruby/install-deps:
bundler-version: "2.3.26"
with-cache: false
path: '~/vendor/custom_bundle'

- run:
name: Running compatibility tests
command: bundle exec rspec

rubygems-deps-ruby:
parameters:
ruby-version:
type: string

<<: *defaults

steps:
- checkout

- run:
name: Building rubygems dependencies from default gemspec on minimal Ruby version
command: bundle install

releasing-gem-from-ruby:
parameters:
ruby-version:
type: string

<<: *defaults

steps:
- checkout

- add_ssh_keys:
fingerprints:
- "SHA256:4Lk72FCartM+nybIinFywO/2wfXf3MqDcVKz0aGq/6I"

- run:
name: Publishing new release
command: ./.circleci/scripts/release.sh

workflows:
build_test_deploy:
jobs:
- linters-ruby:
matrix:
parameters:
ruby-version: ["3.3-node"]
- tests-ruby:
matrix:
parameters:
ruby-version: ["3.3"]
- compatibility-ruby:
matrix:
parameters:
ruby-version: ["2.5", "2.6", "2.7", "3.0", "3.1", "3.2"]
- rubygems-deps-ruby:
matrix:
parameters:
ruby-version: ["2.5"]
- releasing-gem-from-ruby:
requires:
- linters-ruby
- tests-ruby
- compatibility-ruby
- rubygems-deps-ruby
matrix:
parameters:
ruby-version: ["2.5"]
filters:
branches:
only: master
23 changes: 23 additions & 0 deletions .circleci/gemspecs/compatible
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# frozen_string_literal: true

require_relative 'lib/rspec/mock/version'

Gem::Specification.new do |spec|
spec.name = 'rspec-mock'
spec.version = RSpec::Mock::VERSION
spec.authors = ['Vladislav Trotsenko']
spec.email = %w[[email protected]]
spec.summary = %(RSpec::Mock - seamless migration from third-party mocks to RSpec built-in mocking framework)
spec.description = %(RSpec::Mock - seamless migration from third-party mocks to RSpec built-in mocking framework.)
spec.homepage = 'https://github.com/mocktools/ruby-rspec-mock'
spec.license = 'MIT'

spec.required_ruby_version = '>= 2.5.0'
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
spec.require_paths = %w[lib]

spec.add_runtime_dependency 'rspec-core', '~> 3.13', '>= 3.13.2'
spec.add_runtime_dependency 'rspec-mocks', '~> 3.13', '>= 3.13.2'

spec.add_development_dependency 'rspec', '~> 3.13'
end
32 changes: 32 additions & 0 deletions .circleci/gemspecs/latest
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# frozen_string_literal: true

require_relative 'lib/rspec/mock/version'

Gem::Specification.new do |spec|
spec.name = 'rspec-mock'
spec.version = RSpec::Mock::VERSION
spec.authors = ['Vladislav Trotsenko']
spec.email = %w[[email protected]]
spec.summary = %(RSpec::Mock - seamless migration from third-party mocks to RSpec built-in mocking framework)
spec.description = %(RSpec::Mock - seamless migration from third-party mocks to RSpec built-in mocking framework.)
spec.homepage = 'https://github.com/mocktools/ruby-rspec-mock'
spec.license = 'MIT'

spec.required_ruby_version = '>= 2.5.0'
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
spec.require_paths = %w[lib]

spec.add_runtime_dependency 'rspec-core', '~> 3.13', '>= 3.13.2'
spec.add_runtime_dependency 'rspec-mocks', '~> 3.13', '>= 3.13.2'

spec.add_development_dependency 'bundler-audit', '~> 0.9.2'
spec.add_development_dependency 'fasterer', '~> 0.11.0'
spec.add_development_dependency 'pry-byebug', '~> 3.10', '>= 3.10.1'
spec.add_development_dependency 'rake', '~> 13.2', '>= 13.2.1'
spec.add_development_dependency 'reek', '~> 6.3'
spec.add_development_dependency 'rspec', '~> 3.13'
spec.add_development_dependency 'rubocop', '~> 1.66', '>= 1.66.1'
spec.add_development_dependency 'rubocop-performance', '~> 1.22', '>= 1.22.1'
spec.add_development_dependency 'rubocop-rspec', '~> 3.1'
spec.add_development_dependency 'simplecov', '~> 0.22.0'
end
4 changes: 4 additions & 0 deletions .circleci/linter_configs/.bundler-audit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---

ignore:
- EXA-MPLE-XXXX
36 changes: 36 additions & 0 deletions .circleci/linter_configs/.commitspell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---

enableGlobDot: true

patterns:
- name: GithubUser
pattern: /\[@.+\]/gmx

languageSettings:
- languageId: markdown
ignoreRegExpList:
- Email
- GithubUser

words:
- bagage
- bagages
- bestwebua
- changeloglint
- configurator
- codebases
- codeclimate
- commitspell
- ffaker
- gemspecs
- hostnames
- lefthook
- markdownlint
- mocktools
- mdlrc
- rubocop
- shortcuting
- simplecov
- stdlib
- substeps
- yamlint
27 changes: 27 additions & 0 deletions .circleci/linter_configs/.cspell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---

enableGlobDot: true

patterns:
- name: GithubUser
pattern: /\[@.+\]/gmx
- name: MarkdownCode
pattern: /`{1,3}.+`{1,3}/gmx
- name: MarkdownCodeBlock
pattern: /^\s*```[\s\S]*?^\s*```/gmx

languageSettings:
- languageId: markdown
ignoreRegExpList:
- Email
- GithubUser
- MarkdownCode
- MarkdownCodeBlock

words:
- Commiting
- Trotsenko
- Vladislav
- bestwebua
- codebases
- gemspecs
4 changes: 4 additions & 0 deletions .circleci/linter_configs/.fasterer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---

exclude_paths:
- '.circleci/**/*.rb'
44 changes: 44 additions & 0 deletions .circleci/linter_configs/.lefthook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---

no_tty: true
skip_output:
- meta

commit-linters:
commands:
commitspell:
run: .circleci/scripts/commitspell.sh -c '.circleci/linter_configs/.commitspell.yml'

code-style-linters:
commands:
reek:
run: bundle exec reek
rubocop:
run: bundle exec rubocop -c '.circleci/linter_configs/.rubocop.yml'
shellcheck:
glob: '*.{sh}'
run: shellcheck --norc {all_files}
yamllint:
run: yamllint -c '.circleci/linter_configs/.yamllint.yml' .

code-performance-linters:
commands:
fasterer:
run: bundle exec fasterer

code-vulnerability-linters:
commands:
bundle-audit:
run: bundle exec bundle-audit check -c '.circleci/linter_configs/.bundler-audit.yml' --update

code-documentation-linters:
commands:
cspell:
run: cspell-cli lint -c '.circleci/linter_configs/.cspell.yml' '**/*.{txt,md}'
markdownlint:
run: markdownlint -c '.circleci/linter_configs/.markdownlint.yml' '**/*.md'

release-linters:
commands:
changeloglint:
run: .circleci/scripts/changeloglint.sh
Loading