Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JUnit test report upload #4168

Merged
merged 1 commit into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 18 additions & 16 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,20 +97,6 @@ step_compute_bundle_checksum: &step_compute_bundle_checksum
command: |
bundle lock # Create Gemfile.lock
cat Gemfile Gemfile.lock Appraisals gemfiles/*.gemfile 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
step_get_test_agent_trace_check_results: &step_get_test_agent_trace_check_results
run:
name: Get APM Test Agent Trace Check Results
Expand Down Expand Up @@ -278,10 +264,26 @@ orbs:
- docker-wait:
host: "testagent"
port: 9126
- *step_run_all_tests
- run:
name: Run tests
command: |
ln -s .rspec-local.example .rspec-local

bundle exec rake ci
- *step_get_test_agent_trace_check_results
- run:
name: Upload JUnit reports to Datadog
when: always
command: |
ls -l tmp/rspec/*.xml

curl -L --fail --retry 3 "https://github.com/DataDog/datadog-ci/releases/latest/download/datadog-ci_linux-x64" --output "/usr/local/bin/datadog-ci" && chmod +x /usr/local/bin/datadog-ci

datadog-ci version

DD_ENV=ci DATADOG_API_KEY=$JUNIT_UPLOAD_API_KEY DATADOG_SITE=datadoghq.com datadog-ci junit upload --service dd-trace-rb tmp/rspec/
- store_test_results:
path: /tmp/rspec
path: tmp/rspec
- persist_to_workspace:
root: .
paths:
Expand Down
5 changes: 5 additions & 0 deletions .rspec-local.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<% require 'digest' %>
--require spec_helper
--format documentation
--format RspecJunitFormatter
--out <%= "tmp/rspec/" + Digest::MD5.hexdigest(ENV['BUNDLE_GEMFILE'] + ARGV.join) + ".xml" %>
1 change: 1 addition & 0 deletions spec/datadog/release_gem_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
|static-analysis\.datadog\.yml
|\.standard\.yml
|\.standard_todo\.yml
|.rspec-local.example
)
$
}x
Expand Down
Loading