Skip to content

[TEST] test examples in CI with CMake Part 1 - #3449

Merged
marcalff merged 9 commits into
open-telemetry:mainfrom
dbarker:test_examples_with_install
Jun 5, 2025
Merged

marcalff merged 9 commits into
open-telemetry:mainfrom
dbarker:test_examples_with_install

Conversation

@dbarker

@dbarker dbarker commented May 29, 2025 •

Copy link
Copy Markdown
Member

Contributes to #454

Adds initial CI testing of examples to address #454

Part 1 focuses on adding a basic tests to:

  1. Build all examples against the installed opentelemetry-cpp package to verify
    • only imported/alias targets are used
    • examples don't rely on internal cmake functions or global includes/declarations
  2. Run a simple test of the single process examples to ensure they run and exit cleanly. These tests are added when WITH_EXAMPLES and BUILD_TESTING CMake options are ON.
    • examples/batch
    • examples/simple
    • examples/logs_simple
    • examples/metrics_simple
    • examples/multithreaded
    • examples/multi_processor
    • examples/etw_threads
    • examples/plugin

The multi-process examples are not run and can be addressed in a future PR.

Changes

  • Remove internal cmake functions from the grpc example and foo* library examples
  • Remove grpc and span exporter headers from the grpc_metric_main.cc example
  • Add simple tests for each of the single process examples
  • Add an install test to build and run the examples based on components installed
  • Clean up the conan build artifacts on the runner to make space for the examples build
  • Link the api target publicly to the dll target
  • Remove running the simple* examples in CI by the cmake.dll.* tests which will now run all new examples tests with ctest.

For significant contributions please make sure you have completed the following items:

  • CHANGELOG.md updated for non-trivial changes
  • Unit tests have been added
  • Changes in public API reviewed

@netlify

netlify Bot commented May 29, 2025 •

Copy link
Copy Markdown

✅ Deploy Preview for opentelemetry-cpp-api-docs canceled.

Name Link
🔨 Latest commit c2106c0
🔍 Latest deploy log https://app.netlify.com/projects/opentelemetry-cpp-api-docs/deploys/6841470c92e0b0000822b5fb

@codecov

codecov Bot commented May 29, 2025 •

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.92%. Comparing base (d64b653) to head (c2106c0).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3449      +/-   ##
==========================================
+ Coverage   89.89%   89.92%   +0.03%     
==========================================
  Files         212      219       +7     
  Lines        6942     7041      +99     
==========================================
+ Hits         6240     6331      +91     
- Misses        702      710       +8     

see 14 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

dbarker added 2 commits May 29, 2025 17:19
…l is set before running tests. Fix warning in grpc example server.cc
@dbarker
dbarker marked this pull request as ready for review May 30, 2025 02:17
@dbarker
dbarker requested a review from a team as a code owner May 30, 2025 02:17

@marcalff marcalff left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@marcalff
marcalff merged commit 549f2b0 into open-telemetry:main Jun 5, 2025
@dbarker
dbarker deleted the test_examples_with_install branch June 5, 2025 20:57
malkia added a commit to malkia/opentelemetry-cpp that referenced this pull request Jun 5, 2025
[TEST] test examples in CI with CMake Part 1 (open-telemetry#3449)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants