Skip to content

Commit

Permalink
Output junit
Browse files Browse the repository at this point in the history
  • Loading branch information
TonyCTHsu committed Nov 27, 2024
1 parent 78225f4 commit b7bdcdd
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 16 deletions.
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
when: always
command: |
ls -l tmp/rspec/*.xml
curl -L --fail "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

0 comments on commit b7bdcdd

Please sign in to comment.