How to run CodeShip Parallel Test Pipelines efficiently - optimal CI parallelization
When you use CodeShip as your CI server you can significantly increase the speed of your CI builds with Parallel Test Pipelines. Pipelines allow you to run multiple commands at the same time, for instance, you can split test suite across a few pipelines and complete the CI build much faster.
How to run parallel commands on CodeShip
Setup via CodeShip interface
One way is to define commands via CodeShip interface. Once parallel test pipelines are enabled, each project can have multiple test pipelines that will be run in parallel.
In order to run CI build as fast as possible we need to ensure the parallel commands will run subset of the test suite in a way that all the commands complete at the same time to avoid slow pipeline bottleneck. To split test suite we will use Knapsack Pro with Queue Mode which does dynamic test suite split across pipelines for Ruby and JavaScript tests to keep running our tests in an optimal way across parallel pipelines (also known as CI nodes).
Example for test suite in RSpec for Ruby on Rails project
Configure test pipelines (1/2 used)
Configure test pipelines (2/2 used)
Example of test suite split for Cypress test runner in JavaScript
Configure test pipelines (1/2 used)
Configure test pipelines (2/2 used)
You can learn more about Cypress test runner for E2E tests in JavaScript in this article.
Setup via codeship-services.yml
If you use CodeShip Pro then a parallel step group is defined by using the type: parallel
header and then nesting all steps you want to be parallelized, as seen in this example:
More examples how to configure CodeShip Pro parallelism
How dynamic test suite split works
If you would like to better understand how dynamic test suite split works and what problems it can solve check the video:
Summary
Running tests in parallel is a fast way to lower time of your CI build. To make it more efficient we can split test suite in an optimal way across CI nodes with Knapsack Pro to keep CI nodes auto balanced and run CI build as fast as possible.