4 simple ways to increase you GitLab CI test speed

Our in-house development projects are well covered for Unit and Frontend tests since we adopted BDD (behat) and a bit of TDD (phpspec).

However, creating lots of tests has an impact downstream on our shared Gitlab CI server. Every-time we push a new set of changes to GitLab the tests are taking 30mins to complete and beginning to slow us down.

So here are our 3 easy tips to speed up your test runner and reduce the time it takes to run a full test run.

  • Increase the Gitlab Runner’s Concurrent setting so we’re using the server’s resources to it’s maximum, `concurrent = 50`
  • Split up the most time consuming test suites into small suites so we keep most suites under 2mins. We’ve gone from test suites, to calling individual Unit test Classes for the slowest tests.
  • Prioritise the longest jobs first (put them to the top of the gitlab-ci.yml) so they can get going immediately and not hold anything else up
  • If you’re lucky enough to have access to the Virtual Server, then increase your CPU’s. That shaved 2 mins off our test

These simple and inexpensive changes have taken us from 30mins to 5mins 30s.

Author: Dan Course

Dan Course, E-Learning Development at Warwick University (WMG). Agile Scrum trained and full-stack development. Interested in E-learning, Democracy, Politics and Tech. All thoughts are mine and not of my employer.