DataDog / dd-sdk-ios

Datadog SDK for iOS - Swift and Objective-C.
Apache License 2.0
219 stars 127 forks source link

chore: Instrument unit tests with CI Test Visibility `2.5.0` #1999

Closed ncreated closed 2 months ago

ncreated commented 2 months ago

What and why?

📦 This PR enables (back*) the Test Visibility instrumentation for our unit tests. With our tests being more stable in GitLab, we can leverage this instrumentation for more visibility into their performance and runs.

* we disabled Test Visibility a while ago, due to increased number of flaky test runs in Bitrise CI.

How?

Following the documentation, config ENVs are injected to every xcscheme and their values are exported in test.sh. Each scheme is configured to gather code coverage data, so we can later enable ITR.

🐶 This PR only integrates dd-sdk-swift-testing to an extra CI job meant for shadowing regular iOS unit tests runs. If we find our tests stable, we will integrate it to regular "Unit Test" jobs.

Unfortunately, there is no simpler way than applying the same configuration to all 14 schemes. The fact that we centralize tests execution through test.sh helps to control values, but the actual ENV injection must include forwarding it from Environment Variables list in xscheme definition. As explained in docs, the basic DD_TEST_RUNNER=1 ... xcodebuild test -scheme ... only works for Package.swift and not for Xcode project.

ENVs configuration

Review checklist

datadog-datadog-prod-us1[bot] commented 2 months ago

Datadog Report

Branch report: ncreated/chore/ci-visibility-shadow-build Commit report: 5fa648b Test service: dd-sdk-ios

:white_check_mark: 0 Failed, 1848 Passed, 0 Skipped, 1m 15.14s Total Time

ncreated commented 2 months ago

blocking/ We also need to pass CI Provider variables to all tests.