RUM-7285 Add api-surface step to Lint stage
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-generatedandapi-surface-objc-generated). - These temporary files are compared with the committed reference files (
api-surface-swiftandapi-surface-objc).
- A step is added to the Lint phase that runs
- CI Behavior:
- If differences are detected, the CI step exits with an error, prompting contributors to run
make api-surfacelocally and commit the updated reference files.
- If differences are detected, the CI step exits with an error, prompting contributors to run
- 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)
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)
Update
- Addressed comments:
- Removed inline scripts from
.gitlab-ci.ymland moved logic totools/ - Followed command title printing style
- Corrected
Makefileindentation
- Removed inline scripts from
- Split Commands:
Generateto create API surface files andVerifyto compare with reference files- Added new tests for the new
Verifycommand
- Fixes:
- Adjusted lint rule in
SessionReplayConfigurationto fix api-surface file
- Adjusted lint rule in
I'm reviving this PR after its priority was bumped; here are the new changes:
- rebased, which includes
v3release, 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.
/merge
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