@@ -60,6 +60,91 @@ bazel build //examples/simple:example_simple
6060bazel-bin/examples/simple/example_simple
6161```
6262
63+ ### DevContainer Setup for Project
64+
65+ This guide provides instructions on how to set up and use the development
66+ container (` devcontainer ` ) environment to streamline testing and development
67+ for this project. With the DevContainer, you can work in a consistent environment
68+ configured with all the necessary dependencies and tools.
69+
70+ #### Prerequisites
71+
72+ Before getting started, ensure you have the following installed:
73+
74+ * ** Docker** : DevContainers require Docker for containerization.
75+ * ** Visual Studio Code (VSCode)** with the ** Remote - Containers** extension.
76+
77+ #### Getting Started
78+
79+ * ** Open the Project in DevContainer** :
80+
81+ Open the project in VSCode. When prompted to "Reopen in Container," select
82+ this option. If you’re not prompted, you can manually open the container by
83+ selecting ** Remote-Containers: Reopen in Container** from the command palette
84+ (` F1 ` or ` Ctrl+Shift+P ` ).
85+
86+ * ** Container Setup** :
87+
88+ The DevContainer environment will automatically build based on the configuration
89+ files provided (e.g., ` .devcontainer/devcontainer.json ` ). This setup will install
90+ required dependencies, tools, and environment variables needed for the project.
91+
92+ #### Available Commands
93+
94+ Once inside the DevContainer, you can use the following commands to run tests
95+ and CI workflows.
96+
97+ ##### 1. Run Tests with Bazelisk
98+
99+ To run tests with Bazelisk using specific compilation options, use:
100+
101+ ``` bash
102+ bazelisk-linux-amd64 test --copt=-DENABLE_LOGS_PREVIEW
103+ --test_output=errors --cache_test_results=no --copt=-DENABLE_TEST //exporters/otlp/...
104+ ```
105+
106+ ###### Command Breakdown
107+
108+ * ` --copt=-DENABLE_LOGS_PREVIEW ` : Enables preview logs.
109+ * ` --test_output=errors ` : Shows only the errors in the test output.
110+ * ` --cache_test_results=no ` : Forces Bazel to re-run tests without caching.
111+ * ` --copt=-DENABLE_TEST ` : Enables testing capabilities for the target code.
112+ * ` //exporters/otlp/... ` : Specifies the test target path.
113+
114+ ##### 2. Run CI Script
115+
116+ You can also run the CI script provided to perform testing with the
117+ following command as an
118+ example:
119+
120+ ``` bash
121+ bash ci/do_ci.sh cmake.exporter.otprotocol.test
122+ ```
123+
124+ This command initiates the CI pipeline, executing tests specifically for the
125+ ** cmake.exporter.otprotocol** module.
126+
127+ #### Troubleshooting
128+
129+ If you encounter issues:
130+
131+ * ** Rebuild the DevContainer** : From the command palette, run
132+ ** Remote-Containers: Rebuild Container** to reinitialize the environment.
133+ * ** Check Bazelisk and CI Script Logs** : Inspect logs for any configuration or
134+ dependency issues.
135+
136+ #### Additional Notes
137+
138+ * You can adjust compiler options (` --copt ` ) as needed to test additional flags
139+ or enable/disable specific features.
140+ * The test results will be displayed in the terminal within the DevContainer for
141+ easy debugging.
142+
143+ #### Resources
144+
145+ * ** Bazelisk Documentation** : [ https://github.com/bazelbuild/bazelisk ] ( https://github.com/bazelbuild/bazelisk )
146+ * ** VSCode DevContainer Documentation** : [ https://code.visualstudio.com/docs/remote/containers ] ( https://code.visualstudio.com/docs/remote/containers )
147+
63148## Pull Requests
64149
65150### How to Send Pull Requests
0 commit comments