action.proto 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  1. // Copyright 2021 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. syntax = "proto3";
  15. package google.devtools.resultstore.v2;
  16. import "google/api/resource.proto";
  17. import "google/devtools/resultstore/v2/common.proto";
  18. import "google/devtools/resultstore/v2/coverage.proto";
  19. import "google/devtools/resultstore/v2/file.proto";
  20. import "google/devtools/resultstore/v2/file_processing_error.proto";
  21. import "google/devtools/resultstore/v2/test_suite.proto";
  22. import "google/protobuf/duration.proto";
  23. option go_package = "google.golang.org/genproto/googleapis/devtools/resultstore/v2;resultstore";
  24. option java_multiple_files = true;
  25. option java_outer_classname = "ActionProto";
  26. option java_package = "com.google.devtools.resultstore.v2";
  27. // An action that happened as part of a configured target. This action could be
  28. // a build, a test, or another type of action, as specified in action_type
  29. // oneof.
  30. //
  31. // Each parent ConfiguredTarget resource should have at least one Action as its
  32. // child resource before the invocation is finalized. For a simple build, at
  33. // least one build action should be created to represent the build result, and
  34. // at least one test action should be created to represent the test result, if
  35. // any.
  36. message Action {
  37. option (google.api.resource) = {
  38. type: "resultstore.googleapis.com/Action"
  39. pattern: "invocations/{invocation}/targets/{target}/configuredTargets/{configured_target}/actions/{action}"
  40. };
  41. // The resource ID components that identify the Action.
  42. message Id {
  43. // The Invocation ID.
  44. string invocation_id = 1;
  45. // The Target ID.
  46. string target_id = 2;
  47. // The Configuration ID.
  48. string configuration_id = 3;
  49. // The Action ID.
  50. string action_id = 4;
  51. }
  52. // The resource name. Its format must be:
  53. // invocations/${INVOCATION_ID}/targets/${url_encode(TARGET_ID)}/configuredTargets/url_encode(${CONFIG_ID})/actions/${url_encode(ACTION_ID)}
  54. //
  55. // See CreateActionRequest proto for more information.
  56. string name = 1;
  57. // The resource ID components that identify the Action. They must match the
  58. // resource name after proper encoding.
  59. Id id = 2;
  60. // The status of the action.
  61. StatusAttributes status_attributes = 3;
  62. // The timing of the whole action. For TestActions, the start time may be
  63. // before the test actually started, and the duration may last until after the
  64. // test actually finished.
  65. Timing timing = 4;
  66. // The type of the action. The type of an action may not change over the
  67. // lifetime of the invocation. If one of these fields is to be set, it must be
  68. // set in the CreateAction method. It may be set to an empty message that is
  69. // populated in later methods or post-processing. A generic "untyped" action
  70. // can be created by not setting any of these fields. An untyped action will
  71. // be untyped for the lifetime of the invocation.
  72. oneof action_type {
  73. // Used only when this action represents a build action.
  74. BuildAction build_action = 9;
  75. // Only for test actions.
  76. TestAction test_action = 10;
  77. }
  78. // General attributes of the action.
  79. ActionAttributes action_attributes = 5;
  80. // A list of resources that this action depended upon. May be used to provide
  81. // the cause of a build failure in the case of a failed build action.
  82. repeated Dependency action_dependencies = 14;
  83. // Arbitrary name-value pairs.
  84. // This is implemented as a multi-map. Multiple properties are allowed with
  85. // the same key. Properties will be returned in lexicographical order by key.
  86. repeated Property properties = 7;
  87. // A list of file references for action level files.
  88. // The file IDs must be unique within this list. Duplicate file IDs will
  89. // result in an error. Files will be returned in lexicographical order by ID.
  90. //
  91. // Files with the following reserved file IDs cause specific post-processing
  92. // or have special handling. These files must be immediately available to
  93. // ResultStore for processing when the reference is uploaded.
  94. //
  95. // For build actions:
  96. // stdout: The stdout of the action
  97. // stderr: The stderr of the action
  98. // baseline.lcov: Baseline coverage file to be parsed by the server. This
  99. // uses a stripped down implementation of the LCOV standard.
  100. // http://ltp.sourceforge.net/coverage/lcov/geninfo.1.php
  101. //
  102. // For test actions:
  103. // test.xml: The test suite / test case data in XML format.
  104. // test.log: The combined stdout and stderr of the test process.
  105. // test.lcov: Coverage file to be parsed by the server. This uses a stripped
  106. // down implementation of the LCOV standard.
  107. // http://ltp.sourceforge.net/coverage/lcov/geninfo.1.php
  108. repeated File files = 8;
  109. // List of names of file sets that are referenced from this Action.
  110. // Each name must point to a file set under the same Invocation. The name
  111. // format must be: invocations/${INVOCATION_ID}/fileSets/${FILE_SET_ID}
  112. repeated string file_sets = 15;
  113. // Coverage data was collected while running the build or test action. This
  114. // usually includes line coverage, and may also include branch coverage.
  115. // For test actions, this is usually only for the source files which were
  116. // actually executed by that particular action.
  117. // For build actions, this is the baseline coverage, which captures the
  118. // instrumented files and lines, without any lines being executed. This
  119. // ensures files that are never covered at all are included.
  120. ActionCoverage coverage = 11;
  121. // ResultStore will read and parse Files with reserved IDs listed above. Read
  122. // and parse errors for all these Files are reported here.
  123. // This is implemented as a map, with one FileProcessingErrors for each file.
  124. // Typically produced when parsing Files, but may also be provided directly
  125. // by clients.
  126. repeated FileProcessingErrors file_processing_errors = 13;
  127. }
  128. // A build action, such as building a java library.
  129. message BuildAction {
  130. // The type of the action. This is intended to be a clue as to how the output
  131. // of the action should be parsed. For example "javac" for a Java compile
  132. // action.
  133. string type = 1;
  134. // The "primary" input artifact processed by this action. E.g., the .cc file
  135. // of a C++ compile action. Empty string ("") if the action has no input
  136. // artifacts or no "primary" input artifact.
  137. string primary_input_path = 2;
  138. // The "primary" output artifact processed by this action. E.g., the .o file
  139. // of a C++ compile action. Empty string ("") if the action has no output
  140. // artifacts or no "primary" output artifact.
  141. string primary_output_path = 3;
  142. }
  143. // A test action, such as running a JUnit4 test binary.
  144. message TestAction {
  145. // Timing data for execution of the test action.
  146. TestTiming test_timing = 1;
  147. // If the test is divided up into shards to improve performance, set this to
  148. // indicate which shard this test action is for. Value must be in interval
  149. // [0, total_shard_count). Defaults to 0, which is appropriate if all test
  150. // cases are run in the same process.
  151. int32 shard_number = 2;
  152. // If the user requested that every test be run multiple times, as is often
  153. // done to measure flakiness, set this to indicate which run this test action
  154. // is for. Value must be in interval [0, total_run_count). Defaults to 0,
  155. // which is appropriate if multiple runs were not requested.
  156. int32 run_number = 3;
  157. // If flaky tests are automatically retried, set this to indicate which
  158. // attempt this test action is for. (e.g. 0 for the first attempt, 1 for
  159. // second, and so on). Defaults to 0, which is appropriate if this is the only
  160. // attempt.
  161. int32 attempt_number = 4;
  162. // A tree of test suites and test cases that were run by this test action.
  163. // Each test case has its own status information, including stack traces.
  164. // Typically produced by parsing an XML Log, but may also be provided directly
  165. // by clients.
  166. TestSuite test_suite = 5;
  167. // Warnings for this test action.
  168. repeated TestWarning warnings = 8;
  169. // Estimated memory consumption of the test action, in bytes. A default value
  170. // of 0 means there is no memory consumption estimate specified.
  171. int64 estimated_memory_bytes = 10;
  172. }
  173. // General attributes of an action
  174. message ActionAttributes {
  175. // Strategy used for executing the action.
  176. ExecutionStrategy execution_strategy = 1;
  177. // Exit code of the process that ran the action. A non-zero value means
  178. // failure.
  179. int32 exit_code = 2;
  180. // Where the action was run.
  181. string hostname = 3;
  182. // Information about the input files used in all actions under this configured
  183. // target.
  184. InputFileInfo input_file_info = 4;
  185. }
  186. // File count and size information for the input files to a configured target.
  187. message InputFileInfo {
  188. // The number of input files (counting every file, even if a duplicate).
  189. int64 count = 1;
  190. // The number of distinct input files.
  191. int64 distinct_count = 2;
  192. // The max number of input files allowed by the build system (counting every
  193. // file, even if a duplicate).
  194. int64 count_limit = 3;
  195. // The total size of the distinct input files.
  196. int64 distinct_bytes = 4;
  197. // The max allowed total size of the distinct input files.
  198. int64 distinct_byte_limit = 5;
  199. }
  200. // Timing data for tests executed locally on the machine running the build.
  201. message LocalTestTiming {
  202. // Time taken by the test process, typically surrounded by a small wrapper
  203. // script.
  204. google.protobuf.Duration test_process_duration = 1;
  205. }
  206. // Timing data for one attempt to execute a test action remotely.
  207. message RemoteTestAttemptTiming {
  208. // Idle period before the test process is invoked on the remote machine.
  209. google.protobuf.Duration queue_duration = 1;
  210. // Time to upload data dependencies from the local machine to the remote
  211. // machine running the test, or to the distributed cache.
  212. google.protobuf.Duration upload_duration = 2;
  213. // Time to set up the remote machine.
  214. // Not to be confused with setup time in
  215. // xUnit test frameworks, which falls within the test_process_time.
  216. google.protobuf.Duration machine_setup_duration = 3;
  217. // Time taken by the test process, typically surrounded by a small wrapper
  218. // script.
  219. // For Java tests, this includes JVM setup, flag parsing, class path setup,
  220. // parsing files to setup the suite, and finally running your test methods.
  221. // In many cases, only a small fraction of the test process time is spent
  222. // running the test methods.
  223. google.protobuf.Duration test_process_duration = 4;
  224. // Time spent retrieving test logs and any other test outputs, back to the
  225. // local machine.
  226. google.protobuf.Duration download_duration = 5;
  227. }
  228. // Timing data for the part of the test execution that is done remotely.
  229. message RemoteTestTiming {
  230. // Time taken locally to determine what to do.
  231. google.protobuf.Duration local_analysis_duration = 1;
  232. // Normally there is only one attempt, but the system may retry on internal
  233. // errors, leading to multiple attempts.
  234. repeated RemoteTestAttemptTiming attempts = 2;
  235. }
  236. // Timing data for execution of a test action. The action may be performed
  237. // locally, on the machine running the build, or remotely.
  238. message TestTiming {
  239. // Test timing for either a local or remote execution.
  240. oneof location {
  241. // Used for local test actions.
  242. LocalTestTiming local = 1;
  243. // Used for remote test actions.
  244. RemoteTestTiming remote = 2;
  245. }
  246. // The amount of CPU time spent by the test process executing system calls
  247. // within the kernel, as opposed to library code. Time the test process spent
  248. // blocked does not count towards this figure.
  249. google.protobuf.Duration system_time_duration = 3;
  250. // The amount of CPU time spent by the test process executing user-mode code
  251. // outside the kernel, as opposed to library code. Time the test process
  252. // spent blocked does not count towards this figure. You can add user_time to
  253. // system_time to get total CPU time taken by the test process.
  254. google.protobuf.Duration user_time_duration = 4;
  255. // Most build systems cache build results to speed up incremental builds.
  256. // Some also cache test results too. This indicates whether the test results
  257. // were found in a cache, and where that cache was located.
  258. TestCaching test_caching = 5;
  259. }
  260. // A warning from a test execution.
  261. message TestWarning {
  262. // Contains the message detailing the warning.
  263. string warning_message = 1;
  264. }
  265. // Indicates how/where this Action was executed.
  266. enum ExecutionStrategy {
  267. // The action did not indicate how it was executed.
  268. EXECUTION_STRATEGY_UNSPECIFIED = 0;
  269. // The action was executed in some other form.
  270. OTHER_ENVIRONMENT = 1;
  271. // The action used a remote build service.
  272. REMOTE_SERVICE = 2;
  273. // The action was executed locally, in parallel with other actions.
  274. LOCAL_PARALLEL = 3;
  275. // The action was executed locally, without parallelism.
  276. LOCAL_SEQUENTIAL = 4;
  277. }
  278. // Most build systems cache build results to speed up incremental builds.
  279. // Some also cache test results too. This indicates whether the test results
  280. // were found in a cache, and where that cache was located.
  281. enum TestCaching {
  282. // The implicit default enum value. Should never be set.
  283. TEST_CACHING_UNSPECIFIED = 0;
  284. // The test result was found in a local cache, so it wasn't run again.
  285. LOCAL_CACHE_HIT = 1;
  286. // The test result was found in a remote cache, so it wasn't run again.
  287. REMOTE_CACHE_HIT = 2;
  288. // The test result was not found in any cache, so it had to be run again.
  289. CACHE_MISS = 3;
  290. }