.circleci/config.yml in ddtrace-0.49.0 vs .circleci/config.yml in ddtrace-0.50.0
- old
+ new
@@ -82,28 +82,46 @@
- DD_APM_ENABLED=true
- DD_BIND_HOST=0.0.0.0
- DD_API_KEY=invalid_key_but_this_is_fine
- &agent_port 8126
-step_init_bundle_checksum: &step_init_bundle_checksum
+check_exact_bundle_cache_hit: &check_exact_bundle_cache_hit
run:
- name: Initialize bundle cache key
+ 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`.
command: |
- touch .circleci/bundle_checksum
+ ! 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: cp .circleci/bundle_checksum /usr/local/bundle/bundle_checksum
step_bundle_install: &step_bundle_install
run:
name: Install gem dependencies
- command: bundle install
+ command: |
+ if [ "$CI_BUNDLE_CACHE_HIT" != 1 ]; then
+ bundle install
+ else
+ echo "All required gems were found in cache."
+ fi
step_rubocop: &step_rubocop
run:
name: Delint with Rubocop
command: bundle exec rake rubocop
step_appraisal_install: &step_appraisal_install
run:
name: Install Appraisal gems
command: |
- bundle exec appraisal install
+ if [ "$CI_BUNDLE_CACHE_HIT" != 1 ]; then
+ bundle exec appraisal install
+ else
+ 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
@@ -124,14 +142,12 @@
fi
step_compute_bundle_checksum: &step_compute_bundle_checksum
run:
name: Compute bundle checksum
command: |
- # JRuby: Ensure files exist when Appraisal generates no output
- mkdir gemfiles
- touch gemfiles/_.gemfile.lock
- cat Gemfile.lock gemfiles/*.gemfile.lock > .circleci/bundle_checksum
+ bundle lock # Create Gemfile.lock
+ cat Gemfile.lock gemfiles/*.gemfile.lock | md5sum > .circleci/bundle_checksum
step_run_all_tests: &step_run_all_tests
run:
name: Run tests
command: |
echo "
@@ -165,19 +181,17 @@
steps:
- checkout
- restore_cache:
keys:
- '{{ .Environment.CIRCLE_CACHE_VERSION }}-bundled-repo-<<parameters.ruby_version>>-{{ .Environment.CIRCLE_SHA1 }}'
+ - *step_compute_bundle_checksum
- restore_cache:
keys:
- - bundle-{{ .Environment.CIRCLE_CACHE_VERSION }}-<<parameters.ruby_version>>-{{ checksum "lib/ddtrace/version.rb" }}-{{ .Branch }}-{{ checksum "Gemfile" }}-{{ checksum "Appraisals" }}-{{ checksum "ddtrace.gemspec" }}
+ - bundle-{{ .Environment.CIRCLE_CACHE_VERSION }}-<<parameters.ruby_version>>-{{ checksum "lib/ddtrace/version.rb" }}-{{ .Branch }}-{{ checksum ".circleci/bundle_checksum" }}
- bundle-{{ .Environment.CIRCLE_CACHE_VERSION }}-<<parameters.ruby_version>>-{{ checksum "lib/ddtrace/version.rb" }}-{{ .Branch }}-
- bundle-{{ .Environment.CIRCLE_CACHE_VERSION }}-<<parameters.ruby_version>>-{{ checksum "lib/ddtrace/version.rb" }}
- - *step_init_bundle_checksum
- - restore_cache:
- keys:
- - '{{ .Environment.CIRCLE_CACHE_VERSION }}-bundle-<<parameters.ruby_version>>-{{ checksum ".circleci/bundle_checksum" }}'
+ - *check_exact_bundle_cache_hit
- *step_bundle_install
- when:
condition:
equal: [ << parameters.edge >>, true ]
steps:
@@ -187,23 +201,19 @@
not:
equal: [ << parameters.edge >>, true ]
steps:
- *step_appraisal_install # Run on a stable set of gems we integrate with
- *ensure_lockfile_committed
- - *step_compute_bundle_checksum
+ - *save_bundle_checksum
- save_cache:
key: '{{ .Environment.CIRCLE_CACHE_VERSION }}-bundled-repo-<<parameters.ruby_version>>-{{ .Environment.CIRCLE_SHA1 }}'
paths:
- /app
- save_cache:
- key: '{{ .Environment.CIRCLE_CACHE_VERSION }}-bundle-<<parameters.ruby_version>>-{{ checksum ".circleci/bundle_checksum" }}'
+ key: bundle-{{ .Environment.CIRCLE_CACHE_VERSION }}-<<parameters.ruby_version>>-{{ checksum "lib/ddtrace/version.rb" }}-{{ .Branch }}-{{ checksum ".circleci/bundle_checksum" }}
paths:
- /usr/local/bundle
- - save_cache:
- key: bundle-{{ .Environment.CIRCLE_CACHE_VERSION }}-<<parameters.ruby_version>>-{{ checksum "lib/ddtrace/version.rb" }}-{{ .Branch }}-{{ checksum "Gemfile" }}-{{ checksum "Appraisals" }}-{{ checksum "ddtrace.gemspec" }}-{{ checksum ".circleci/bundle_checksum" }}'
- paths:
- - /usr/local/bundle
build_and_test_integration:
executor: docker-integration
parameters:
ruby_version:
description: Ruby version
@@ -247,11 +257,11 @@
- restore_cache:
keys:
- '{{ .Environment.CIRCLE_CACHE_VERSION }}-bundled-repo-<<parameters.ruby_version>>-{{ .Environment.CIRCLE_SHA1 }}'
- restore_cache:
keys:
- - '{{ .Environment.CIRCLE_CACHE_VERSION }}-bundle-<<parameters.ruby_version>>-{{ checksum ".circleci/bundle_checksum" }}'
+ - bundle-{{ .Environment.CIRCLE_CACHE_VERSION }}-<<parameters.ruby_version>>-{{ checksum "lib/ddtrace/version.rb" }}-{{ .Branch }}-{{ checksum ".circleci/bundle_checksum" }}
- run:
name: Set coverage report directory
command: |
# Create a unique coverage directory for this job, to avoid conflicts when merging all results
echo 'export COVERAGE_DIR="$COVERAGE_BASE_DIR/versions/$CIRCLE_JOB/$CIRCLE_NODE_INDEX"' >> $BASH_ENV
@@ -290,11 +300,11 @@
- restore_cache:
keys:
- '{{ .Environment.CIRCLE_CACHE_VERSION }}-bundled-repo-<<parameters.ruby_version>>-{{ .Environment.CIRCLE_SHA1 }}'
- restore_cache:
keys:
- - '{{ .Environment.CIRCLE_CACHE_VERSION }}-bundle-<<parameters.ruby_version>>-{{ checksum ".circleci/bundle_checksum" }}'
+ - bundle-{{ .Environment.CIRCLE_CACHE_VERSION }}-<<parameters.ruby_version>>-{{ checksum "lib/ddtrace/version.rb" }}-{{ .Branch }}-{{ checksum ".circleci/bundle_checksum" }}
- run:
name: Run Benchmark
command: bundle exec appraisal rails5-postgres-sidekiq ruby benchmarks/sidekiq_test.rb 2>&1 1> /dev/null | tee benchmark_results.csv
- run:
name: Run Benchmark without ddtracer
@@ -305,21 +315,21 @@
- restore_cache:
keys:
- '{{ .Environment.CIRCLE_CACHE_VERSION }}-bundled-repo-<<parameters.ruby_version>>-{{ .Environment.CIRCLE_SHA1 }}'
- restore_cache:
keys:
- - '{{ .Environment.CIRCLE_CACHE_VERSION }}-bundle-<<parameters.ruby_version>>-{{ checksum ".circleci/bundle_checksum" }}'
+ - bundle-{{ .Environment.CIRCLE_CACHE_VERSION }}-<<parameters.ruby_version>>-{{ checksum "lib/ddtrace/version.rb" }}-{{ .Branch }}-{{ checksum ".circleci/bundle_checksum" }}
- *step_rubocop
coverage:
<<: *test_job_default
steps:
- restore_cache:
keys:
- '{{ .Environment.CIRCLE_CACHE_VERSION }}-bundled-repo-<<parameters.ruby_version>>-{{ .Environment.CIRCLE_SHA1 }}'
- restore_cache:
keys:
- - '{{ .Environment.CIRCLE_CACHE_VERSION }}-bundle-<<parameters.ruby_version>>-{{ checksum ".circleci/bundle_checksum" }}'
+ - bundle-{{ .Environment.CIRCLE_CACHE_VERSION }}-<<parameters.ruby_version>>-{{ checksum "lib/ddtrace/version.rb" }}-{{ .Branch }}-{{ checksum ".circleci/bundle_checksum" }}
- attach_workspace:
at: /tmp/workspace
- run:
name: Install codecov
command: bundle add codecov
@@ -338,11 +348,11 @@
- restore_cache:
keys:
- '{{ .Environment.CIRCLE_CACHE_VERSION }}-bundled-repo-<<parameters.ruby_version>>-{{ .Environment.CIRCLE_SHA1 }}'
- restore_cache:
keys:
- - '{{ .Environment.CIRCLE_CACHE_VERSION }}-bundle-<<parameters.ruby_version>>-{{ checksum ".circleci/bundle_checksum" }}'
+ - bundle-{{ .Environment.CIRCLE_CACHE_VERSION }}-<<parameters.ruby_version>>-{{ checksum "lib/ddtrace/version.rb" }}-{{ .Branch }}-{{ checksum ".circleci/bundle_checksum" }}
- attach_workspace:
at: /tmp/workspace
- run:
name: Format changelog
command: bundle exec rake changelog:format
@@ -432,14 +442,10 @@
path: pkg/
destination: gem
job_configuration:
# MRI
- - &config-2_0
- <<: *filters_all_branches_and_tags
- ruby_version: '2.0'
- image: palazzem/docker-library:ddtrace_rb_2_0_0
- &config-2_1
<<: *filters_all_branches_and_tags
ruby_version: '2.1'
image: palazzem/docker-library:ddtrace_rb_2_1_10
- &config-2_2
@@ -502,11 +508,10 @@
- build-2.6
- orb/coverage:
<<: *config-2_7
name: coverage
requires:
- - test-2.0
- test-2.1
- test-2.2
- test-2.3
- test-2.4
- test-2.5
@@ -524,65 +529,52 @@
filters:
branches:
only: /bump_to_version_.*/
# Integration
- orb/build_and_test_integration:
- name: build_and_test_integration-2.0
- integration_apps: 'ruby rack'
- ruby_version: '2.0'
- <<: *filters_all_branches_and_tags
- - orb/build_and_test_integration:
name: build_and_test_integration-2.1
- integration_apps: 'ruby rack'
+ integration_apps: 'ruby rack rspec'
ruby_version: '2.1'
<<: *filters_all_branches_and_tags
- orb/build_and_test_integration:
name: build_and_test_integration-2.2
- integration_apps: 'ruby rack'
+ integration_apps: 'ruby rack rspec'
ruby_version: '2.2'
<<: *filters_all_branches_and_tags
- orb/build_and_test_integration:
name: build_and_test_integration-2.3
- integration_apps: 'ruby rack rails-five'
+ integration_apps: 'ruby rack rails-five rspec'
ruby_version: '2.3'
<<: *filters_all_branches_and_tags
- orb/build_and_test_integration:
name: build_and_test_integration-2.4
- integration_apps: 'ruby rack rails-five'
+ integration_apps: 'ruby rack rails-five rspec'
ruby_version: '2.4'
<<: *filters_all_branches_and_tags
- orb/build_and_test_integration:
name: build_and_test_integration-2.5
- integration_apps: 'ruby rack rails-five'
+ integration_apps: 'ruby rack rails-five rspec'
ruby_version: '2.5'
<<: *filters_all_branches_and_tags
- orb/build_and_test_integration:
name: build_and_test_integration-2.6
- integration_apps: 'ruby rack rails-five'
+ integration_apps: 'ruby rack rails-five rspec'
ruby_version: '2.6'
<<: *filters_all_branches_and_tags
- orb/build_and_test_integration:
name: build_and_test_integration-2.7
- integration_apps: 'ruby rack rails-five'
+ integration_apps: 'ruby rack rails-five rspec'
ruby_version: '2.7'
<<: *filters_all_branches_and_tags
- orb/build_and_test_integration:
name: build_and_test_integration-3.0
# TODO: Get Rack & Rails apps working with Ruby 3.0
integration_apps: 'ruby'
ruby_version: '3.0'
<<: *filters_all_branches_and_tags
# MRI
- orb/build:
- <<: *config-2_0
- name: build-2.0
- - orb/test:
- <<: *config-2_0
- name: test-2.0
- requires:
- - build-2.0
- - orb/build:
<<: *config-2_1
name: build-2.1
- orb/test:
<<: *config-2_1
name: test-2.1
@@ -687,11 +679,10 @@
# Release jobs
- "deploy prerelease Gem":
<<: *filters_all_branches_and_tags
requires:
- lint
- - test-2.0
- test-2.1
- test-2.2
- test-2.3
- test-2.4
- test-2.5
@@ -704,11 +695,10 @@
# soon™️ - test-truffleruby-21.0.0
- "deploy release":
<<: *filters_only_release_tags
requires:
- lint
- - test-2.0
- test-2.1
- test-2.2
- test-2.3
- test-2.4
- test-2.5
@@ -731,64 +721,50 @@
only:
- master
jobs:
# Integration
- orb/build_and_test_integration:
- name: build_and_test_integration-2.0
- integration_apps: 'ruby rack'
- ruby_version: '2.0'
- <<: *filters_all_branches_and_tags
- - orb/build_and_test_integration:
name: build_and_test_integration-2.1
- integration_apps: 'ruby rack'
+ integration_apps: 'ruby rack rspec'
ruby_version: '2.1'
<<: *filters_all_branches_and_tags
- orb/build_and_test_integration:
name: build_and_test_integration-2.2
- integration_apps: 'ruby rack'
+ integration_apps: 'ruby rack rspec'
ruby_version: '2.2'
<<: *filters_all_branches_and_tags
- orb/build_and_test_integration:
name: build_and_test_integration-2.3
- integration_apps: 'ruby rack rails-five'
+ integration_apps: 'ruby rack rails-five rspec'
ruby_version: '2.3'
<<: *filters_all_branches_and_tags
- orb/build_and_test_integration:
name: build_and_test_integration-2.4
- integration_apps: 'ruby rack rails-five'
+ integration_apps: 'ruby rack rails-five rspec'
ruby_version: '2.4'
<<: *filters_all_branches_and_tags
- orb/build_and_test_integration:
name: build_and_test_integration-2.5
- integration_apps: 'ruby rack rails-five'
+ integration_apps: 'ruby rack rails-five rspec'
ruby_version: '2.5'
<<: *filters_all_branches_and_tags
- orb/build_and_test_integration:
name: build_and_test_integration-2.6
- integration_apps: 'ruby rack rails-five'
+ integration_apps: 'ruby rack rails-five rspec'
ruby_version: '2.6'
<<: *filters_all_branches_and_tags
- orb/build_and_test_integration:
name: build_and_test_integration-2.7
- integration_apps: 'ruby rack rails-five'
+ integration_apps: 'ruby rack rails-five rspec'
ruby_version: '2.7'
<<: *filters_all_branches_and_tags
- orb/build_and_test_integration:
name: build_and_test_integration-3.0
# TODO: Get Rack & Rails apps working with Ruby 3.0
integration_apps: 'ruby'
ruby_version: '3.0'
<<: *filters_all_branches_and_tags
# MRI
- - orb/build:
- <<: *config-2_0
- name: build-2.0
- edge: true
- - orb/test:
- <<: *config-2_0
- name: test-2.0
- requires:
- - build-2.0
- orb/build:
<<: *config-2_1
name: build-2.1
- orb/test:
<<: *config-2_1
\ No newline at end of file