dd-sdk-ios icon indicating copy to clipboard operation
dd-sdk-ios copied to clipboard

RUM-7285 Add api-surface step to Lint stage

Open mariedm opened this issue 1 year ago • 2 comments

What and why?

To ensure public API changes are properly updated, I previously added a reminder in our GitHub PR template checklist to run make api-surface. However, this has proven insufficient 🙃 To address this, I am adding an automated step to the CI Lint phase to enforce this check.

How?

  • Add CI Validation:
    • A step is added to the Lint phase that runs make api-surface.
    • The generated API surface files are written to temporary files (api-surface-swift-generated and api-surface-objc-generated).
    • These temporary files are compared with the committed reference files (api-surface-swift and api-surface-objc).
  • CI Behavior:
    • If differences are detected, the CI step exits with an error, prompting contributors to run make api-surface locally and commit the updated reference files.
  • Updated Reference Files:
    • The reference files are updated as needed to reflect recent changes to the public API.

Review checklist

  • [x] Feature or bugfix MUST have appropriate tests (unit, integration)
  • [x] Make sure each commit and the PR mention the Issue number or JIRA reference
  • [ ] Add CHANGELOG entry for user facing changes
  • [x] Add Objective-C interface for public APIs (see our guidelines [internal]) and run make api-surface)

mariedm avatar Nov 15 '24 14:11 mariedm

Datadog Report

Branch report: rum-7285-add-api-surface-step-to-ci Commit report: 4aa62a9 Test service: dd-sdk-ios

:white_check_mark: 0 Failed, 3570 Passed, 0 Skipped, 2m 19.07s Total Time :small_red_triangle_down: Test Sessions change in coverage: 4 decreased, 3 increased, 7 no change

:small_red_triangle_down: Code Coverage Decreases vs Default Branch (4)

  • test DatadogTraceTests iOS 54.11% (-0.11%) - Details
  • test DatadogInternalTests iOS 80.32% (-0.08%) - Details
  • test DatadogInternalTests tvOS 80.41% (-0.02%) - Details
  • test DatadogCrashReportingTests iOS 26.63% (-0.02%) - Details

Update

  • Addressed comments:
    • Removed inline scripts from .gitlab-ci.yml and moved logic to tools/
    • Followed command title printing style
    • Corrected Makefile indentation
  • Split Commands:
    • Generate to create API surface files and Verify to compare with reference files
    • Added new tests for the new Verify command
  • Fixes:
    • Adjusted lint rule in SessionReplayConfiguration to fix api-surface file

mariedm avatar Dec 05 '24 13:12 mariedm

I'm reviving this PR after its priority was bumped; here are the new changes:

  • rebased, which includes v3 release, where each ObjC API has been moved to their feature module (and ObjC module has been removed)
  • added a test for ObjC use case (and a fixture)
  • updated some dependencies, including SourceKitten
  • updated tests to use a temporary directory dynamically created for file generation

As discussed, because this step is adding significant time to CI (~3min), we decided to only run it on commits to the master branch. This will allow us, when preparing a release, to update the listing of APIs if needed.

Additionally, I created a Jira ticket listing some potential optimizations. This might allow us to run this step against the develop branch as well in future iterations.

mariedm avatar Sep 08 '25 14:09 mariedm

/merge

mariedm avatar Sep 10 '25 13:09 mariedm

View all feedbacks in Devflow UI.

2025-09-10 13:29:28 UTC :information_source: Start processing command /merge


2025-09-10 13:29:47 UTC :information_source: MergeQueue: pull request added to the queue

The expected merge time in develop is approximately 1h (p90).


2025-09-10 14:28:23 UTC :information_source: MergeQueue: This merge request was merged