version: 2.1 executors: ruby_25: docker: - image: circleci/ruby:2.5-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: circleci/dynamodb - image: minio/minio:latest command: ["server", "/data"] - image: s12v/sns - image: softwaremill/elasticmq-native - image: circleci/mongo:5-focal-ram ruby_26: docker: - image: circleci/ruby:2.6-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: circleci/dynamodb - image: minio/minio:latest command: ["server", "/data"] - image: s12v/sns - image: softwaremill/elasticmq-native - image: circleci/mongo:5-focal-ram ruby_27: docker: - image: circleci/ruby:2.7-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: circleci/dynamodb - image: minio/minio:latest command: ["server", "/data"] - image: s12v/sns - image: softwaremill/elasticmq-native - image: circleci/mongo:5-focal-ram ruby_25_mysql2: docker: - image: circleci/ruby:2.5-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_26_mysql2: docker: - image: circleci/ruby:2.6-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_27_mysql2: docker: - image: circleci/ruby:2.7-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_25_postgres: docker: - image: circleci/ruby:2.6-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_26_postgres: docker: - image: circleci/ruby:2.6-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_27_postgres: docker: - image: circleci/ruby:2.7-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 Depdendecies command: | bundle check || bundle install run_sonarqube: steps: - run: name: Install Java command: | sudo apt-get update sudo apt-get install openjdk-11-jdk - 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.6.2.2472.zip unzip -d /tmp /tmp/sonar-scanner-cli.zip if [[ -n "${CIRCLE_PR_NUMBER}" ]]; then /tmp/sonar-scanner-4.6.2.2472/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.6.2.2472/bin/sonar-scanner \ -Dsonar.host.url="${SONARQUBE_URL}" \ -Dsonar.login="${SONARQUBE_LOGIN}" \ -Dsonar.branch.name="${CIRCLE_BRANCH}" fi run_tests: steps: - run: name: Run Tests command: | mkdir _junit bundle exec rake - store_test_results: path: ~/project/_junit 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_27 executor: << parameters.stack >> steps: - checkout - setup - run_tests test_apprisal: parameters: stack: type: executor default: ruby_27 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_27 steps: - checkout - setup - run_rubocop - run_sonarqube publish: executor: ruby_27 steps: - checkout - setup - publish_gem workflows: publish: jobs: - publish: filters: branches: ignore: /.*/ tags: only: /^v.*/ core: jobs: - lint - test_core: matrix: parameters: stack: - ruby_27 - ruby_26 - ruby_25 libraries: jobs: - test_apprisal: matrix: parameters: stack: - ruby_27 - ruby_26 - ruby_25 gemfile: - "./gemfiles/aws_30.gemfile" - "./gemfiles/cuba_30.gemfile" - "./gemfiles/dalli_20.gemfile" - "./gemfiles/excon_02.gemfile" - "./gemfiles/excon_079.gemfile" - "./gemfiles/graphql_10.gemfile" - "./gemfiles/grpc_10.gemfile" - "./gemfiles/net_http_01.gemfile" - "./gemfiles/rack_16.gemfile" - "./gemfiles/rack_20.gemfile" - "./gemfiles/redis_40.gemfile" - "./gemfiles/rest_client_16.gemfile" - "./gemfiles/rest_client_20.gemfile" - "./gemfiles/resque_122.gemfile" - "./gemfiles/resque_20.gemfile" - "./gemfiles/roda_20.gemfile" - "./gemfiles/roda_30.gemfile" - "./gemfiles/sidekiq_42.gemfile" - "./gemfiles/sidekiq_50.gemfile" - "./gemfiles/sinatra_14.gemfile" - "./gemfiles/shoryuken_50.gemfile" - "./gemfiles/mongo_216.gemfile" rails: jobs: - test_apprisal: matrix: parameters: stack: - ruby_27 - ruby_26 - ruby_25 - ruby_27_postgres - ruby_26_postgres - ruby_25_postgres - ruby_27_mysql2 - ruby_26_mysql2 - ruby_25_mysql2 gemfile: - "./gemfiles/rails_60.gemfile" - "./gemfiles/rails_52.gemfile" - "./gemfiles/rails_50.gemfile"