-
Notifications
You must be signed in to change notification settings - Fork 546
[CI] Update ci scripts and documentation #4000
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
dbarker
wants to merge
4
commits into
open-telemetry:main
Choose a base branch
from
dbarker:ci_build_tests_with_ninja_and_ci_updates
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
213720b
Update do_ci.sh to use ninja for cmake builds if available. Remove un…
dbarker a516eea
fix ci issues
dbarker 58dd365
Merge remote-tracking branch 'origin/main' into ci_build_tests_with_n…
dbarker f04fe59
Merge branch 'main' into ci_build_tests_with_ninja_and_ci_updates
ThomsonTan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,32 +1,129 @@ | ||
| # Building and running tests as a developer | ||
|
|
||
| CI tests can be run on docker by invoking the script `./ci/run_docker.sh | ||
| ./ci/do_ci.sh {TARGET}`or inside | ||
| [devcontainer](../CONTRIBUTING.md#devcontainer-setup-for-project) | ||
| by invoking the script | ||
| `./ci/do_ci.sh {TARGET}` where the targets are: | ||
|
|
||
| * `cmake.test`: build cmake targets and run tests. | ||
| * `cmake.maintainer.test`: build with cmake and test, in maintainer mode. | ||
| * `cmake.legacy.test`: build cmake targets with gcc 4.8 and run tests. | ||
| * `cmake.c++20.test`: build cmake targets with the C++20 standard and run tests. | ||
| * `cmake.test_example_plugin`: build and test an example OpenTelemetry plugin. | ||
| * `cmake.exporter.otprotocol.test`: build and test the otprotocol exporter | ||
| * `bazel.test`: build bazel targets and run tests. | ||
| * `bazel.legacy.test`: build bazel targets and run tests for the targets meant | ||
| to work with older compilers. | ||
| * `bazel.noexcept`: build bazel targets and run tests with exceptions disabled. | ||
| * `bazel.nortti`: build bazel targets and run tests with runtime type | ||
| identification disabled. | ||
| * `bazel.asan`: build bazel targets and run tests with AddressSanitizer. | ||
| * `bazel.tsan`: build bazel targets and run tests with ThreadSanitizer. | ||
| * `bazel.valgrind`: build bazel targets and run tests under the valgrind memory | ||
| checker. | ||
| * `benchmark`: run all benchmarks. | ||
| * `format`: use `tools/format.sh` to enforce text formatting. | ||
| * `third_party.tags`: store third_party release tags. | ||
| * `code.coverage`: build cmake targets with CXX option `--coverage` and run | ||
| tests. | ||
|
|
||
| Additionally, `./ci/run_docker.sh` can be invoked with no arguments to get a | ||
| docker shell where tests can be run manually. | ||
| # CI Scripts | ||
|
|
||
| `./ci/do_ci.sh` is the main build, test, and validation script used by CI | ||
| and local development. | ||
|
|
||
| ## Usage | ||
|
|
||
| Run targets directly inside the | ||
| [devcontainer](../CONTRIBUTING.md#devcontainer-setup-for-project): | ||
|
|
||
| ```sh | ||
| ./ci/do_ci.sh <target> | ||
| ``` | ||
|
|
||
| Run targets in Docker: | ||
|
|
||
| ```sh | ||
| ./ci/run_docker.sh ./ci/do_ci.sh <target> | ||
| ``` | ||
|
|
||
| You can also run `./ci/run_docker.sh` with no arguments to open an interactive | ||
| Docker shell and invoke targets manually. | ||
|
|
||
| ## Examples | ||
|
|
||
| ### Format Checks | ||
|
|
||
| ```sh | ||
| ./ci/do_ci.sh format | ||
| markdownlint . | ||
| shellcheck --severity=error <path to shell script>.sh | ||
| ``` | ||
|
|
||
| ### Testing | ||
|
|
||
| ```sh | ||
| ./ci/do_ci.sh cmake.maintainer.sync.test | ||
| ./ci/do_ci.sh cmake.c++20.stl.test | ||
| ./ci/run_docker.sh ./ci/do_ci.sh bazel.test | ||
| ``` | ||
|
|
||
| ## Build configuration | ||
|
|
||
| The script accepts several environment variables to configure the build: | ||
|
|
||
| ```sh | ||
| BUILD_DIR=$HOME/build | ||
| BUILD_TYPE=Debug|Release|RelWithDebInfo|MinSizeRel | ||
| CXX_STANDARD=14|17|20|23 | ||
| BUILD_SHARED_LIBS=ON|OFF | ||
| OTELCPP_CMAKE_VERBOSE_BUILD=ON|OFF | ||
| OTELCPP_CMAKE_CACHE_FILE=<cache-file-name> | ||
| ``` | ||
|
|
||
| `OTELCPP_CMAKE_CACHE_FILE` should be the basename of a cache file from | ||
| `test_common/cmake`, for example `all-options-abiv1-preview.cmake` or | ||
| `all-options-abiv2.cmake`. | ||
|
|
||
| ## Targets | ||
|
|
||
| ### Formatting and coverage | ||
|
|
||
| * `format`: Run formatting tools (`clang-format`, `cmake-format`, | ||
| `buildifier`) and fail if files change. | ||
| * `code.coverage`: Build with coverage flags and generate `coverage.info`. | ||
| * `cmake.clang_tidy.test`: Build with `clang-tidy` enabled and emit a build | ||
| log. | ||
|
|
||
| ### Maintainer CMake builds | ||
|
|
||
| These targets use the `all-options-*` cache files in `test_common/cmake` and | ||
| build all CMake components with preview options enabled. | ||
|
|
||
| * `cmake.maintainer.sync.test`: Maintainer mode ABI v1 build with synchronous | ||
| export and tests. | ||
| * `cmake.maintainer.async.test`: Maintainer mode ABI v1 build with async export | ||
| and tests. | ||
| * `cmake.maintainer.abiv2.test`: Maintainer mode ABI v2 build and tests. | ||
| * `cmake.maintainer.yaml.test`: Maintainer mode build with YAML configuration. | ||
|
|
||
| ### CMake language-standard matrix | ||
|
|
||
| These tests build the core API and SDK components in maintainer mode. | ||
|
|
||
| * `cmake.c++14.test`: C++14, WITH_STL=OFF | ||
| * `cmake.c++17.test`: C++17, WITH_STL=OFF | ||
| * `cmake.c++20.test`: C++20, WITH_STL=OFF | ||
| * `cmake.c++23.test`: C++23, WITH_STL=OFF | ||
| * `cmake.c++14.stl.test`: C++14, WITH_STL=CXX14 | ||
| * `cmake.c++17.stl.test`: C++17, WITH_STL=CXX17 | ||
| * `cmake.c++20.stl.test`: C++20, WITH_STL=CXX20 | ||
| * `cmake.c++23.stl.test`: C++23, WITH_STL=CXX23 | ||
|
|
||
| ### CMake feature and packaging tests | ||
|
|
||
| * `cmake.with_async_export.test`: Standard CMake build with async export | ||
| enabled. | ||
| * `cmake.opentracing_shim.test`: OpenTracing shim build and tests. | ||
| * `cmake.opentracing_shim.install.test`: OpenTracing shim install validation | ||
| test. | ||
| * `cmake.exporter.otprotocol.test`: OTLP exporter build and tests. | ||
| * `cmake.exporter.otprotocol.shared_libs.with_static_grpc.test`: OTLP exporter | ||
| test with shared libraries enabled. | ||
| * `cmake.exporter.otprotocol.with_async_export.test`: OTLP exporter test with | ||
| async export enabled. | ||
| * `cmake.w3c.trace-context.build-server`: Build the W3C trace-context test | ||
| server. | ||
| * `cmake.do_not_install.test`: Build and test with installation disabled. | ||
| * `cmake.install.test`: Install-tree validation and downstream CMake package | ||
| test. | ||
| * `cmake.fetch_content.test`: Validate building the project via | ||
| `FetchContent`. | ||
| * `cmake.test_example_plugin`: Build and load-test the example plugin. | ||
|
|
||
| ### Bazel targets | ||
|
|
||
| * `bazel.test`: Build and test all Bazel targets. | ||
| * `bazel.with_async_export.test`: Build and test with async export enabled. | ||
| * `bazel.macos.test`: Build and test using the macOS Bazel configuration. | ||
| * `bazel.legacy.test`: Bazel legacy compatibility test subset. | ||
| * `bazel.noexcept`: Build and test with exceptions disabled where supported. | ||
| * `bazel.nortti`: Build and test with RTTI disabled where supported. | ||
| * `bazel.asan`: Run Bazel tests with AddressSanitizer. | ||
| * `bazel.tsan`: Run Bazel tests with ThreadSanitizer. | ||
| * `bazel.valgrind`: Run Bazel tests under Valgrind. | ||
|
|
||
| ### Benchmarks | ||
|
|
||
| * `benchmark`: Build benchmark binaries and collect result artifacts. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: since
install_bazelisk.shaccepts a version argument, should we passv1.22.1here to preserve the previous devcontainer Bazelisk version? Otherwise this looks like a downgrade.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question. My intent is to try to bring the dev environment closer to the ci environment with this change. All the ci workflows currently use the default version of the script. How about a separate PR for the upgrade?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Script ./ci/install_bazelisk.sh does not take a version as argument, it hard code version v1.16.0.
But I can not find where install_bazelisk.sh is used from today.