From 94b93fad91aa7577f0475d4c111a98c8bd277da3 Mon Sep 17 00:00:00 2001 From: enzofab91 Date: Wed, 6 Sep 2023 16:37:11 -0300 Subject: [PATCH 01/13] remove unnecessary env --- README.md | 3 +++ docs/ci.md | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 docs/ci.md diff --git a/README.md b/README.md index e106c562..c9d62e66 100644 --- a/README.md +++ b/README.md @@ -81,9 +81,11 @@ To illustrate, `bin/rails console` will run the console in the docker container - [Faker](https://github.com/stympy/faker) for generating test data - [Flipper](https://github.com/jnunemaker/flipper) for feature flag support - [Jbuilder](https://github.com/rails/jbuilder) for json views +- [Knapsack](https://github.com/KnapsackPro/knapsack) for generating CI time report and splitting into nodes - [Letter Opener](https://github.com/ryanb/letter_opener) for previewing a mail in the browser - [Oj](https://github.com/ohler55/oj) for optimized json - [Pagy](https://github.com/ddnexus/pagy) for pagination +- [Parallel](https://github.com/grosser/parallel) for split CI in several cores - [Prosopite](https://github.com/charkost/prosopite) to detect N+1 queries - [Pry](https://github.com/pry/pry) for enhancing the ruby shell - [Puma](https://github.com/puma/puma) for the server @@ -105,6 +107,7 @@ To illustrate, `bin/rails console` will run the console in the docker container - Set your [frontend URL](https://github.com/cyu/rack-cors#origin) in `config/initializers/rack_cors.rb` - Set your mail sender in `config/initializers/devise.rb` - Config your timezone accordingly in `application.rb`. +- Config CI in parallel execution. See [docs](docs/ci.md). ## Api Docs diff --git a/docs/ci.md b/docs/ci.md new file mode 100644 index 00000000..f3a9f839 --- /dev/null +++ b/docs/ci.md @@ -0,0 +1,42 @@ +# CI + +## Parallelization with Parallel & Knapsack +Knapsack and Parallel gems allow us to run tests in several nodes at the same time, benefiint us in the execution time. Knapsack it parallelizes at node level while Parallel does it at CPU level. + +Knapsack splits tests based on an execution time report. In case there are files that were not added in the report, they will all run on the same node and may overload it, so it is strongly recommended to update the report frequently. + +## Configuration +In case you want to use this you will need a script that split spec files called `parallel_tests` which sets up the configuration, assuming you have `n_nodes * cpu_cores_quantity`. + +On Github Actions you can add any nodes you want using matrix strategy, setting up some variables: + +```sh + ci_node_total: [4] + # set N-1 indexes for parallel jobs + # When you run 2 parallel jobs then first job will have index 0, the second job will have index 1 etc + ci_node_index: [0, 1, 2, 3] +``` + +To update cpu cores quantity on every onde you can do it by updating this variable: +`PARALLEL_TESTS_CONCURRENCY: 2` + +To update tests on local machine you can by executing `KNAPSACK_CI_NODE_TOTAL=4 KNAPSACK_CI_NODE_INDEX=1 PARALLEL_TESTS_CONCURRENCY=2 bundle exec parallel_rspec -n 2 -e './bin/parallel_tests'`. This will run subset of tests files corresponding to second node. + +## Generating report +Knapsack report needs to be updated frequently to balance execution time among nodes. This can be done manually by executing: +`knapsack_generate_generate_report: true bundle exec knapsack:rspec` + +It is also recommended to generate the report in the CI for a better precision. For this you have available a workflow in Github Actions that triggers the report generation and creates a pull request automatically. This workflow can be scheduled in the frequency you want or even can be manually triggered. + +To schedule the cron task you have to do it in `.github/workflows/update_knapsack_report.yml:6` +Now is setted on February 31th so will never run. + +```sh + - cron: '0 5 31 2 *' + # The above cron does not run. Replace with the wanted periodicity. +``` +## Coverage +When splitting tests in different nodes each one reports only coverate of a part of the code files are testing. +For this reason a job in the CI is added to sums coverages from all nodes to be uses by SimpleCov. This job will be executed after all nodes have finished and will send the final report to CodeClimate. + +For the case of CPU cores we do not need to add extra configuration since the report of each node contains the info of all the cores that have been splited. From c9608ec0508fc72b300074d2e9cd052c6915142f Mon Sep 17 00:00:00 2001 From: enzofab91 Date: Wed, 6 Sep 2023 17:02:51 -0300 Subject: [PATCH 02/13] CR fixes --- docs/ci.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/ci.md b/docs/ci.md index f3a9f839..4595cd3b 100644 --- a/docs/ci.md +++ b/docs/ci.md @@ -1,7 +1,7 @@ # CI ## Parallelization with Parallel & Knapsack -Knapsack and Parallel gems allow us to run tests in several nodes at the same time, benefiint us in the execution time. Knapsack it parallelizes at node level while Parallel does it at CPU level. +Knapsack and Parallel gems allow us to run tests in several nodes at the same time, benefiting us in the execution time. Knapsack it parallelizes at node level while Parallel does it at CPU level. Knapsack splits tests based on an execution time report. In case there are files that were not added in the report, they will all run on the same node and may overload it, so it is strongly recommended to update the report frequently. @@ -36,7 +36,7 @@ Now is setted on February 31th so will never run. # The above cron does not run. Replace with the wanted periodicity. ``` ## Coverage -When splitting tests in different nodes each one reports only coverate of a part of the code files are testing. +When splitting tests in different nodes, each report covers only a part of the code files being tested. For this reason a job in the CI is added to sums coverages from all nodes to be uses by SimpleCov. This job will be executed after all nodes have finished and will send the final report to CodeClimate. For the case of CPU cores we do not need to add extra configuration since the report of each node contains the info of all the cores that have been splited. From c6b20636b7640c1a468fc5a6fe4db3c577ecebfd Mon Sep 17 00:00:00 2001 From: enzofab91 Date: Thu, 7 Sep 2023 10:17:18 -0300 Subject: [PATCH 03/13] CR fixes --- docs/ci.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/ci.md b/docs/ci.md index 4595cd3b..3f85f53a 100644 --- a/docs/ci.md +++ b/docs/ci.md @@ -17,7 +17,7 @@ On Github Actions you can add any nodes you want using matrix strategy, setting ci_node_index: [0, 1, 2, 3] ``` -To update cpu cores quantity on every onde you can do it by updating this variable: +To update CPU cores quantity on every node you can do it by updating this variable: `PARALLEL_TESTS_CONCURRENCY: 2` To update tests on local machine you can by executing `KNAPSACK_CI_NODE_TOTAL=4 KNAPSACK_CI_NODE_INDEX=1 PARALLEL_TESTS_CONCURRENCY=2 bundle exec parallel_rspec -n 2 -e './bin/parallel_tests'`. This will run subset of tests files corresponding to second node. @@ -29,7 +29,7 @@ Knapsack report needs to be updated frequently to balance execution time among n It is also recommended to generate the report in the CI for a better precision. For this you have available a workflow in Github Actions that triggers the report generation and creates a pull request automatically. This workflow can be scheduled in the frequency you want or even can be manually triggered. To schedule the cron task you have to do it in `.github/workflows/update_knapsack_report.yml:6` -Now is setted on February 31th so will never run. +It is now scheduled for February 31 so will never run. ```sh - cron: '0 5 31 2 *' @@ -37,6 +37,6 @@ Now is setted on February 31th so will never run. ``` ## Coverage When splitting tests in different nodes, each report covers only a part of the code files being tested. -For this reason a job in the CI is added to sums coverages from all nodes to be uses by SimpleCov. This job will be executed after all nodes have finished and will send the final report to CodeClimate. +For this reason a job in the CI is added to sums coverages from all nodes to be used by SimpleCov. This job will be executed after all nodes have finished and will send the final report to CodeClimate. For the case of CPU cores we do not need to add extra configuration since the report of each node contains the info of all the cores that have been splited. From 59317d0391affb4b34229008002adbf88c2d9ccb Mon Sep 17 00:00:00 2001 From: enzofab91 Date: Thu, 7 Sep 2023 10:31:16 -0300 Subject: [PATCH 04/13] Update cpu quantity info --- docs/ci.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/ci.md b/docs/ci.md index 3f85f53a..d460bc71 100644 --- a/docs/ci.md +++ b/docs/ci.md @@ -17,7 +17,8 @@ On Github Actions you can add any nodes you want using matrix strategy, setting ci_node_index: [0, 1, 2, 3] ``` -To update CPU cores quantity on every node you can do it by updating this variable: +CPU cores quantity on every node are obtained automatically from Github Actions config `echo "cpu_cores=$(nproc)" >> $GITHUB_ENV` +If you want to update it manually you can do it by updating this variable: `PARALLEL_TESTS_CONCURRENCY: 2` To update tests on local machine you can by executing `KNAPSACK_CI_NODE_TOTAL=4 KNAPSACK_CI_NODE_INDEX=1 PARALLEL_TESTS_CONCURRENCY=2 bundle exec parallel_rspec -n 2 -e './bin/parallel_tests'`. This will run subset of tests files corresponding to second node. From d0d479920dddb281744c5ffcbc44c69de4b8ea65 Mon Sep 17 00:00:00 2001 From: enzofab91 Date: Thu, 7 Sep 2023 10:31:56 -0300 Subject: [PATCH 05/13] Update cpu quantity info --- docs/ci.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/ci.md b/docs/ci.md index d460bc71..1868531e 100644 --- a/docs/ci.md +++ b/docs/ci.md @@ -17,7 +17,8 @@ On Github Actions you can add any nodes you want using matrix strategy, setting ci_node_index: [0, 1, 2, 3] ``` -CPU cores quantity on every node are obtained automatically from Github Actions config `echo "cpu_cores=$(nproc)" >> $GITHUB_ENV` +CPU cores quantity on every node are obtained automatically from Github Actions config `echo "cpu_cores=$(nproc)" >> $GITHUB_ENV`. + If you want to update it manually you can do it by updating this variable: `PARALLEL_TESTS_CONCURRENCY: 2` From 13448df97f9a65a2ade612a93632e85794bdb35b Mon Sep 17 00:00:00 2001 From: enzofab91 Date: Thu, 7 Sep 2023 11:34:37 -0300 Subject: [PATCH 06/13] Text change --- docs/ci.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/ci.md b/docs/ci.md index 1868531e..71c6752f 100644 --- a/docs/ci.md +++ b/docs/ci.md @@ -1,7 +1,7 @@ # CI ## Parallelization with Parallel & Knapsack -Knapsack and Parallel gems allow us to run tests in several nodes at the same time, benefiting us in the execution time. Knapsack it parallelizes at node level while Parallel does it at CPU level. +Knapsack and Parallel gems allow us to run tests in several nodes at the same time, benefiting us in the execution time. Knapsack parallelizes them at node level while Parallel does it at CPU level. Knapsack splits tests based on an execution time report. In case there are files that were not added in the report, they will all run on the same node and may overload it, so it is strongly recommended to update the report frequently. From acc8fa72203a7a2566375ea6de964ec86f2cbcea Mon Sep 17 00:00:00 2001 From: enzofab91 Date: Wed, 6 Sep 2023 16:37:11 -0300 Subject: [PATCH 07/13] remove unnecessary env --- README.md | 3 +++ docs/ci.md | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 docs/ci.md diff --git a/README.md b/README.md index e106c562..c9d62e66 100644 --- a/README.md +++ b/README.md @@ -81,9 +81,11 @@ To illustrate, `bin/rails console` will run the console in the docker container - [Faker](https://github.com/stympy/faker) for generating test data - [Flipper](https://github.com/jnunemaker/flipper) for feature flag support - [Jbuilder](https://github.com/rails/jbuilder) for json views +- [Knapsack](https://github.com/KnapsackPro/knapsack) for generating CI time report and splitting into nodes - [Letter Opener](https://github.com/ryanb/letter_opener) for previewing a mail in the browser - [Oj](https://github.com/ohler55/oj) for optimized json - [Pagy](https://github.com/ddnexus/pagy) for pagination +- [Parallel](https://github.com/grosser/parallel) for split CI in several cores - [Prosopite](https://github.com/charkost/prosopite) to detect N+1 queries - [Pry](https://github.com/pry/pry) for enhancing the ruby shell - [Puma](https://github.com/puma/puma) for the server @@ -105,6 +107,7 @@ To illustrate, `bin/rails console` will run the console in the docker container - Set your [frontend URL](https://github.com/cyu/rack-cors#origin) in `config/initializers/rack_cors.rb` - Set your mail sender in `config/initializers/devise.rb` - Config your timezone accordingly in `application.rb`. +- Config CI in parallel execution. See [docs](docs/ci.md). ## Api Docs diff --git a/docs/ci.md b/docs/ci.md new file mode 100644 index 00000000..f3a9f839 --- /dev/null +++ b/docs/ci.md @@ -0,0 +1,42 @@ +# CI + +## Parallelization with Parallel & Knapsack +Knapsack and Parallel gems allow us to run tests in several nodes at the same time, benefiint us in the execution time. Knapsack it parallelizes at node level while Parallel does it at CPU level. + +Knapsack splits tests based on an execution time report. In case there are files that were not added in the report, they will all run on the same node and may overload it, so it is strongly recommended to update the report frequently. + +## Configuration +In case you want to use this you will need a script that split spec files called `parallel_tests` which sets up the configuration, assuming you have `n_nodes * cpu_cores_quantity`. + +On Github Actions you can add any nodes you want using matrix strategy, setting up some variables: + +```sh + ci_node_total: [4] + # set N-1 indexes for parallel jobs + # When you run 2 parallel jobs then first job will have index 0, the second job will have index 1 etc + ci_node_index: [0, 1, 2, 3] +``` + +To update cpu cores quantity on every onde you can do it by updating this variable: +`PARALLEL_TESTS_CONCURRENCY: 2` + +To update tests on local machine you can by executing `KNAPSACK_CI_NODE_TOTAL=4 KNAPSACK_CI_NODE_INDEX=1 PARALLEL_TESTS_CONCURRENCY=2 bundle exec parallel_rspec -n 2 -e './bin/parallel_tests'`. This will run subset of tests files corresponding to second node. + +## Generating report +Knapsack report needs to be updated frequently to balance execution time among nodes. This can be done manually by executing: +`knapsack_generate_generate_report: true bundle exec knapsack:rspec` + +It is also recommended to generate the report in the CI for a better precision. For this you have available a workflow in Github Actions that triggers the report generation and creates a pull request automatically. This workflow can be scheduled in the frequency you want or even can be manually triggered. + +To schedule the cron task you have to do it in `.github/workflows/update_knapsack_report.yml:6` +Now is setted on February 31th so will never run. + +```sh + - cron: '0 5 31 2 *' + # The above cron does not run. Replace with the wanted periodicity. +``` +## Coverage +When splitting tests in different nodes each one reports only coverate of a part of the code files are testing. +For this reason a job in the CI is added to sums coverages from all nodes to be uses by SimpleCov. This job will be executed after all nodes have finished and will send the final report to CodeClimate. + +For the case of CPU cores we do not need to add extra configuration since the report of each node contains the info of all the cores that have been splited. From c1f8862c2b55391e44ccfc8d69eb1728c86fc530 Mon Sep 17 00:00:00 2001 From: enzofab91 Date: Wed, 6 Sep 2023 17:02:51 -0300 Subject: [PATCH 08/13] CR fixes --- docs/ci.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/ci.md b/docs/ci.md index f3a9f839..4595cd3b 100644 --- a/docs/ci.md +++ b/docs/ci.md @@ -1,7 +1,7 @@ # CI ## Parallelization with Parallel & Knapsack -Knapsack and Parallel gems allow us to run tests in several nodes at the same time, benefiint us in the execution time. Knapsack it parallelizes at node level while Parallel does it at CPU level. +Knapsack and Parallel gems allow us to run tests in several nodes at the same time, benefiting us in the execution time. Knapsack it parallelizes at node level while Parallel does it at CPU level. Knapsack splits tests based on an execution time report. In case there are files that were not added in the report, they will all run on the same node and may overload it, so it is strongly recommended to update the report frequently. @@ -36,7 +36,7 @@ Now is setted on February 31th so will never run. # The above cron does not run. Replace with the wanted periodicity. ``` ## Coverage -When splitting tests in different nodes each one reports only coverate of a part of the code files are testing. +When splitting tests in different nodes, each report covers only a part of the code files being tested. For this reason a job in the CI is added to sums coverages from all nodes to be uses by SimpleCov. This job will be executed after all nodes have finished and will send the final report to CodeClimate. For the case of CPU cores we do not need to add extra configuration since the report of each node contains the info of all the cores that have been splited. From 32f1f3e5ba967a5317de7ceebedf523431ee4ceb Mon Sep 17 00:00:00 2001 From: enzofab91 Date: Thu, 7 Sep 2023 10:17:18 -0300 Subject: [PATCH 09/13] CR fixes --- docs/ci.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/ci.md b/docs/ci.md index 4595cd3b..3f85f53a 100644 --- a/docs/ci.md +++ b/docs/ci.md @@ -17,7 +17,7 @@ On Github Actions you can add any nodes you want using matrix strategy, setting ci_node_index: [0, 1, 2, 3] ``` -To update cpu cores quantity on every onde you can do it by updating this variable: +To update CPU cores quantity on every node you can do it by updating this variable: `PARALLEL_TESTS_CONCURRENCY: 2` To update tests on local machine you can by executing `KNAPSACK_CI_NODE_TOTAL=4 KNAPSACK_CI_NODE_INDEX=1 PARALLEL_TESTS_CONCURRENCY=2 bundle exec parallel_rspec -n 2 -e './bin/parallel_tests'`. This will run subset of tests files corresponding to second node. @@ -29,7 +29,7 @@ Knapsack report needs to be updated frequently to balance execution time among n It is also recommended to generate the report in the CI for a better precision. For this you have available a workflow in Github Actions that triggers the report generation and creates a pull request automatically. This workflow can be scheduled in the frequency you want or even can be manually triggered. To schedule the cron task you have to do it in `.github/workflows/update_knapsack_report.yml:6` -Now is setted on February 31th so will never run. +It is now scheduled for February 31 so will never run. ```sh - cron: '0 5 31 2 *' @@ -37,6 +37,6 @@ Now is setted on February 31th so will never run. ``` ## Coverage When splitting tests in different nodes, each report covers only a part of the code files being tested. -For this reason a job in the CI is added to sums coverages from all nodes to be uses by SimpleCov. This job will be executed after all nodes have finished and will send the final report to CodeClimate. +For this reason a job in the CI is added to sums coverages from all nodes to be used by SimpleCov. This job will be executed after all nodes have finished and will send the final report to CodeClimate. For the case of CPU cores we do not need to add extra configuration since the report of each node contains the info of all the cores that have been splited. From 9bdbc001b112e2bd08bef5fb57b45bcbdbf873f4 Mon Sep 17 00:00:00 2001 From: enzofab91 Date: Thu, 7 Sep 2023 10:31:16 -0300 Subject: [PATCH 10/13] Update cpu quantity info --- docs/ci.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/ci.md b/docs/ci.md index 3f85f53a..d460bc71 100644 --- a/docs/ci.md +++ b/docs/ci.md @@ -17,7 +17,8 @@ On Github Actions you can add any nodes you want using matrix strategy, setting ci_node_index: [0, 1, 2, 3] ``` -To update CPU cores quantity on every node you can do it by updating this variable: +CPU cores quantity on every node are obtained automatically from Github Actions config `echo "cpu_cores=$(nproc)" >> $GITHUB_ENV` +If you want to update it manually you can do it by updating this variable: `PARALLEL_TESTS_CONCURRENCY: 2` To update tests on local machine you can by executing `KNAPSACK_CI_NODE_TOTAL=4 KNAPSACK_CI_NODE_INDEX=1 PARALLEL_TESTS_CONCURRENCY=2 bundle exec parallel_rspec -n 2 -e './bin/parallel_tests'`. This will run subset of tests files corresponding to second node. From 631014f189b017f782bf6f897ecdf22226423adf Mon Sep 17 00:00:00 2001 From: enzofab91 Date: Thu, 7 Sep 2023 10:31:56 -0300 Subject: [PATCH 11/13] Update cpu quantity info --- docs/ci.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/ci.md b/docs/ci.md index d460bc71..1868531e 100644 --- a/docs/ci.md +++ b/docs/ci.md @@ -17,7 +17,8 @@ On Github Actions you can add any nodes you want using matrix strategy, setting ci_node_index: [0, 1, 2, 3] ``` -CPU cores quantity on every node are obtained automatically from Github Actions config `echo "cpu_cores=$(nproc)" >> $GITHUB_ENV` +CPU cores quantity on every node are obtained automatically from Github Actions config `echo "cpu_cores=$(nproc)" >> $GITHUB_ENV`. + If you want to update it manually you can do it by updating this variable: `PARALLEL_TESTS_CONCURRENCY: 2` From d9dacce29a0aa55319fc4acd125ad633712e7635 Mon Sep 17 00:00:00 2001 From: enzofab91 Date: Thu, 7 Sep 2023 11:34:37 -0300 Subject: [PATCH 12/13] Text change --- docs/ci.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/ci.md b/docs/ci.md index 1868531e..71c6752f 100644 --- a/docs/ci.md +++ b/docs/ci.md @@ -1,7 +1,7 @@ # CI ## Parallelization with Parallel & Knapsack -Knapsack and Parallel gems allow us to run tests in several nodes at the same time, benefiting us in the execution time. Knapsack it parallelizes at node level while Parallel does it at CPU level. +Knapsack and Parallel gems allow us to run tests in several nodes at the same time, benefiting us in the execution time. Knapsack parallelizes them at node level while Parallel does it at CPU level. Knapsack splits tests based on an execution time report. In case there are files that were not added in the report, they will all run on the same node and may overload it, so it is strongly recommended to update the report frequently. From 8f7745b0a6de26b9cc46cda7f6bf4127969fadac Mon Sep 17 00:00:00 2001 From: Rodrigo Eizmendi Date: Thu, 7 Sep 2023 12:47:06 -0300 Subject: [PATCH 13/13] fix review comments --- README.md | 2 +- docs/ci.md | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index c9d62e66..2eac4182 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ To illustrate, `bin/rails console` will run the console in the docker container - [Letter Opener](https://github.com/ryanb/letter_opener) for previewing a mail in the browser - [Oj](https://github.com/ohler55/oj) for optimized json - [Pagy](https://github.com/ddnexus/pagy) for pagination -- [Parallel](https://github.com/grosser/parallel) for split CI in several cores +- [Parallel Tests](https://github.com/grosser/parallel_tests) for split CI in several cores - [Prosopite](https://github.com/charkost/prosopite) to detect N+1 queries - [Pry](https://github.com/pry/pry) for enhancing the ruby shell - [Puma](https://github.com/puma/puma) for the server diff --git a/docs/ci.md b/docs/ci.md index 71c6752f..02da3cda 100644 --- a/docs/ci.md +++ b/docs/ci.md @@ -1,7 +1,7 @@ # CI -## Parallelization with Parallel & Knapsack -Knapsack and Parallel gems allow us to run tests in several nodes at the same time, benefiting us in the execution time. Knapsack parallelizes them at node level while Parallel does it at CPU level. +## Parallelization with Parallel Tests & Knapsack +Knapsack and Parallel Tests gems allow us to run tests in several nodes at the same time, benefiting us in the execution time. Knapsack parallelizes them at node level while Parallel Tests does it at CPU level. Knapsack splits tests based on an execution time report. In case there are files that were not added in the report, they will all run on the same node and may overload it, so it is strongly recommended to update the report frequently. @@ -15,7 +15,6 @@ On Github Actions you can add any nodes you want using matrix strategy, setting # set N-1 indexes for parallel jobs # When you run 2 parallel jobs then first job will have index 0, the second job will have index 1 etc ci_node_index: [0, 1, 2, 3] -``` CPU cores quantity on every node are obtained automatically from Github Actions config `echo "cpu_cores=$(nproc)" >> $GITHUB_ENV`. @@ -26,7 +25,7 @@ To update tests on local machine you can by executing `KNAPSACK_CI_NODE_TOTAL=4 ## Generating report Knapsack report needs to be updated frequently to balance execution time among nodes. This can be done manually by executing: -`knapsack_generate_generate_report: true bundle exec knapsack:rspec` +`KNAPSACK_GENERATE_REPORT=true bundle exec rspec` It is also recommended to generate the report in the CI for a better precision. For this you have available a workflow in Github Actions that triggers the report generation and creates a pull request automatically. This workflow can be scheduled in the frequency you want or even can be manually triggered.