version: 2.1 library_gemfile: &library_gemfile gemfile: - "./gemfiles/aws_30.gemfile" - "./gemfiles/aws_60.gemfile" - "./gemfiles/cuba_30.gemfile" - "./gemfiles/cuba_40.gemfile" - "./gemfiles/dalli_20.gemfile" - "./gemfiles/dalli_30.gemfile" - "./gemfiles/dalli_32.gemfile" - "./gemfiles/excon_079.gemfile" - "./gemfiles/excon_100.gemfile" - "./gemfiles/graphql_10.gemfile" - "./gemfiles/graphql_20.gemfile" - "./gemfiles/grpc_10.gemfile" - "./gemfiles/net_http_01.gemfile" - "./gemfiles/rack_20.gemfile" - "./gemfiles/rack_30.gemfile" - "./gemfiles/redis_40.gemfile" - "./gemfiles/redis_50.gemfile" - "./gemfiles/rest_client_20.gemfile" - "./gemfiles/resque_122.gemfile" - "./gemfiles/resque_20.gemfile" - "./gemfiles/roda_20.gemfile" - "./gemfiles/roda_30.gemfile" - "./gemfiles/sidekiq_60.gemfile" - "./gemfiles/sidekiq_65.gemfile" - "./gemfiles/sidekiq_70.gemfile" - "./gemfiles/sinatra_22.gemfile" - "./gemfiles/sinatra_30.gemfile" - "./gemfiles/sinatra_40.gemfile" - "./gemfiles/shoryuken_50.gemfile" - "./gemfiles/shoryuken_60.gemfile" - "./gemfiles/mongo_216.gemfile" - "./gemfiles/mongo_219.gemfile" executors: ruby_30: docker: - image: cimg/ruby:3.0-node environment: MEMCACHED_HOST: '127.0.0.1:11211' REDIS_URL: 'redis://127.0.0.1:6379' DATABASE_URL: 'sqlite3::memory:' - image: memcached - image: redis - image: amazon/dynamodb-local - image: minio/minio:latest command: ["server", "/data"] - image: s12v/sns - image: softwaremill/elasticmq-native - image: mongo:5-focal ruby_30_mysql2: docker: - image: cimg/ruby:3.0-node environment: DATABASE_URL: "mysql2://root@127.0.0.1:3306/ci_test" - image: mariadb environment: MYSQL_DATABASE: 'ci_test' MYSQL_USER: 'root' MYSQL_PASSWORD: '' MYSQL_ALLOW_EMPTY_PASSWORD: 'yes' MYSQL_ROOT_PASSWORD: '' MYSQL_ROOT_HOST: '%' ruby_30_postgres: docker: - image: cimg/ruby:3.0-node environment: DATABASE_URL: "postgres://postgres:test@127.0.0.1:5432/ci_test" - image: postgres environment: POSTGRES_PASSWORD: 'test' POSTGRES_DB: 'ci_test' ruby_31: docker: - image: cimg/ruby:3.1-node environment: MEMCACHED_HOST: '127.0.0.1:11211' REDIS_URL: 'redis://127.0.0.1:6379' DATABASE_URL: 'sqlite3::memory:' - image: memcached - image: redis - image: amazon/dynamodb-local - image: minio/minio:latest command: ["server", "/data"] - image: s12v/sns - image: softwaremill/elasticmq-native - image: mongo:5-focal ruby_31_mysql2: docker: - image: cimg/ruby:3.1-node environment: DATABASE_URL: "mysql2://root@127.0.0.1:3306/ci_test" - image: mariadb environment: MYSQL_DATABASE: 'ci_test' MYSQL_USER: 'root' MYSQL_PASSWORD: '' MYSQL_ALLOW_EMPTY_PASSWORD: 'yes' MYSQL_ROOT_PASSWORD: '' MYSQL_ROOT_HOST: '%' ruby_31_postgres: docker: - image: cimg/ruby:3.1-node environment: DATABASE_URL: "postgres://postgres:test@127.0.0.1:5432/ci_test" - image: postgres environment: POSTGRES_PASSWORD: 'test' POSTGRES_DB: 'ci_test' ruby_32: docker: - image: cimg/ruby:3.2-node environment: MEMCACHED_HOST: '127.0.0.1:11211' REDIS_URL: 'redis://127.0.0.1:6379' DATABASE_URL: 'sqlite3::memory:' - image: memcached - image: redis - image: amazon/dynamodb-local - image: minio/minio:latest command: ["server", "/data"] - image: s12v/sns - image: softwaremill/elasticmq-native - image: mongo:5-focal ruby_32_mysql2: docker: - image: cimg/ruby:3.2-node environment: DATABASE_URL: "mysql2://root@127.0.0.1:3306/ci_test" - image: mariadb environment: MYSQL_DATABASE: 'ci_test' MYSQL_USER: 'root' MYSQL_PASSWORD: '' MYSQL_ALLOW_EMPTY_PASSWORD: 'yes' MYSQL_ROOT_PASSWORD: '' MYSQL_ROOT_HOST: '%' ruby_32_postgres: docker: - image: cimg/ruby:3.2-node environment: DATABASE_URL: "postgres://postgres:test@127.0.0.1:5432/ci_test" - image: postgres environment: POSTGRES_PASSWORD: 'test' POSTGRES_DB: 'ci_test' ruby_33: docker: - image: cimg/ruby:3.3-node environment: MEMCACHED_HOST: '127.0.0.1:11211' REDIS_URL: 'redis://127.0.0.1:6379' DATABASE_URL: 'sqlite3::memory:' - image: memcached - image: redis - image: amazon/dynamodb-local - image: minio/minio:latest command: ["server", "/data"] - image: s12v/sns - image: softwaremill/elasticmq-native - image: mongo:5-focal ruby_33_mysql2: docker: - image: cimg/ruby:3.3-node environment: DATABASE_URL: "mysql2://root@127.0.0.1:3306/ci_test" - image: mariadb environment: MYSQL_DATABASE: 'ci_test' MYSQL_USER: 'root' MYSQL_PASSWORD: '' MYSQL_ALLOW_EMPTY_PASSWORD: 'yes' MYSQL_ROOT_PASSWORD: '' MYSQL_ROOT_HOST: '%' ruby_33_postgres: docker: - image: cimg/ruby:3.3-node environment: DATABASE_URL: "postgres://postgres:test@127.0.0.1:5432/ci_test" - image: postgres environment: POSTGRES_PASSWORD: 'test' POSTGRES_DB: 'ci_test' commands: setup: steps: - run: name: Install iproute2 command: | sudo apt-get update sudo apt-get install iproute2 - run: name: Install Java command: | sudo apt-get install openjdk-11-jdk - run: name: Update RubyGems command: | gem update --system gem --version - run: name: Install Bundler command: | gem install bundler bundler --version bundle config set path './vendor/bundle' - run: name: Install Dependencies command: | bundle check || bundle install run_sonarqube: steps: - run: name: Install Java for the SonarQube tool command: | sudo apt-get update sudo apt-get install openjdk-11-jdk - run: name: Install dependencies for coverage merge command: | bundler --version bundle config set path './vendor/bundle' bundle check || bundle install environment: BUNDLE_GEMFILE: './Gemfile' - run: name: Fetching partial coverage reports from workflow jobs command: | ./download.sh - run: name: Merging partial coverage reports for reporting command: | bundle exec rake coverage:merge_reports --trace environment: BUNDLE_GEMFILE: './Gemfile' - run: name: Run SonarQube to capture coverage command: | wget -O /tmp/sonar-scanner-cli.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.8.1.3023.zip unzip -d /tmp /tmp/sonar-scanner-cli.zip if [[ -n "${CIRCLE_PR_NUMBER}" ]]; then /tmp/sonar-scanner-4.8.1.3023/bin/sonar-scanner \ -Dsonar.host.url="${SONARQUBE_URL}" \ -Dsonar.login="${SONARQUBE_LOGIN}" \ -Dsonar.pullrequest.key="${CIRCLE_PR_NUMBER}" \ -Dsonar.pullrequest.branch="${CIRCLE_BRANCH}" else /tmp/sonar-scanner-4.8.1.3023/bin/sonar-scanner \ -Dsonar.host.url="${SONARQUBE_URL}" \ -Dsonar.login="${SONARQUBE_LOGIN}" \ -Dsonar.branch.name="${CIRCLE_BRANCH}" fi - store_artifacts: path: partial_coverage_results - store_artifacts: path: coverage run_tests: steps: - run: name: Run Tests command: | mkdir _junit bundle exec rake - store_test_results: path: ~/project/_junit - store_artifacts: path: coverage run_rubocop: steps: - run: name: Run Tests command: | bundle exec rubocop publish_gem: steps: - run: name: Setup Access command: | mkdir -p ~/.gem echo -e "---\r\n:rubygems_api_key: $RUBYGEMS_API_KEY" > ~/.gem/credentials chmod 0600 /home/circleci/.gem/credentials - run: name: Publish Gem command: | bundle exec rake release[origin] jobs: test_core: parameters: stack: type: executor default: ruby_30 executor: << parameters.stack >> steps: - checkout - setup - run_tests test_apprisal: parameters: stack: type: executor default: ruby_30 gemfile: type: string default: "./gemfiles/aws_30.gemfile" executor: << parameters.stack >> environment: APPRAISAL_INITIALIZED: "1" BUNDLE_GEMFILE: << parameters.gemfile >> steps: - checkout - setup - run_tests lint: executor: ruby_30 steps: - checkout - setup - run_rubocop report_coverage: executor: ruby_32 steps: - checkout - run_sonarqube publish: executor: ruby_30 steps: - checkout - setup - publish_gem workflows: publish: jobs: - publish: filters: branches: ignore: /.*/ tags: only: /^v.*/ core: jobs: - lint - test_core: matrix: parameters: stack: - ruby_30 - ruby_31 - ruby_32 - ruby_33 libraries_ruby_3: jobs: - test_apprisal: matrix: parameters: stack: - ruby_30 - ruby_31 - ruby_32 - ruby_33 <<: *library_gemfile rails_ruby_3: jobs: - test_apprisal: matrix: parameters: stack: - ruby_30 - ruby_30_postgres - ruby_30_mysql2 - ruby_31 - ruby_31_postgres - ruby_31_mysql2 - ruby_32 - ruby_32_postgres - ruby_32_mysql2 - ruby_33_postgres - ruby_33_mysql2 gemfile: - "./gemfiles/rails_61.gemfile" - "./gemfiles/rails_70.gemfile" - "./gemfiles/rails_71.gemfile" report_coverage: jobs: - report_coverage