diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 13a340d4..00000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,290 +0,0 @@ -version: 2.1 - -# Common variables, containers, jobs and steps. -job_defaults: &job_defaults - # TODO: We should move away from using a directory - # TODO: that requires root permission to be created. - # TODO: Changing this requires rebuilding all docker images. - # TODO: remove this when using our own Dockerfile for datadog-ci-rb - working_directory: /app - shell: /bin/bash --login - -test_containers: - - &job_parameters - parameters: - ruby_version: - description: Ruby version - type: string - image: - description: Docker image location - type: string - resource_class_to_use: - description: Resource class to use - type: string - default: medium - resource_class: <> - - &container_base_environment - BUNDLE_GEMFILE: /app/Gemfile - # Faster JVM startup: https://github.com/jruby/jruby/wiki/Improving-startup-time#use-the---dev-flag - JRUBY_OPTS: --dev - - &container_parameters_environment - - *container_base_environment - - &container_base - image: <> - environment: *container_parameters_environment - - &test_job_default - <<: *job_defaults - <<: *job_parameters - docker: - - *container_base - -check_exact_bundle_cache_hit: &check_exact_bundle_cache_hit - run: - name: Check if we restored an exact cache of gems that this job requires - # CircleCI doesn't tell us if we had a perfect cache match or partial match. - # To accomplish such check, we save `bundle_checksum` alongside the cached - # gems. After gems are restored, we compare the restored `bundle_checksum`'s - # content with the current commit's `bundle_checksum`. - # - # Because we are using a "soft" approach to our gemset lock files, we allow - # for partial matches to lock files until a new release goes out. - # This means that we might install slightly out of date gems, instead of the - # very latest versions from RubyGems until the next gemset update commit. - command: | - ! cmp -s .circleci/bundle_checksum /usr/local/bundle/bundle_checksum - echo "export CI_BUNDLE_CACHE_HIT=$?" >> $BASH_ENV -save_bundle_checksum: &save_bundle_checksum - run: - name: Save current bundle checksum alongside cached gems - command: | - if [ "$CI_BUNDLE_CACHE_HIT" != 1 ]; then - # Recompute gemfiles/*.lock checksum, as those files might have changed - cat Gemfile Gemfile.lock Appraisals gemfiles/*.gemfile.lock | md5sum > .circleci/bundle_checksum - fi - cp .circleci/bundle_checksum /usr/local/bundle/bundle_checksum -step_bundle_install: &step_bundle_install - run: - name: Install gem dependencies - command: | - if [ "$CI_BUNDLE_CACHE_HIT" != 1 ]; then - bundle install - else - echo "All required gems were found in cache." - fi -step_appraisal_install: &step_appraisal_install - run: - name: Install Appraisal gems - command: | - if [ "$CI_BUNDLE_CACHE_HIT" != 1 ]; then - bundle exec appraisal install - else - bundle exec appraisal generate # Generate the appraisal files to match the lockfiles in the tree - echo "All required gems were found in cache." - fi -step_appraisal_update: &step_appraisal_update - run: - name: Update Appraisal gems - command: - | # Remove all generated gemfiles and lockfiles, resolve, and install dependencies again - bundle exec appraisal update -step_compute_bundle_checksum: &step_compute_bundle_checksum - run: - name: Compute bundle checksum - # This checksum leaves some leeway for changes to Gemfile.lock, as - # we have a "soft" approach to committing gemset changes until release, given - # updating the gemset lock files produces extremely large commits. - command: | - bundle lock # Create Gemfile.lock - cat Gemfile Gemfile.lock Appraisals gemfiles/*.gemfile.lock | md5sum > .circleci/bundle_checksum -step_run_all_tests: &step_run_all_tests - run: - name: Run tests - command: | - # Ensures it's possible to debug hung tests in CI - echo "--format=documentation" >> .rspec-local - - # Configure RSpec metadata exporter - echo " - --format=RspecJunitFormatter - --out='/tmp/rspec/-<%= ARGV.join.gsub('/', '-') %>.xml' - " >> .rspec-local - - bundle exec rake ci - -filters_all_branches_and_tags: &filters_all_branches_and_tags - filters: - tags: - only: /.*/ -filters_only_release_tags: &filters_only_release_tags - filters: - branches: - ignore: /.*/ - tags: - only: /^v\d+(\.\d+){0,3}(\.(alpha|beta|rc)\d+)?$/ - -orbs: - orb: - jobs: - build: - <<: *test_job_default - resource_class: <> - steps: - - checkout - - restore_cache: - keys: - - '{{ .Environment.CIRCLE_CACHE_VERSION }}-bundled-repo-<>-{{ .Environment.CIRCLE_SHA1 }}' - - *step_compute_bundle_checksum - - restore_cache: - keys: - - bundle-{{ .Environment.CIRCLE_CACHE_VERSION }}-{{ checksum ".circleci/images/primary/binary_version" }}-<>-{{ checksum "lib/datadog/ci/version.rb" }}-{{ .Branch }}-{{ checksum ".circleci/bundle_checksum" }} - - bundle-{{ .Environment.CIRCLE_CACHE_VERSION }}-{{ checksum ".circleci/images/primary/binary_version" }}-<>-{{ checksum "lib/datadog/ci/version.rb" }}-{{ .Branch }}- - - bundle-{{ .Environment.CIRCLE_CACHE_VERSION }}-{{ checksum ".circleci/images/primary/binary_version" }}-<>-{{ checksum "lib/datadog/ci/version.rb" }} - - *check_exact_bundle_cache_hit - - *step_bundle_install - - *save_bundle_checksum - - save_cache: - key: '{{ .Environment.CIRCLE_CACHE_VERSION }}-bundled-repo-<>-{{ .Environment.CIRCLE_SHA1 }}' - paths: - - /app - - save_cache: - key: bundle-{{ .Environment.CIRCLE_CACHE_VERSION }}-{{ checksum ".circleci/images/primary/binary_version" }}-<>-{{ checksum "lib/datadog/ci/version.rb" }}-{{ .Branch }}-{{ checksum ".circleci/bundle_checksum" }} - paths: - - /usr/local/bundle - test: - <<: *test_job_default - docker: - - <<: *container_base - parallelism: 8 - steps: - - restore_cache: - keys: - - '{{ .Environment.CIRCLE_CACHE_VERSION }}-bundled-repo-<>-{{ .Environment.CIRCLE_SHA1 }}' - - restore_cache: - keys: - - bundle-{{ .Environment.CIRCLE_CACHE_VERSION }}-{{ checksum ".circleci/images/primary/binary_version" }}-<>-{{ checksum "lib/datadog/ci/version.rb" }}-{{ .Branch }}-{{ checksum ".circleci/bundle_checksum" }} - - *step_run_all_tests - - store_test_results: - path: /tmp/rspec - commands: - docker-wait: - description: Wait for containers to listen on a TCP port. - parameters: - port: - description: TCP port the container is listening on. - type: integer - timeout: - description: How long to wait for the port to be responsive. - type: string - default: 1m - steps: - - run: - name: Wait for container on port <> - command: dockerize -wait 'tcp://localhost:<>' -timeout '<>' - executors: - docker-integration: - docker: - - image: circleci/buildpack-deps:stretch - -job_configuration: - # MRI - - &config-2_7 - <<: *filters_all_branches_and_tags - ruby_version: 'ruby-2.7' - image: ghcr.io/datadog/images-rb/engines/ruby:2.7 - resource_class_to_use: medium+ - - &config-3_0 - <<: *filters_all_branches_and_tags - ruby_version: 'ruby-3.0' - image: ghcr.io/datadog/images-rb/engines/ruby:3.0 - resource_class_to_use: medium+ - - &config-3_1 - <<: *filters_all_branches_and_tags - ruby_version: 'ruby-3.1' - image: ghcr.io/datadog/images-rb/engines/ruby:3.1 - resource_class_to_use: medium+ - - &config-3_2 - <<: *filters_all_branches_and_tags - ruby_version: 'ruby-3.2' - image: ghcr.io/datadog/images-rb/engines/ruby:3.2 - resource_class_to_use: medium+ - - &config-3_3 - <<: *filters_all_branches_and_tags - ruby_version: 'ruby-3.3' - image: ghcr.io/datadog/images-rb/engines/ruby:3.3 - resource_class_to_use: medium+ - - &config-3_4 - <<: *filters_all_branches_and_tags - ruby_version: 'ruby-3.4' - image: ghcr.io/datadog/images-rb/engines/ruby:3.4 - resource_class_to_use: medium+ - # ADD NEW RUBIES HERE - - &config-3_3-small - <<: *config-3_3 - resource_class_to_use: small - - &config-jruby-9_4 - <<: *filters_all_branches_and_tags - ruby_version: 'jruby-9.4' - image: ghcr.io/datadog/images-rb/engines/jruby:9.4 - resource_class_to_use: medium+ - -workflows: - version: 2 - build-and-test: - jobs: - - orb/build: - <<: *config-2_7 - name: build-2.7 - - orb/test: - <<: *config-2_7 - name: test-2.7 - requires: - - build-2.7 - - orb/build: - <<: *config-3_0 - name: build-3.0 - - orb/test: - <<: *config-3_0 - name: test-3.0 - requires: - - build-3.0 - - orb/build: - <<: *config-3_1 - name: build-3.1 - - orb/test: - <<: *config-3_1 - name: test-3.1 - requires: - - build-3.1 - - orb/build: - <<: *config-3_2 - name: build-3.2 - - orb/test: - <<: *config-3_2 - name: test-3.2 - requires: - - build-3.2 - - orb/build: - <<: *config-3_3 - name: build-3.3 - - orb/test: - <<: *config-3_3 - name: test-3.3 - requires: - - build-3.3 - - orb/build: - <<: *config-3_4 - name: build-3.4 - - orb/test: - <<: *config-3_4 - name: test-3.4 - requires: - - build-3.4 - # ADD NEW RUBIES HERE - - orb/build: - <<: *config-jruby-9_4 - name: build-jruby-9.4 - - orb/test: - <<: *config-jruby-9_4 - name: test-jruby-9.4 - requires: - - build-jruby-9.4 diff --git a/.circleci/images/primary/binary_version b/.circleci/images/primary/binary_version deleted file mode 100644 index 0c8af859..00000000 --- a/.circleci/images/primary/binary_version +++ /dev/null @@ -1 +0,0 @@ -ca1182d0e22ebb43c75b3771e56072fe diff --git a/Rakefile b/Rakefile index 1ed7ef79..8853e92f 100644 --- a/Rakefile +++ b/Rakefile @@ -121,17 +121,7 @@ namespace :test do end command = "#{command} '[#{spec_arguments}]'" if spec_arguments - - total_executors = ENV.key?("CIRCLE_NODE_TOTAL") ? ENV["CIRCLE_NODE_TOTAL"].to_i : nil - current_executor = ENV.key?("CIRCLE_NODE_INDEX") ? ENV["CIRCLE_NODE_INDEX"].to_i : nil - - if total_executors && current_executor && total_executors > 1 - @execution_count ||= 0 - @execution_count += 1 - sh(command) if @execution_count % total_executors == current_executor - else - sh(command) - end + sh(command) end end end