From afa73f4d4e8b1e8106997f4eb11d82b31164fe48 Mon Sep 17 00:00:00 2001 From: drew Date: Wed, 31 Jul 2019 00:11:17 +0000 Subject: Documentation: Added Semaphore Test Boosters example to CI YAML `parallel` docs --- doc/ci/yaml/README.md | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/doc/ci/yaml/README.md b/doc/ci/yaml/README.md index 09b9fc87986..201047b70b9 100644 --- a/doc/ci/yaml/README.md +++ b/doc/ci/yaml/README.md @@ -1771,18 +1771,41 @@ sequentially from `job_name 1/N` to `job_name N/N`. For every job, `CI_NODE_INDEX` and `CI_NODE_TOTAL` [environment variables](../variables/README.md#predefined-environment-variables) are set. -A simple example: +Marking a job to be run in parallel requires only a simple addition to your configuration file: -```yaml -test: - script: rspec - parallel: 5 +```diff + test: + script: rspec ++ parallel: 5 ``` - TIP: **Tip:** Parallelize tests suites across parallel jobs. Different languages have different tools to facilitate this. +A simple example using [Sempahore Test Boosters](https://github.com/renderedtext/test-boosters) and RSpec to run some Ruby tests: + +```ruby +# Gemfile +source 'https://rubygems.org' + +gem 'rspec' +gem 'semaphore_test_boosters' +``` + +```yaml +test: + parallel: 3 + script: + - bundle + - bundle exec rspec_booster --job $CI_NODE_INDEX/$CI_NODE_TOTAL +``` + +CAUTION: **Caution:** +Please be aware that semaphore_test_boosters reports usages statistics to the author. + +You can then navigate to the **Jobs** tab of a new pipeline build and see your RSpec +job split into three separate jobs. + ### `trigger` **(PREMIUM)** > [Introduced](https://gitlab.com/gitlab-org/gitlab-ee/issues/8997) in [GitLab Premium](https://about.gitlab.com/pricing/) 11.8. -- cgit v1.2.1