From d15164b1f514fb01f9b71410e6841a266cf264c9 Mon Sep 17 00:00:00 2001 From: Victor Allombert Date: Fri, 19 Apr 2024 09:06:13 +0200 Subject: [PATCH 1/3] Tezt: allows enabling external RPC server in scheduled pipeline --- tezt/lib_tezos/node.ml | 11 ++++++++--- tezt/lib_tezos/node.mli | 13 +++++++++++++ tezt/tests/rpc_process.ml | 14 ++++++++++---- 3 files changed, 31 insertions(+), 7 deletions(-) diff --git a/tezt/lib_tezos/node.ml b/tezt/lib_tezos/node.ml index a6c20d5aa4e4..a8f470c996b0 100644 --- a/tezt/lib_tezos/node.ml +++ b/tezt/lib_tezos/node.ml @@ -746,11 +746,16 @@ let wait_for_disconnections node disconnections = let* () = wait_for_ready node in waiter +let enable_external_rpc_process = + match Sys.getenv_opt "TZ_SCHEDULE_KIND" with + | Some "EXTENDED_RPC_TESTS" -> true + | _ -> false + let create ?runner ?(path = Uses.path Constant.octez_node) ?name ?color ?data_dir ?event_pipe ?net_addr ?net_port ?advertised_net_port ?metrics_addr - ?metrics_port ?(rpc_external = false) ?(rpc_host = Constant.default_host) - ?rpc_port ?rpc_tls ?(allow_all_rpc = true) - ?(max_active_rpc_connections = 500) arguments = + ?metrics_port ?(rpc_external = enable_external_rpc_process) + ?(rpc_host = Constant.default_host) ?rpc_port ?rpc_tls + ?(allow_all_rpc = true) ?(max_active_rpc_connections = 500) arguments = let name = match name with None -> fresh_name () | Some name -> name in let data_dir = match data_dir with None -> Temp.dir ?runner name | Some dir -> dir diff --git a/tezt/lib_tezos/node.mli b/tezt/lib_tezos/node.mli index 451ea8d7ba5b..fff4618727b1 100644 --- a/tezt/lib_tezos/node.mli +++ b/tezt/lib_tezos/node.mli @@ -110,6 +110,19 @@ type tls_config = {certificate_path : string; key_path : string} (** Tezos node states. *) type t +(** This placeholder aims to handle the activation of the external RPC + process for the Tezt nodes. Indeed, the external RPC process is an + important feature that is not activated by default in the node and + thus not tested on the CI. The tests on master are thus not + testing the feature. To test the external RPC process anyway, a + scheduled pipeline is launched every week, with the feature + enabled, running all tests. + When the scheduled pipeline is launched, the TZ_SCHEDULE_KIND + environment variable is set to "EXTENDED_RPC_TESTS" to turn on the + external RPC process. Look for the [ci/bin/rpc_pipeline.ml] file + for more details. *) +val enable_external_rpc_process : bool + (** Create a node. This function just creates the [t] value, it does not call diff --git a/tezt/tests/rpc_process.ml b/tezt/tests/rpc_process.ml index 01d5d5ae91df..07b8bc114269 100644 --- a/tezt/tests/rpc_process.ml +++ b/tezt/tests/rpc_process.ml @@ -240,7 +240,7 @@ let test_local_rpc_server = ~title:"RPC local server" ~tags:[team; "rpc"; "process"; "local_server"] @@ fun () -> - let node = Node.create [] in + let node = Node.create ~rpc_external:false [] in (* Register event watchers for local RPC server before the node is running to ensure they will not be missed. *) let local_event_promise = @@ -322,8 +322,12 @@ let test_local_and_process_rpc_servers = (fun port -> Node.RPC_additional_addr_external (point_of_port port)) external_rpc_ports) in - (* Add the local RPC server created by default in Node module. *) - let local_rpc_ports = Node.rpc_port node :: local_rpc_ports in + (* Add the external RPC server created by default in Node module. *) + let local_rpc_ports, external_rpc_ports = + if Node.enable_external_rpc_process then + (local_rpc_ports, Node.rpc_port node :: external_rpc_ports) + else (Node.rpc_port node :: local_rpc_ports, external_rpc_ports) + in (* Register event watchers for both external and local RPC servers before the node is running to ensure they will not be missed. *) let local_event_promises = @@ -379,7 +383,9 @@ let test_sync_with_node = Node.init ~name:"node_rpc_process" ~rpc_external:true node_arguments in let* () = Node.wait_for_ready node_rpc_process in - let node_local_rpc = Node.create ~name:"node_local_rpc" node_arguments in + let node_local_rpc = + Node.create ~name:"node_local_rpc" ~rpc_external:false node_arguments + in let waiter_for_local_rpc_server = wait_for_local_rpc_server node_local_rpc in let* () = Node.run node_local_rpc node_arguments in let* () = Node.wait_for_ready node_local_rpc in -- GitLab From e0fe7dd3e5db89339ec81097be61308e42bcc88b Mon Sep 17 00:00:00 2001 From: Victor Allombert Date: Fri, 19 Jul 2024 15:37:36 +0200 Subject: [PATCH 2/3] CI/Bin: introduce Common.Tezt module to factorize code --- ci/bin/code_verification.ml | 265 ++++-------------------------------- ci/bin/common.ml | 231 +++++++++++++++++++++++++++++++ 2 files changed, 255 insertions(+), 241 deletions(-) diff --git a/ci/bin/code_verification.ml b/ci/bin/code_verification.ml index a517000c01bd..a87551e200d6 100644 --- a/ci/bin/code_verification.ml +++ b/ci/bin/code_verification.ml @@ -179,142 +179,6 @@ let image_of_distribution = function | Ubuntu_jammy -> Images.ubuntu_jammy | Debian_bookworm -> Images.debian_bookworm -let job_tezt ~__POS__ ?rules ?parallel ?(tag = Gcp_tezt) ~name - ~(tezt_tests : Tezt_core.TSL_AST.t) ?(retry = 2) ?(tezt_retry = 1) - ?(tezt_parallel = 1) ?(tezt_variant = "") - ?(before_script = before_script ~source_version:true ~eval_opam:true []) - ?timeout ~dependencies () : tezos_job = - let variables = - [ - ("JUNIT", "tezt-junit.xml"); - ("TEZT_VARIANT", tezt_variant); - ("TESTS", Tezt_core.TSL.show tezt_tests); - ("TEZT_RETRY", string_of_int tezt_retry); - ("TEZT_PARALLEL", string_of_int tezt_parallel); - ] - in - let artifacts = - artifacts - ~reports:(reports ~junit:"$JUNIT" ()) - [ - "selected_tezts.tsv"; - "tezt.log"; - "tezt-*.log"; - "tezt-results-${CI_NODE_INDEX:-1}${TEZT_VARIANT}.json"; - "$JUNIT"; - ] - (* The record artifacts [tezt-results-$CI_NODE_INDEX.json] - should be stored for as long as a given commit on master is - expected to be HEAD in order to support auto-balancing. At - the time of writing, we have approximately 6 merges per day, - so 1 day should more than enough. However, we set it to 3 - days to keep records over the weekend. The tezt artifacts - (including records and coverage) take up roughly 2MB / - job. Total artifact storage becomes [N*P*T*W] where [N] is - the days of retention (7 atm), [P] the number of pipelines - per day (~200 atm), [T] the number of Tezt jobs per pipeline - (100) and [W] the artifact size per tezt job (2MB). This - makes 280GB which is ~4% of our - {{:https://gitlab.com/tezos/tezos/-/artifacts}total artifact - usage}. *) - ~expire_in:(Duration (Days 7)) - ~when_:Always - in - let print_variables = - [ - "TESTS"; - "JUNIT"; - "CI_NODE_INDEX"; - "CI_NODE_TOTAL"; - "TEZT_PARALLEL"; - "TEZT_VARIANT"; - ] - in - let retry = if retry = 0 then None else Some retry in - job - ?timeout - ~__POS__ - ~image:Images.CI.e2etest - ~name - ?parallel - ~tag - ~stage:Stages.test - ?rules - ~artifacts - ~variables - ~dependencies - ?retry - ~before_script - [ - (* Print [print_variables] in a shell-friendly manner for easier debugging *) - "echo \"" - ^ String.concat - " " - (List.map (fun var -> sf {|%s=\"${%s}\"|} var var) print_variables) - ^ "\""; - (* Store the list of tests that have been scheduled for execution for later debugging. - It is imperative this this first call to tezt receives any flags passed to the - second call that affect test selection.Note that TESTS must be quoted (here and below) - since it will contain e.g. '&&' which we want to interpreted as TSL and not shell - syntax. *) - "./scripts/ci/tezt.sh \"${TESTS}\" --from-record tezt/records --job \ - ${CI_NODE_INDEX:-1}/${CI_NODE_TOTAL:-1} --list-tsv > selected_tezts.tsv"; - (* For Tezt tests, there are multiple timeouts: - - --global-timeout is the internal timeout of Tezt, which only works if tests - are cooperative; - - the "timeout" command, which we set to send SIGTERM to Tezt 60s after --global-timeout - in case tests are not cooperative; - - the "timeout" command also sends SIGKILL 60s after having sent SIGTERM in case - Tezt is still stuck; - - the CI timeout. - The use of the "timeout" command is to make sure that Tezt eventually exits, - because if the CI timeout is reached, there are no artefacts, - and thus no logs to investigate. - See also: https://gitlab.com/gitlab-org/gitlab/-/issues/19818 *) - "./scripts/ci/exit_code.sh timeout -k 60 1860 ./scripts/ci/tezt.sh \ - \"${TESTS}\" --color --log-buffer-size 5000 --log-file tezt.log \ - --global-timeout 1800 --on-unknown-regression-files fail --junit \ - ${JUNIT} --from-record tezt/records --job \ - ${CI_NODE_INDEX:-1}/${CI_NODE_TOTAL:-1} --record \ - tezt-results-${CI_NODE_INDEX:-1}${TEZT_VARIANT}.json --job-count \ - ${TEZT_PARALLEL} --retry ${TEZT_RETRY}"; - ] - -(** Tezt tag selector string. - - It returns a TSL expression that: - - always deselects tags with [ci_disabled]; - - selects, respectively deselects, the tests with the tags - [memory_3k], [memory_4k], [time_sensitive], [slow] or [cloud], - depending on the value of the corresponding function - argument. These arguments all default to false. - - See [src/lib_test/tag.mli] for a description of the above tags. - - The list of TSL expressions [and_] are appended to the final - selector, allowing to modify the selection further. *) -let tezt_tests ?(memory_3k = false) ?(memory_4k = false) - ?(time_sensitive = false) ?(slow = false) ?(cloud = false) - (and_ : Tezt_core.TSL_AST.t list) : Tezt_core.TSL_AST.t = - let tags = - [ - (false, "ci_disabled"); - (memory_3k, "memory_3k"); - (memory_4k, "memory_4k"); - (time_sensitive, "time_sensitive"); - (slow, "slow"); - (cloud, "cloud"); - ] - in - let positive, negative = List.partition fst tags in - let positive = List.map snd positive in - let negative = List.map snd negative in - Tezt_core.( - TSL.conjunction - @@ List.map (fun tag -> TSL_AST.Has_tag tag) positive - @ List.map (fun tag -> TSL_AST.Not (Has_tag tag)) negative - @ and_) - (* Encodes the conditional [before_merging] pipeline and its unconditional variant [schedule_extended_test]. *) let jobs pipeline_type = @@ -544,97 +408,15 @@ let jobs pipeline_type = let job_build_arm64_exp_dev_extra : Tezos_ci.tezos_job = job_build_arm64_exp_dev_extra ~rules:build_arm_rules () in - (* Used in [before_merging] and [schedule_extended_tests]. - - Fetch records for Tezt generated on the last merge request pipeline - on the most recently merged MR and makes them available in artifacts - for future merge request pipelines. *) - let job_select_tezts : tezos_job = - job - ~__POS__ - ~name:"select_tezts" - (* We need: - - Git (to run git diff) - - ocamlyacc, ocamllex and ocamlc (to build manifest/manifest) *) - ~image:Images.CI.prebuild - ~stage:Stages.build - ~before_script:(before_script ~take_ownership:true ~eval_opam:true []) - (script_propagate_exit_code "scripts/ci/select_tezts.sh") - ~allow_failure:(With_exit_codes [17]) - ~artifacts: - (artifacts - ~expire_in:(Duration (Days 3)) - ~when_:Always - ["selected_tezts.tsl"]) - in - let job_build_kernels : tezos_job = - job - ~__POS__ - ~name:"oc.build_kernels" - ~image:Images.rust_toolchain - ~stage:Stages.build + let job_build_kernels = + job_build_kernels ~rules:(make_rules ~changes:changeset_octez_or_kernels ~dependent:true ()) - [ - "make -f kernels.mk build"; - "make -f etherlink.mk evm_kernel.wasm"; - "make -C src/riscv riscv-sandbox riscv-dummy.elf"; - "make -C src/riscv/tests/ build"; - ] - ~artifacts: - (artifacts - ~name:"build-kernels-$CI_COMMIT_REF_SLUG" - ~expire_in:(Duration (Days 1)) - ~when_:On_success - [ - "evm_kernel.wasm"; - "smart-rollup-installer"; - "sequenced_kernel.wasm"; - "tx_kernel.wasm"; - "tx_kernel_dal.wasm"; - "dal_echo_kernel.wasm"; - "src/riscv/riscv-sandbox"; - "src/riscv/riscv-dummy.elf"; - "src/riscv/tests/inline_asm/rv64-inline-asm-tests"; - ]) - |> enable_kernels - |> enable_sccache ~key:"kernels-sccache" ~path:"$CI_PROJECT_DIR/_sccache" - |> enable_cargo_cache + () in - (* Fetch records for Tezt generated on the last merge request pipeline - on the most recently merged MR and makes them available in artifacts - for future merge request pipelines. *) - let job_tezt_fetch_records : tezos_job = - job - ~__POS__ - ~name:"oc.tezt:fetch-records" - ~image:Images.CI.build - ~stage:Stages.build - ~before_script: - (before_script - ~take_ownership:true - ~source_version:true - ~eval_opam:true - []) + let job_tezt_fetch_records = + Tezt.job_tezt_fetch_records ~rules:(make_rules ~changes:changeset_octez ()) - [ - "dune exec scripts/ci/update_records/update.exe -- --log-file \ - tezt-fetch-records.log --from last-successful-schedule-extended-test \ - --info"; - ] - ~after_script:["./scripts/ci/filter_corrupted_records.sh"] - (* Allow failure of this job, since Tezt can use the records - stored in the repo as backup for balancing. *) - ~allow_failure:Yes - ~artifacts: - (artifacts - ~expire_in:(Duration (Hours 4)) - ~when_:Always - [ - "tezt-fetch-records.log"; - "tezt/records/*.json"; - (* Keep broken records for debugging *) - "tezt/records/*.json.broken"; - ]) + () in let job_static_x86_64_experimental = job_build_static_binaries @@ -718,7 +500,7 @@ let jobs pipeline_type = job_ocaml_check; job_build_kernels; job_tezt_fetch_records; - job_select_tezts; + Tezt.job_select_tezts; build_octez_source; ] @ bin_packages_jobs @@ -1319,7 +1101,7 @@ let jobs pipeline_type = let dependencies = Dependent [ - Artifacts job_select_tezts; + Artifacts Tezt.job_select_tezts; Artifacts job_build_x86_64_release; Artifacts job_build_x86_64_exp_dev_extra; Artifacts job_build_kernels; @@ -1329,12 +1111,12 @@ let jobs pipeline_type = let rules = make_rules ~dependent:true ~changes:changeset_octez () in let coverage_expiry = Duration (Days 3) in let tezt : tezos_job = - job_tezt + Tezt.job ~__POS__ ~name:"tezt" (* Exclude all tests with tags in [tezt_tags_always_disable] or [tezt_tags_exclusive_tags]. *) - ~tezt_tests:(tezt_tests [Not (Has_tag "flaky")]) + ~tezt_tests:(Tezt.tests_tag_selector [Not (Has_tag "flaky")]) ~tezt_parallel:3 ~parallel:(Vector 100) ~timeout:(Minutes 40) @@ -1344,10 +1126,10 @@ let jobs pipeline_type = |> enable_coverage_output_artifact ~expire_in:coverage_expiry in let tezt_memory_3k : tezos_job = - job_tezt + Tezt.job ~__POS__ ~name:"tezt-memory-3k" - ~tezt_tests:(tezt_tests ~memory_3k:true []) + ~tezt_tests:(Tezt.tests_tag_selector ~memory_3k:true []) ~tezt_variant:"-memory_3k" ~parallel:(Vector 6) ~dependencies @@ -1356,10 +1138,10 @@ let jobs pipeline_type = |> enable_coverage_output_artifact ~expire_in:coverage_expiry in let tezt_memory_4k : tezos_job = - job_tezt + Tezt.job ~__POS__ ~name:"tezt-memory-4k" - ~tezt_tests:(tezt_tests ~memory_4k:true []) + ~tezt_tests:(Tezt.tests_tag_selector ~memory_4k:true []) ~tezt_variant:"-memory_4k" ~parallel:(Vector 4) ~dependencies @@ -1373,10 +1155,10 @@ let jobs pipeline_type = tests are not particularly cpu/memory-intensive hence they do not need to run on a particular machine contrary to performance regression tests. *) - job_tezt + Tezt.job ~__POS__ ~name:"tezt-time-sensitive" - ~tezt_tests:(tezt_tests ~time_sensitive:true []) + ~tezt_tests:(Tezt.tests_tag_selector ~time_sensitive:true []) ~tezt_variant:"-time_sensitive" ~dependencies ~rules @@ -1384,14 +1166,14 @@ let jobs pipeline_type = |> enable_coverage_output_artifact ~expire_in:coverage_expiry in let tezt_slow : tezos_job = - job_tezt + Tezt.job ~__POS__ ~name:"tezt-slow" ~rules: (* See comment for [tezt_flaky] *) (make_rules ~dependent:true ~manual:(On_changes changeset_octez) ()) ~tezt_tests: - (tezt_tests + (Tezt.tests_tag_selector ~slow:true (* TODO: https://gitlab.com/tezos/tezos/-/issues/7063 The deselection of Paris [test_adaptive_issuance_launch.ml] @@ -1419,10 +1201,10 @@ let jobs pipeline_type = higher retries (both GitLab CI job retries, and tezt retries). They also run with [~parallel:1] to increase stability. *) - job_tezt + Tezt.job ~__POS__ ~name:"tezt-flaky" - ~tezt_tests:(tezt_tests [Has_tag "flaky"]) + ~tezt_tests:(Tezt.tests_tag_selector [Has_tag "flaky"]) ~tezt_variant:"-flaky" (* To handle flakiness, consider tweaking [~tezt_parallel] (passed to Tezt's '--job-count'), and [~tezt_retry] (passed to Tezt's @@ -1441,17 +1223,18 @@ let jobs pipeline_type = |> enable_coverage_output_artifact in let tezt_static_binaries : tezos_job = - job_tezt + Tezt.job ~__POS__ ~tag:Gcp ~name:"tezt:static-binaries" - ~tezt_tests:(tezt_tests [Has_tag "cli"; Not (Has_tag "flaky")]) + ~tezt_tests: + (Tezt.tests_tag_selector [Has_tag "cli"; Not (Has_tag "flaky")]) ~tezt_parallel:3 ~retry:0 ~dependencies: (Dependent [ - Artifacts job_select_tezts; + Artifacts Tezt.job_select_tezts; Artifacts job_build_x86_64_exp_dev_extra; Artifacts job_static_x86_64_experimental; Artifacts job_tezt_fetch_records; diff --git a/ci/bin/common.ml b/ci/bin/common.ml index d764166563f2..f459412d8e0b 100644 --- a/ci/bin/common.ml +++ b/ci/bin/common.ml @@ -1055,3 +1055,234 @@ let job_build_arm64_release ?rules () : tezos_job = let job_build_arm64_exp_dev_extra ?rules () : tezos_job = job_build_dynamic_binaries ?rules ~__POS__ ~arch:Arm64 ~release:false () + +let job_build_kernels ?rules () : tezos_job = + job + ~__POS__ + ~name:"oc.build_kernels" + ~image:Images.rust_toolchain + ~stage:Stages.build + ?rules + [ + "make -f kernels.mk build"; + "make -f etherlink.mk evm_kernel.wasm"; + "make -C src/riscv riscv-sandbox riscv-dummy.elf"; + "make -C src/riscv/tests/ build"; + ] + ~artifacts: + (artifacts + ~name:"build-kernels-$CI_COMMIT_REF_SLUG" + ~expire_in:(Duration (Days 1)) + ~when_:On_success + [ + "evm_kernel.wasm"; + "smart-rollup-installer"; + "sequenced_kernel.wasm"; + "tx_kernel.wasm"; + "tx_kernel_dal.wasm"; + "dal_echo_kernel.wasm"; + "src/riscv/riscv-sandbox"; + "src/riscv/riscv-dummy.elf"; + "src/riscv/tests/inline_asm/rv64-inline-asm-tests"; + ]) + |> enable_kernels + |> enable_sccache ~key:"kernels-sccache" ~path:"$CI_PROJECT_DIR/_sccache" + |> enable_cargo_cache + +module Tezt = struct + let job ~__POS__ ?rules ?parallel ?(tag = Gcp_tezt) ~name + ~(tezt_tests : Tezt_core.TSL_AST.t) ?(retry = 2) ?(tezt_retry = 1) + ?(tezt_parallel = 1) ?(tezt_variant = "") + ?(before_script = before_script ~source_version:true ~eval_opam:true []) + ?timeout ~dependencies () : tezos_job = + let variables = + [ + ("JUNIT", "tezt-junit.xml"); + ("TEZT_VARIANT", tezt_variant); + ("TESTS", Tezt_core.TSL.show tezt_tests); + ("TEZT_RETRY", string_of_int tezt_retry); + ("TEZT_PARALLEL", string_of_int tezt_parallel); + ] + in + let artifacts = + artifacts + ~reports:(reports ~junit:"$JUNIT" ()) + [ + "selected_tezts.tsv"; + "tezt.log"; + "tezt-*.log"; + "tezt-results-${CI_NODE_INDEX:-1}${TEZT_VARIANT}.json"; + "$JUNIT"; + ] + (* The record artifacts [tezt-results-$CI_NODE_INDEX.json] + should be stored for as long as a given commit on master is + expected to be HEAD in order to support auto-balancing. At + the time of writing, we have approximately 6 merges per day, + so 1 day should more than enough. However, we set it to 3 + days to keep records over the weekend. The tezt artifacts + (including records and coverage) take up roughly 2MB / + job. Total artifact storage becomes [N*P*T*W] where [N] is + the days of retention (7 atm), [P] the number of pipelines + per day (~200 atm), [T] the number of Tezt jobs per pipeline + (100) and [W] the artifact size per tezt job (2MB). This + makes 280GB which is ~4% of our + {{:https://gitlab.com/tezos/tezos/-/artifacts}total artifact + usage}. *) + ~expire_in:(Duration (Days 7)) + ~when_:Always + in + let print_variables = + [ + "TESTS"; + "JUNIT"; + "CI_NODE_INDEX"; + "CI_NODE_TOTAL"; + "TEZT_PARALLEL"; + "TEZT_VARIANT"; + ] + in + let retry = if retry = 0 then None else Some retry in + job + ?timeout + ~__POS__ + ~image:Images.CI.e2etest + ~name + ?parallel + ~tag + ~stage:Stages.test + ?rules + ~artifacts + ~variables + ~dependencies + ?retry + ~before_script + [ + (* Print [print_variables] in a shell-friendly manner for easier debugging *) + "echo \"" + ^ String.concat + " " + (List.map (fun var -> sf {|%s=\"${%s}\"|} var var) print_variables) + ^ "\""; + (* Store the list of tests that have been scheduled for execution for later debugging. + It is imperative this this first call to tezt receives any flags passed to the + second call that affect test selection.Note that TESTS must be quoted (here and below) + since it will contain e.g. '&&' which we want to interpreted as TSL and not shell + syntax. *) + "./scripts/ci/tezt.sh \"${TESTS}\" --from-record tezt/records --job \ + ${CI_NODE_INDEX:-1}/${CI_NODE_TOTAL:-1} --list-tsv > \ + selected_tezts.tsv"; + (* For Tezt tests, there are multiple timeouts: + - --global-timeout is the internal timeout of Tezt, which only works if tests + are cooperative; + - the "timeout" command, which we set to send SIGTERM to Tezt 60s after --global-timeout + in case tests are not cooperative; + - the "timeout" command also sends SIGKILL 60s after having sent SIGTERM in case + Tezt is still stuck; + - the CI timeout. + The use of the "timeout" command is to make sure that Tezt eventually exits, + because if the CI timeout is reached, there are no artefacts, + and thus no logs to investigate. + See also: https://gitlab.com/gitlab-org/gitlab/-/issues/19818 *) + "./scripts/ci/exit_code.sh timeout -k 60 1860 ./scripts/ci/tezt.sh \ + \"${TESTS}\" --color --log-buffer-size 5000 --log-file tezt.log \ + --global-timeout 1800 --on-unknown-regression-files fail --junit \ + ${JUNIT} --from-record tezt/records --job \ + ${CI_NODE_INDEX:-1}/${CI_NODE_TOTAL:-1} --record \ + tezt-results-${CI_NODE_INDEX:-1}${TEZT_VARIANT}.json --job-count \ + ${TEZT_PARALLEL} --retry ${TEZT_RETRY}"; + ] + + (** Tezt tag selector string. + + It returns a TSL expression that: + - always deselects tags with [ci_disabled]; + - selects, respectively deselects, the tests with the tags + [memory_3k], [memory_4k], [time_sensitive], [slow] or [cloud], + depending on the value of the corresponding function + argument. These arguments all default to false. + + See [src/lib_test/tag.mli] for a description of the above tags. + + The list of TSL expressions [and_] are appended to the final + selector, allowing to modify the selection further. *) + let tests_tag_selector ?(memory_3k = false) ?(memory_4k = false) + ?(time_sensitive = false) ?(slow = false) ?(cloud = false) + (and_ : Tezt_core.TSL_AST.t list) : Tezt_core.TSL_AST.t = + let tags = + [ + (false, "ci_disabled"); + (memory_3k, "memory_3k"); + (memory_4k, "memory_4k"); + (time_sensitive, "time_sensitive"); + (slow, "slow"); + (cloud, "cloud"); + ] + in + let positive, negative = List.partition fst tags in + let positive = List.map snd positive in + let negative = List.map snd negative in + Tezt_core.( + TSL.conjunction + @@ List.map (fun tag -> TSL_AST.Has_tag tag) positive + @ List.map (fun tag -> TSL_AST.Not (Has_tag tag)) negative + @ and_) + + (* Used in [before_merging] and [schedule_extended_tests]. + + Fetch records for Tezt generated on the last merge request pipeline + on the most recently merged MR and makes them available in artifacts + for future merge request pipelines. *) + let job_select_tezts : tezos_job = + Tezos_ci.job + ~__POS__ + ~name:"select_tezts" + (* We need: + - Git (to run git diff) + - ocamlyacc, ocamllex and ocamlc (to build manifest/manifest) *) + ~image:Images.CI.prebuild + ~stage:Stages.build + ~before_script:(before_script ~take_ownership:true ~eval_opam:true []) + (script_propagate_exit_code "scripts/ci/select_tezts.sh") + ~allow_failure:(With_exit_codes [17]) + ~artifacts: + (artifacts + ~expire_in:(Duration (Days 3)) + ~when_:Always + ["selected_tezts.tsl"]) + + (* Fetch records for Tezt generated on the last merge request + pipeline on the most recently merged MR and makes them available + in artifacts for future merge request pipelines. *) + let job_tezt_fetch_records ?rules () : tezos_job = + Tezos_ci.job + ~__POS__ + ~name:"oc.tezt:fetch-records" + ~image:Images.CI.build + ~stage:Stages.build + ~before_script: + (before_script + ~take_ownership:true + ~source_version:true + ~eval_opam:true + []) + ?rules + [ + "dune exec scripts/ci/update_records/update.exe -- --log-file \ + tezt-fetch-records.log --from last-successful-schedule-extended-test \ + --info"; + ] + ~after_script:["./scripts/ci/filter_corrupted_records.sh"] + (* Allow failure of this job, since Tezt can use the records + stored in the repo as backup for balancing. *) + ~allow_failure:Yes + ~artifacts: + (artifacts + ~expire_in:(Duration (Hours 4)) + ~when_:Always + [ + "tezt-fetch-records.log"; + "tezt/records/*.json"; + (* Keep broken records for debugging *) + "tezt/records/*.json.broken"; + ]) +end -- GitLab From 3fc26ae93339b6661066c846994a3495ff841415 Mon Sep 17 00:00:00 2001 From: Victor Allombert Date: Wed, 17 Jul 2024 14:27:09 +0200 Subject: [PATCH 3/3] CI/bin: introduce extended pipeline for nodes with RPC server --- .gitlab-ci.yml | 8 + .../pipelines/schedule_extended_rpc_test.yml | 537 ++++++++++++++++++ ci/bin/code_verification.ml | 7 +- ci/bin/main.ml | 6 +- ci/bin/rpc_pipeline.ml | 159 ++++++ ci/bin/rules.ml | 3 + ci/bin/rules.mli | 6 + 7 files changed, 724 insertions(+), 2 deletions(-) create mode 100644 .gitlab/ci/pipelines/schedule_extended_rpc_test.yml create mode 100644 ci/bin/rpc_pipeline.ml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 555fd97e305d..2b4025a0d925 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -58,6 +58,10 @@ workflow: variables: PIPELINE_TYPE: schedule_extended_test when: always + - if: $CI_PIPELINE_SOURCE == "schedule" && $TZ_SCHEDULE_KIND == "EXTENDED_RPC_TESTS" + variables: + PIPELINE_TYPE: schedule_extended_rpc_test + when: always default: interruptible: true @@ -139,3 +143,7 @@ include: rules: - if: $CI_PIPELINE_SOURCE == "schedule" && $TZ_SCHEDULE_KIND == "EXTENDED_TESTS" when: always +- local: .gitlab/ci/pipelines/schedule_extended_rpc_test.yml + rules: + - if: $CI_PIPELINE_SOURCE == "schedule" && $TZ_SCHEDULE_KIND == "EXTENDED_RPC_TESTS" + when: always diff --git a/.gitlab/ci/pipelines/schedule_extended_rpc_test.yml b/.gitlab/ci/pipelines/schedule_extended_rpc_test.yml new file mode 100644 index 000000000000..9da068915c3e --- /dev/null +++ b/.gitlab/ci/pipelines/schedule_extended_rpc_test.yml @@ -0,0 +1,537 @@ +# This file was automatically generated, do not edit. +# Edit file ci/bin/main.ml instead. + +stages: +- images +- build +- test + +oc.docker:ci:amd64: + image: ${GCP_REGISTRY}/tezos/docker-images/ci-docker:v1.12.0 + stage: images + tags: + - gcp + dependencies: [] + before_script: [] + script: + - ./images/ci_create_ci_images.sh + services: + - docker:${DOCKER_VERSION}-dind + variables: + DOCKER_VERSION: 24.0.6 + CI_DOCKER_HUB: "false" + ARCH: amd64 + artifacts: + reports: + dotenv: ci_image_tag.env + +oc.docker:rust-toolchain:amd64: + image: ${GCP_REGISTRY}/tezos/docker-images/ci-docker:v1.12.0 + stage: images + tags: + - gcp + dependencies: [] + before_script: [] + script: + - ./scripts/ci/docker_rust_toolchain_build.sh + services: + - docker:${DOCKER_VERSION}-dind + variables: + DOCKER_VERSION: 24.0.6 + CI_DOCKER_HUB: "false" + artifacts: + reports: + dotenv: rust_toolchain_image_tag.env + +tezt: + image: ${ci_image_name}/e2etest:${ci_image_tag} + stage: test + tags: + - gcp_tezt + needs: + - oc.docker:ci:amd64 + - select_tezts + - oc.build_x86_64-released + - oc.build_x86_64-exp-dev-extra + - oc.build_kernels + - oc.tezt:fetch-records + dependencies: + - oc.docker:ci:amd64 + - select_tezts + - oc.build_x86_64-released + - oc.build_x86_64-exp-dev-extra + - oc.build_kernels + - oc.tezt:fetch-records + timeout: 40 minutes + before_script: + - . ./scripts/version.sh + - eval $(opam env) + script: + - echo "TESTS=\"${TESTS}\" JUNIT=\"${JUNIT}\" CI_NODE_INDEX=\"${CI_NODE_INDEX}\" + CI_NODE_TOTAL=\"${CI_NODE_TOTAL}\" TEZT_PARALLEL=\"${TEZT_PARALLEL}\" TEZT_VARIANT=\"${TEZT_VARIANT}\"" + - ./scripts/ci/tezt.sh "${TESTS}" --from-record tezt/records --job ${CI_NODE_INDEX:-1}/${CI_NODE_TOTAL:-1} + --list-tsv > selected_tezts.tsv + - ./scripts/ci/exit_code.sh timeout -k 60 1860 ./scripts/ci/tezt.sh "${TESTS}" --color + --log-buffer-size 5000 --log-file tezt.log --global-timeout 1800 --on-unknown-regression-files + fail --junit ${JUNIT} --from-record tezt/records --job ${CI_NODE_INDEX:-1}/${CI_NODE_TOTAL:-1} + --record tezt-results-${CI_NODE_INDEX:-1}${TEZT_VARIANT}.json --job-count ${TEZT_PARALLEL} + --retry ${TEZT_RETRY} + variables: + JUNIT: tezt-junit.xml + TEZT_VARIANT: "" + TESTS: /ci_disabled && /memory_3k && /memory_4k && /time_sensitive && /slow && + /cloud && /flaky + TEZT_RETRY: "1" + TEZT_PARALLEL: "3" + artifacts: + expire_in: 7 days + paths: + - selected_tezts.tsv + - tezt.log + - tezt-*.log + - tezt-results-${CI_NODE_INDEX:-1}${TEZT_VARIANT}.json + - $JUNIT + reports: + junit: $JUNIT + when: always + retry: 2 + parallel: 100 + +tezt-memory-3k: + image: ${ci_image_name}/e2etest:${ci_image_tag} + stage: test + tags: + - gcp_tezt + needs: + - oc.docker:ci:amd64 + - select_tezts + - oc.build_x86_64-released + - oc.build_x86_64-exp-dev-extra + - oc.build_kernels + - oc.tezt:fetch-records + dependencies: + - oc.docker:ci:amd64 + - select_tezts + - oc.build_x86_64-released + - oc.build_x86_64-exp-dev-extra + - oc.build_kernels + - oc.tezt:fetch-records + before_script: + - . ./scripts/version.sh + - eval $(opam env) + script: + - echo "TESTS=\"${TESTS}\" JUNIT=\"${JUNIT}\" CI_NODE_INDEX=\"${CI_NODE_INDEX}\" + CI_NODE_TOTAL=\"${CI_NODE_TOTAL}\" TEZT_PARALLEL=\"${TEZT_PARALLEL}\" TEZT_VARIANT=\"${TEZT_VARIANT}\"" + - ./scripts/ci/tezt.sh "${TESTS}" --from-record tezt/records --job ${CI_NODE_INDEX:-1}/${CI_NODE_TOTAL:-1} + --list-tsv > selected_tezts.tsv + - ./scripts/ci/exit_code.sh timeout -k 60 1860 ./scripts/ci/tezt.sh "${TESTS}" --color + --log-buffer-size 5000 --log-file tezt.log --global-timeout 1800 --on-unknown-regression-files + fail --junit ${JUNIT} --from-record tezt/records --job ${CI_NODE_INDEX:-1}/${CI_NODE_TOTAL:-1} + --record tezt-results-${CI_NODE_INDEX:-1}${TEZT_VARIANT}.json --job-count ${TEZT_PARALLEL} + --retry ${TEZT_RETRY} + variables: + JUNIT: tezt-junit.xml + TEZT_VARIANT: -memory_3k + TESTS: memory_3k && /ci_disabled && /memory_4k && /time_sensitive && /slow && + /cloud + TEZT_RETRY: "1" + TEZT_PARALLEL: "1" + artifacts: + expire_in: 7 days + paths: + - selected_tezts.tsv + - tezt.log + - tezt-*.log + - tezt-results-${CI_NODE_INDEX:-1}${TEZT_VARIANT}.json + - $JUNIT + reports: + junit: $JUNIT + when: always + retry: 2 + parallel: 6 + +tezt-memory-4k: + image: ${ci_image_name}/e2etest:${ci_image_tag} + stage: test + tags: + - gcp_tezt + needs: + - oc.docker:ci:amd64 + - select_tezts + - oc.build_x86_64-released + - oc.build_x86_64-exp-dev-extra + - oc.build_kernels + - oc.tezt:fetch-records + dependencies: + - oc.docker:ci:amd64 + - select_tezts + - oc.build_x86_64-released + - oc.build_x86_64-exp-dev-extra + - oc.build_kernels + - oc.tezt:fetch-records + before_script: + - . ./scripts/version.sh + - eval $(opam env) + script: + - echo "TESTS=\"${TESTS}\" JUNIT=\"${JUNIT}\" CI_NODE_INDEX=\"${CI_NODE_INDEX}\" + CI_NODE_TOTAL=\"${CI_NODE_TOTAL}\" TEZT_PARALLEL=\"${TEZT_PARALLEL}\" TEZT_VARIANT=\"${TEZT_VARIANT}\"" + - ./scripts/ci/tezt.sh "${TESTS}" --from-record tezt/records --job ${CI_NODE_INDEX:-1}/${CI_NODE_TOTAL:-1} + --list-tsv > selected_tezts.tsv + - ./scripts/ci/exit_code.sh timeout -k 60 1860 ./scripts/ci/tezt.sh "${TESTS}" --color + --log-buffer-size 5000 --log-file tezt.log --global-timeout 1800 --on-unknown-regression-files + fail --junit ${JUNIT} --from-record tezt/records --job ${CI_NODE_INDEX:-1}/${CI_NODE_TOTAL:-1} + --record tezt-results-${CI_NODE_INDEX:-1}${TEZT_VARIANT}.json --job-count ${TEZT_PARALLEL} + --retry ${TEZT_RETRY} + variables: + JUNIT: tezt-junit.xml + TEZT_VARIANT: -memory_4k + TESTS: memory_4k && /ci_disabled && /memory_3k && /time_sensitive && /slow && + /cloud + TEZT_RETRY: "1" + TEZT_PARALLEL: "1" + artifacts: + expire_in: 7 days + paths: + - selected_tezts.tsv + - tezt.log + - tezt-*.log + - tezt-results-${CI_NODE_INDEX:-1}${TEZT_VARIANT}.json + - $JUNIT + reports: + junit: $JUNIT + when: always + retry: 2 + parallel: 4 + +tezt-time-sensitive: + image: ${ci_image_name}/e2etest:${ci_image_tag} + stage: test + tags: + - gcp_tezt + needs: + - oc.docker:ci:amd64 + - select_tezts + - oc.build_x86_64-released + - oc.build_x86_64-exp-dev-extra + - oc.build_kernels + - oc.tezt:fetch-records + dependencies: + - oc.docker:ci:amd64 + - select_tezts + - oc.build_x86_64-released + - oc.build_x86_64-exp-dev-extra + - oc.build_kernels + - oc.tezt:fetch-records + before_script: + - . ./scripts/version.sh + - eval $(opam env) + script: + - echo "TESTS=\"${TESTS}\" JUNIT=\"${JUNIT}\" CI_NODE_INDEX=\"${CI_NODE_INDEX}\" + CI_NODE_TOTAL=\"${CI_NODE_TOTAL}\" TEZT_PARALLEL=\"${TEZT_PARALLEL}\" TEZT_VARIANT=\"${TEZT_VARIANT}\"" + - ./scripts/ci/tezt.sh "${TESTS}" --from-record tezt/records --job ${CI_NODE_INDEX:-1}/${CI_NODE_TOTAL:-1} + --list-tsv > selected_tezts.tsv + - ./scripts/ci/exit_code.sh timeout -k 60 1860 ./scripts/ci/tezt.sh "${TESTS}" --color + --log-buffer-size 5000 --log-file tezt.log --global-timeout 1800 --on-unknown-regression-files + fail --junit ${JUNIT} --from-record tezt/records --job ${CI_NODE_INDEX:-1}/${CI_NODE_TOTAL:-1} + --record tezt-results-${CI_NODE_INDEX:-1}${TEZT_VARIANT}.json --job-count ${TEZT_PARALLEL} + --retry ${TEZT_RETRY} + variables: + JUNIT: tezt-junit.xml + TEZT_VARIANT: -time_sensitive + TESTS: time_sensitive && /ci_disabled && /memory_3k && /memory_4k && /slow && + /cloud + TEZT_RETRY: "1" + TEZT_PARALLEL: "1" + artifacts: + expire_in: 7 days + paths: + - selected_tezts.tsv + - tezt.log + - tezt-*.log + - tezt-results-${CI_NODE_INDEX:-1}${TEZT_VARIANT}.json + - $JUNIT + reports: + junit: $JUNIT + when: always + retry: 2 + +tezt-slow: + image: ${ci_image_name}/e2etest:${ci_image_tag} + stage: test + tags: + - gcp_tezt + needs: + - oc.docker:ci:amd64 + - select_tezts + - oc.build_x86_64-released + - oc.build_x86_64-exp-dev-extra + - oc.build_kernels + - oc.tezt:fetch-records + dependencies: + - oc.docker:ci:amd64 + - select_tezts + - oc.build_x86_64-released + - oc.build_x86_64-exp-dev-extra + - oc.build_kernels + - oc.tezt:fetch-records + before_script: + - . ./scripts/version.sh + - eval $(opam env) + script: + - echo "TESTS=\"${TESTS}\" JUNIT=\"${JUNIT}\" CI_NODE_INDEX=\"${CI_NODE_INDEX}\" + CI_NODE_TOTAL=\"${CI_NODE_TOTAL}\" TEZT_PARALLEL=\"${TEZT_PARALLEL}\" TEZT_VARIANT=\"${TEZT_VARIANT}\"" + - ./scripts/ci/tezt.sh "${TESTS}" --from-record tezt/records --job ${CI_NODE_INDEX:-1}/${CI_NODE_TOTAL:-1} + --list-tsv > selected_tezts.tsv + - ./scripts/ci/exit_code.sh timeout -k 60 1860 ./scripts/ci/tezt.sh "${TESTS}" --color + --log-buffer-size 5000 --log-file tezt.log --global-timeout 1800 --on-unknown-regression-files + fail --junit ${JUNIT} --from-record tezt/records --job ${CI_NODE_INDEX:-1}/${CI_NODE_TOTAL:-1} + --record tezt-results-${CI_NODE_INDEX:-1}${TEZT_VARIANT}.json --job-count ${TEZT_PARALLEL} + --retry ${TEZT_RETRY} + variables: + JUNIT: tezt-junit.xml + TEZT_VARIANT: -slow + TESTS: slow && /ci_disabled && /memory_3k && /memory_4k && /time_sensitive && + /cloud && not (file = src/proto_019_PtParisA/lib_protocol/test/integration/test_adaptive_issuance_launch.ml) + TEZT_RETRY: "1" + TEZT_PARALLEL: "3" + artifacts: + expire_in: 7 days + paths: + - selected_tezts.tsv + - tezt.log + - tezt-*.log + - tezt-results-${CI_NODE_INDEX:-1}${TEZT_VARIANT}.json + - $JUNIT + reports: + junit: $JUNIT + when: always + retry: 2 + parallel: 10 + +tezt-flaky: + image: ${ci_image_name}/e2etest:${ci_image_tag} + stage: test + tags: + - gcp_tezt + needs: + - oc.docker:ci:amd64 + - select_tezts + - oc.build_x86_64-released + - oc.build_x86_64-exp-dev-extra + - oc.build_kernels + - oc.tezt:fetch-records + dependencies: + - oc.docker:ci:amd64 + - select_tezts + - oc.build_x86_64-released + - oc.build_x86_64-exp-dev-extra + - oc.build_kernels + - oc.tezt:fetch-records + before_script: + - . ./scripts/version.sh + - eval $(opam env) + script: + - echo "TESTS=\"${TESTS}\" JUNIT=\"${JUNIT}\" CI_NODE_INDEX=\"${CI_NODE_INDEX}\" + CI_NODE_TOTAL=\"${CI_NODE_TOTAL}\" TEZT_PARALLEL=\"${TEZT_PARALLEL}\" TEZT_VARIANT=\"${TEZT_VARIANT}\"" + - ./scripts/ci/tezt.sh "${TESTS}" --from-record tezt/records --job ${CI_NODE_INDEX:-1}/${CI_NODE_TOTAL:-1} + --list-tsv > selected_tezts.tsv + - ./scripts/ci/exit_code.sh timeout -k 60 1860 ./scripts/ci/tezt.sh "${TESTS}" --color + --log-buffer-size 5000 --log-file tezt.log --global-timeout 1800 --on-unknown-regression-files + fail --junit ${JUNIT} --from-record tezt/records --job ${CI_NODE_INDEX:-1}/${CI_NODE_TOTAL:-1} + --record tezt-results-${CI_NODE_INDEX:-1}${TEZT_VARIANT}.json --job-count ${TEZT_PARALLEL} + --retry ${TEZT_RETRY} + variables: + JUNIT: tezt-junit.xml + TEZT_VARIANT: -flaky + TESTS: /ci_disabled && /memory_3k && /memory_4k && /time_sensitive && /slow && + /cloud && flaky + TEZT_RETRY: "3" + TEZT_PARALLEL: "1" + artifacts: + expire_in: 7 days + paths: + - selected_tezts.tsv + - tezt.log + - tezt-*.log + - tezt-results-${CI_NODE_INDEX:-1}${TEZT_VARIANT}.json + - $JUNIT + reports: + junit: $JUNIT + when: always + retry: 2 + +oc.build_x86_64-released: + image: ${ci_image_name}/build:${ci_image_tag} + stage: build + tags: + - gcp + dependencies: + - oc.docker:ci:amd64 + cache: + - key: cargo-$CI_JOB_NAME_SLUG + paths: + - $CI_PROJECT_DIR/.cargo/registry/cache + policy: pull-push + - key: sccache-$CI_JOB_NAME_SLUG + paths: + - $CI_PROJECT_DIR/_sccache + policy: pull-push + before_script: + - ./scripts/ci/take_ownership.sh + - . ./scripts/version.sh + - eval $(opam env) + - . ./scripts/ci/sccache-start.sh + script: + - ./scripts/ci/build_full_unreleased.sh + after_script: + - sccache --stop-server || true + variables: + ARCH: x86_64 + EXECUTABLE_FILES: script-inputs/released-executables + CARGO_NET_OFFLINE: "false" + SCCACHE_DIR: $CI_PROJECT_DIR/_sccache + COVERAGE_OPTIONS: --instrument-with bisect_ppx + artifacts: + name: build-$ARCH-$CI_COMMIT_REF_SLUG + expire_in: 1 day + paths: + - octez-* + - src/proto_*/parameters/*.json + - _build/default/src/lib_protocol_compiler/bin/main_native.exe + - _build/default/tezt/tests/main.exe + - _build/default/contrib/octez_injector_server/octez_injector_server.exe + when: on_success + +oc.build_x86_64-exp-dev-extra: + image: ${ci_image_name}/build:${ci_image_tag} + stage: build + tags: + - gcp + dependencies: + - oc.docker:ci:amd64 + cache: + - key: cargo-$CI_JOB_NAME_SLUG + paths: + - $CI_PROJECT_DIR/.cargo/registry/cache + policy: pull-push + - key: sccache-$CI_JOB_NAME_SLUG + paths: + - $CI_PROJECT_DIR/_sccache + policy: pull-push + before_script: + - ./scripts/ci/take_ownership.sh + - . ./scripts/version.sh + - eval $(opam env) + - . ./scripts/ci/sccache-start.sh + script: + - ./scripts/ci/build_full_unreleased.sh + after_script: + - sccache --stop-server || true + variables: + ARCH: x86_64 + EXECUTABLE_FILES: script-inputs/experimental-executables script-inputs/dev-executables + BUILD_EXTRA: src/bin_tps_evaluation/main_tps_evaluation.exe src/bin_octogram/octogram_main.exe + tezt/tests/main.exe contrib/octez_injector_server/octez_injector_server.exe + CARGO_NET_OFFLINE: "false" + SCCACHE_DIR: $CI_PROJECT_DIR/_sccache + COVERAGE_OPTIONS: --instrument-with bisect_ppx + artifacts: + name: build-$ARCH-$CI_COMMIT_REF_SLUG + expire_in: 1 day + paths: + - octez-* + - src/proto_*/parameters/*.json + - _build/default/src/lib_protocol_compiler/bin/main_native.exe + - _build/default/tezt/tests/main.exe + - _build/default/contrib/octez_injector_server/octez_injector_server.exe + when: on_success + +oc.build_kernels: + image: ${rust_toolchain_image_name}:${rust_toolchain_image_tag} + stage: build + tags: + - gcp + dependencies: + - oc.docker:rust-toolchain:amd64 + cache: + - key: kernels-sccache + paths: + - $CI_PROJECT_DIR/_sccache + policy: pull-push + - key: cargo-$CI_JOB_NAME_SLUG + paths: + - $CI_PROJECT_DIR/.cargo/registry/cache + policy: pull-push + before_script: + - . ./scripts/ci/sccache-start.sh + script: + - make -f kernels.mk build + - make -f etherlink.mk evm_kernel.wasm + - make -C src/riscv riscv-sandbox riscv-dummy.elf + - make -C src/riscv/tests/ build + after_script: + - sccache --stop-server || true + variables: + CC: clang + NATIVE_TARGET: x86_64-unknown-linux-musl + SCCACHE_DIR: $CI_PROJECT_DIR/_sccache + CARGO_NET_OFFLINE: "false" + artifacts: + name: build-kernels-$CI_COMMIT_REF_SLUG + expire_in: 1 day + paths: + - evm_kernel.wasm + - smart-rollup-installer + - sequenced_kernel.wasm + - tx_kernel.wasm + - tx_kernel_dal.wasm + - dal_echo_kernel.wasm + - src/riscv/riscv-sandbox + - src/riscv/riscv-dummy.elf + - src/riscv/tests/inline_asm/rv64-inline-asm-tests + when: on_success + +oc.tezt:fetch-records: + image: ${ci_image_name}/build:${ci_image_tag} + stage: build + tags: + - gcp + dependencies: + - oc.docker:ci:amd64 + allow_failure: true + before_script: + - ./scripts/ci/take_ownership.sh + - . ./scripts/version.sh + - eval $(opam env) + script: + - dune exec scripts/ci/update_records/update.exe -- --log-file tezt-fetch-records.log + --from last-successful-schedule-extended-test --info + after_script: + - ./scripts/ci/filter_corrupted_records.sh + artifacts: + expire_in: 4 hours + paths: + - tezt-fetch-records.log + - tezt/records/*.json + - tezt/records/*.json.broken + when: always + +select_tezts: + image: ${ci_image_name}/prebuild:${ci_image_tag} + stage: build + tags: + - gcp + dependencies: + - oc.docker:ci:amd64 + allow_failure: + exit_codes: 17 + before_script: + - ./scripts/ci/take_ownership.sh + - eval $(opam env) + script: + - scripts/ci/select_tezts.sh || exit $? + artifacts: + expire_in: 3 days + paths: + - selected_tezts.tsl + when: always diff --git a/ci/bin/code_verification.ml b/ci/bin/code_verification.ml index a87551e200d6..2d9fd6aa2447 100644 --- a/ci/bin/code_verification.ml +++ b/ci/bin/code_verification.ml @@ -1096,7 +1096,12 @@ let jobs pipeline_type = meant to be used with Tezt cloud (see [tezt/lib_cloud/README.md]) and do not run in the CI. - For more information on tags, see [src/lib_test/tag.mli]. *) + For more information on tags, see [src/lib_test/tag.mli]. + + Important: the [Rpc_pipeline.jobs] function declares a set of + jobs that must match the ones defined below. Please update the + jobs accordingly. + *) let jobs_tezt = let dependencies = Dependent diff --git a/ci/bin/main.ml b/ci/bin/main.ml index da69c382a686..9ff2f0c1acaf 100644 --- a/ci/bin/main.ml +++ b/ci/bin/main.ml @@ -133,7 +133,11 @@ let () = register "schedule_extended_test" schedule_extended_tests - ~jobs:(Code_verification.jobs Schedule_extended_test) + ~jobs:(Code_verification.jobs Schedule_extended_test) ; + register + "schedule_extended_rpc_test" + schedule_extended_rpc_tests + ~jobs:Rpc_pipeline.jobs let () = (* If argument --verbose is set, then log generation info. diff --git a/ci/bin/rpc_pipeline.ml b/ci/bin/rpc_pipeline.ml new file mode 100644 index 000000000000..55391284bbdc --- /dev/null +++ b/ci/bin/rpc_pipeline.ml @@ -0,0 +1,159 @@ +(*****************************************************************************) +(* *) +(* SPDX-License-Identifier: MIT *) +(* Copyright (c) 2024 Nomadic Labs. *) +(* *) +(*****************************************************************************) + +(* This module defines the jobs of the [rpc_pipeline] pipeline. + + This pipeline runs once a week on the [master] branch. The goal of + this pipeline is to test the external RPC process that is not + enabled by default on the node, and thus, not tested through the + tezt jobs. To do so, a particular configuration is set for each + node that is run in the tezt jobs so that the feature to test is + enabled.*) + +open Gitlab_ci.Types +open Tezos_ci +open Common + +(* The build_x86_64 jobs are split in two to keep the artifact size + under the 1GB hard limit set by GitLab. *) +(* [job_build_x86_64_release] builds the released executables. *) +let job_build_x86_64_release = + job_build_dynamic_binaries ~__POS__ ~arch:Amd64 ~release:true () + +let job_build_x86_64_exp_dev_extra = + job_build_dynamic_binaries ~__POS__ ~arch:Amd64 ~release:false () + +let jobs = + (* Tezt jobs. + + This is intended to execute the same jobs as those performed in + the [code_verification.ml] file -- see the [jobs_tezt] function + comment to get more details. + + Note that this function must be in sync with the + [Code_verification.jobs_tezt] one, so that the same set of test + is executed. + *) + let job_tezt_fetch_records = Tezt.job_tezt_fetch_records () in + let job_build_kernels = job_build_kernels () in + let dependencies = + Dependent + [ + Artifacts Tezt.job_select_tezts; + Artifacts job_build_x86_64_release; + Artifacts job_build_x86_64_exp_dev_extra; + Artifacts job_build_kernels; + Artifacts job_tezt_fetch_records; + ] + in + let tezt : tezos_job = + Tezt.job + ~__POS__ + ~name:"tezt" + (* Exclude all tests with tags in [tezt_tags_always_disable] or + [tezt_tags_exclusive_tags]. *) + ~tezt_tests:(Tezt.tests_tag_selector [Not (Has_tag "flaky")]) + ~tezt_parallel:3 + ~parallel:(Vector 100) + ~timeout:(Minutes 40) + ~dependencies + () + in + let tezt_memory_3k : tezos_job = + Tezt.job + ~__POS__ + ~name:"tezt-memory-3k" + ~tezt_tests:(Tezt.tests_tag_selector ~memory_3k:true []) + ~tezt_variant:"-memory_3k" + ~parallel:(Vector 6) + ~dependencies + () + in + let tezt_memory_4k : tezos_job = + Tezt.job + ~__POS__ + ~name:"tezt-memory-4k" + ~tezt_tests:(Tezt.tests_tag_selector ~memory_4k:true []) + ~tezt_variant:"-memory_4k" + ~parallel:(Vector 4) + ~dependencies + () + in + let tezt_time_sensitive : tezos_job = + (* the following tests are executed with [~tezt_parallel:1] to ensure + that other tests do not affect their executions. However, these + tests are not particularly cpu/memory-intensive hence they do not + need to run on a particular machine contrary to performance + regression tests. *) + Tezt.job + ~__POS__ + ~name:"tezt-time-sensitive" + ~tezt_tests:(Tezt.tests_tag_selector ~time_sensitive:true []) + ~tezt_variant:"-time_sensitive" + ~dependencies + () + in + let tezt_slow : tezos_job = + Tezt.job + ~__POS__ + ~name:"tezt-slow" + ~tezt_tests: + (Tezt.tests_tag_selector + ~slow:true + (* TODO: https://gitlab.com/tezos/tezos/-/issues/7063 + The deselection of Paris [test_adaptive_issuance_launch.ml] + should be removed once the fixes to its slowness has been + snapshotted from Alpha. *) + [ + Not + (String_predicate + ( File, + Is + "src/proto_019_PtParisA/lib_protocol/test/integration/test_adaptive_issuance_launch.ml" + )); + ]) + ~tezt_variant:"-slow" + ~retry:2 + ~tezt_parallel:3 + ~parallel:(Vector 10) + ~dependencies + () + in + let tezt_flaky : tezos_job = + (* Runs tests tagged "flaky" [Tag.flaky]. + + These tests only run on scheduled pipelines. They run with + higher retries (both GitLab CI job retries, and tezt + retries). They also run with [~parallel:1] to increase + stability. *) + Tezt.job + ~__POS__ + ~name:"tezt-flaky" + ~tezt_tests:(Tezt.tests_tag_selector [Has_tag "flaky"]) + ~tezt_variant:"-flaky" + (* To handle flakiness, consider tweaking [~tezt_parallel] (passed to + Tezt's '--job-count'), and [~tezt_retry] (passed to Tezt's + '--retry') *) + ~retry:2 + ~tezt_retry:3 + ~tezt_parallel:1 + ~dependencies + () + in + [ + tezt; + tezt_memory_3k; + tezt_memory_4k; + tezt_time_sensitive; + tezt_slow; + tezt_flaky; + job_build_x86_64_release; + job_build_x86_64_exp_dev_extra; + job_build_kernels; + job_tezt_fetch_records; + Tezt.job_select_tezts; + ] diff --git a/ci/bin/rules.ml b/ci/bin/rules.ml index e14c0589eb5f..7bf077cbc429 100644 --- a/ci/bin/rules.ml +++ b/ci/bin/rules.ml @@ -49,6 +49,9 @@ let scheduled = pipeline_source_eq Schedule let schedule_extended_tests = scheduled && var "TZ_SCHEDULE_KIND" == str "EXTENDED_TESTS" +let schedule_extended_rpc_tests = + scheduled && var "TZ_SCHEDULE_KIND" == str "EXTENDED_RPC_TESTS" + let on_master = Predefined_vars.ci_commit_branch == str "master" let on_branch branch = Predefined_vars.ci_commit_branch == str branch diff --git a/ci/bin/rules.mli b/ci/bin/rules.mli index 91c212b1f1f1..f4207939b7bd 100644 --- a/ci/bin/rules.mli +++ b/ci/bin/rules.mli @@ -51,6 +51,12 @@ val merge_train : If.t [TZ_SCHEDULE_KIND] set to [EXTENDED_TESTS]. *) val schedule_extended_tests : If.t +(** A rule that is true for scheduled extended RPC test pipelines. + + Such pipelines have [CI_PIPELINE_SOURCE] set to [scheduled] and + [TZ_SCHEDULE_KIND] set to [EXTENDED_RPC_TESTS]. *) +val schedule_extended_rpc_tests : If.t + (** A rule that is true if [CI_COMMIT_BRANCH] is a given branch. *) val on_branch : string -> If.t -- GitLab