Skip to content
Open
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
91 changes: 79 additions & 12 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ only-main-filter: &only-main-filter
only: main

commands:
install-qlty:
steps:
- run:
name: Install Qlty CLI
command: |
curl -sL https://qlty.sh | bash

setup-bundler:
steps:
- run:
Expand Down Expand Up @@ -51,6 +58,8 @@ commands:
- install_dependencies
- run:
name: Run unittests
environment:
COVERAGE: 1
command: |
bundle exec rake spec:unit

Expand All @@ -68,6 +77,11 @@ jobs:
- checkout
- setup-bundler
- unittests
- install-qlty
- run:
name: Upload unit test coverage to Qlty
command: |
~/.qlty/bin/qlty coverage publish --tag unit --incomplete coverage/.resultset.json

license_check:
docker:
Expand Down Expand Up @@ -105,8 +119,15 @@ jobs:
- install_dependencies
- run:
name: Integration Tests
environment:
COVERAGE: 1
command: |
bundle exec rake spec:integration
- install-qlty
- run:
name: Upload integration test coverage to Qlty
command: |
~/.qlty/bin/qlty coverage publish --tag integration --incomplete coverage/.resultset.json

docker_container_help_test:
docker:
Expand All @@ -120,6 +141,19 @@ jobs:
docker rmi quay.io/redhat/3scale-toolbox:main || true
docker run --rm -t quay.io/redhat/3scale-toolbox:main 3scale help

complete-coverage:
docker:
- image: cimg/ruby:3.0
working_directory: ~/repo
steps:
- checkout
- install-qlty
- run:
name: Mark coverage as complete
command: |
~/.qlty/bin/qlty coverage complete --tag unit
~/.qlty/bin/qlty coverage complete --tag integration

push-rubygems:
docker:
- image: cimg/ruby:3.0
Expand Down Expand Up @@ -151,8 +185,45 @@ jobs:
docker run --rm -t app 3scale help

workflows:
version: 2
basic_tests:
pr:
when:
not:
equal: [ main, << pipeline.git.branch >> ]
jobs:
- manual_approval:
type: approval
- ruby-30-unittest:
requires:
- manual_approval
filters:
<<: *tag-trigger
- license_check:
requires:
- manual_approval
filters:
<<: *tag-trigger
- help_test:
requires:
- manual_approval
filters:
<<: *tag-trigger
- image-build:
requires:
- manual_approval
filters:
<<: *tag-trigger
- integration_tests:
context: autotestaccount
requires:
- manual_approval
- complete-coverage:
requires:
- ruby-30-unittest
- integration_tests

main:
when:
equal: [ main, << pipeline.git.branch >> ]
jobs:
- ruby-30-unittest:
filters:
Expand All @@ -166,6 +237,12 @@ workflows:
- image-build:
filters:
<<: *tag-trigger
- integration_tests:
context: autotestaccount
- complete-coverage:
requires:
- ruby-30-unittest
- integration_tests
- push-rubygems:
requires:
- ruby-30-unittest
Expand All @@ -175,13 +252,3 @@ workflows:
<<: *tag-trigger
branches:
ignore: /.*/

integration:
jobs:
- manual_approval: # <<< A job that will require manual approval in the web application.
type: approval # <<< This key-value pair will set your workflow to a status of "On Hold"
# On approval of the `hold` job, any successive job that requires the `hold` job will run.
- integration_tests:
context: autotestaccount
requires:
- manual_approval
95 changes: 95 additions & 0 deletions .qlty/qlty.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# This file was automatically generated by `qlty init`.
# You can modify it to suit your needs.
# We recommend you to commit this file to your repository.
#
# This configuration is used by both Qlty CLI and Qlty Cloud.
#
# Qlty CLI -- Code quality toolkit for developers
# Qlty Cloud -- Fully automated Code Health Platform
#
# Try Qlty Cloud: https://qlty.sh
#
# For a guide to configuration, visit https://qlty.sh/d/config
# Or for a full reference, visit https://qlty.sh/d/qlty-toml
config_version = "0"

exclude_patterns = [
"*_min.*",
"*-min.*",
"*.min.*",
"**/.yarn/**",
"**/*.d.ts",
"**/assets/**",
"**/bower_components/**",
"**/build/**",
"**/cache/**",
"**/config/**",
"**/db/**",
"**/deps/**",
"**/dist/**",
"**/extern/**",
"**/external/**",
"**/generated/**",
"**/Godeps/**",
"**/gradlew/**",
"**/mvnw/**",
"**/node_modules/**",
"**/protos/**",
"**/seed/**",
"**/target/**",
"**/templates/**",
"**/testdata/**",
"**/vendor/**",
]

test_patterns = [
"**/test/**",
"**/spec/**",
"**/*.test.*",
"**/*.spec.*",
"**/*_test.*",
"**/*_spec.*",
"**/test_*.*",
"**/spec_*.*",
]

[smells]
mode = "comment"

[[source]]
name = "default"
default = true


[[plugin]]
name = "actionlint"

[[plugin]]
name = "hadolint"

[[plugin]]
name = "osv-scanner"

[[plugin]]
name = "radarlint-iac"
mode = "monitor"

[[plugin]]
name = "ripgrep"
mode = "comment"

[[plugin]]
name = "reek"

[[plugin]]
name = "rubocop"
version = "1.75.2"

[[plugin]]
name = "shellcheck"

[[plugin]]
name = "trufflehog"

[[plugin]]
name = "zizmor"
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ group :development do
end

group :test do
gem 'codecov', require: false
gem 'simplecov', require: false
gem 'simplecov_json_formatter', require: false
end
5 changes: 2 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ GEM
base64 (0.2.0)
bigdecimal (3.1.8)
builder (3.2.4)
codecov (0.6.0)
simplecov (>= 0.15, < 0.22)
coderay (1.1.3)
concurrent-ruby (1.3.4)
connection_pool (2.4.1)
Expand Down Expand Up @@ -124,13 +122,14 @@ PLATFORMS
DEPENDENCIES
3scale_toolbox!
bundler
codecov
dotenv
license_finder (~> 7.2)
pry
rake (~> 13.0)
rspec (~> 3.8)
rubyzip (>= 1.3.0)
simplecov
simplecov_json_formatter
webmock (~> 3.4)

BUNDLED WITH
Expand Down
16 changes: 10 additions & 6 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,16 @@
require 'dotenv'
Dotenv.load

# Codecov
require 'simplecov'
SimpleCov.start
if ENV['CI'] == 'true'
require 'codecov'
SimpleCov.formatter = SimpleCov::Formatter::Codecov
if ENV['COVERAGE'] && !ENV['COVERAGE'].empty?
require 'simplecov'
require 'simplecov_json_formatter'
SimpleCov.start do
formatter SimpleCov::Formatter::MultiFormatter.new([
SimpleCov::Formatter::JSONFormatter,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use 2 spaces for indentation in an array, relative to the first position after the preceding left parenthesis. [rubocop:Layout/FirstArrayElementIndentation]

SimpleCov::Formatter::HTMLFormatter
])

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indent the right bracket the same as the first position after the preceding left parenthesis. [rubocop:Layout/FirstArrayElementIndentation]

add_filter '/spec/'
end
end

require 'webmock/rspec'
Expand Down