basic_build: &basic_build working_directory: ~/loga docker: - image: cimg/ruby:2.7.5 test_build: &test_build working_directory: ~/loga steps: - checkout - &restore_gems restore_cache: keys: - v2-gems-{{ checksum "Gemfile" }}-{{ checksum "Appraisals"}}-{{ .Environment.CIRCLE_JOB }} - v2-gems-{{ checksum "Gemfile" }} - &bundle_install run: bundle install --jobs 4 --path=vendor/bundle --retry 3 - run: bundle exec appraisal install - &cache_gems save_cache: key: v2-gems-{{ checksum "Gemfile" }}-{{ checksum "Appraisals"}}-{{ .Environment.CIRCLE_JOB }} paths: - gemfiles/vendor/bundle - vendor/bundle - attach_workspace: at: ./tmp - run: RACK_ENV=development bundle exec appraisal rspec - run: RACK_ENV=production bundle exec appraisal rspec - store_artifacts: path: coverage version: 2 jobs: ruby-2.5: docker: - image: circleci/ruby:2.5 <<: *test_build ruby-2.6: docker: - image: circleci/ruby:2.6 <<: *test_build ruby-2.7: docker: - image: cimg/ruby:2.7 - image: redis:7 <<: *test_build ruby-3.0: docker: - image: cimg/ruby:3.0 - image: redis:7 <<: *test_build rubocop: <<: *basic_build steps: - checkout - *restore_gems - *bundle_install - *cache_gems - run: bundle exec rubocop push-to-rubygems: <<: *basic_build steps: - checkout - *restore_gems - *bundle_install - *cache_gems - run: name: Build the gem command: gem build $CIRCLE_PROJECT_REPONAME.gemspec - deploy: name: Publish to rubygems command: | mkdir ~/.gem echo ":rubygems_api_key: $RUBYGEMS_API_KEY" > ~/.gem/credentials chmod 0600 ~/.gem/credentials gem push $CIRCLE_PROJECT_REPONAME-$(echo $CIRCLE_TAG | sed -e 's/v//').gem workflows: version: 2 test-then-push-gem: jobs: - rubocop: filters: tags: only: /.*/ - ruby-2.5: filters: tags: only: /.*/ - ruby-2.6: filters: tags: only: /.*/ - ruby-2.7: filters: tags: only: /.*/ - ruby-3.0: filters: tags: only: /.*/ - push-to-rubygems: context: org-rubygems filters: tags: only: /^v\d.+/ branches: ignore: /.*/ requires: - rubocop - ruby-2.5 - ruby-2.6 - ruby-2.7 - ruby-3.0