For the "typical" time it takes for a commit to be approved and landed in master to be 5 minutes or less.
### Status quo
As of 11 June 2019, the gate usually takes around 20 minutes.
The two slowest jobs typically take 13-17 minutes each. The time for the gate overall is rarely under 15 minutes, because we run multiple of these jobs (increasing the chances of random slowness), and while they can run in parallel, they don't always start immediately - given limited CI execution slots.
Below a sample from [a MediaWiki commit](https://gerrit.wikimedia.org/r/#/c/mediawiki/core/+/516728/) (master branch):
>>! Gate pipeline build succeeded.
> * wmf-quibble-core-vendor-mysql-php72-docker SUCCESS in 12m 03s
> * wmf-quibble-core-vendor-mysql-hhvm-docker SUCCESS in 14m 12s
> * mediawiki-quibble-vendor-mysql-php72-docker SUCCESS in 7m 34s
> * mediawiki-quibble-vendor-mysql-php71-docker SUCCESS in 7m 12s
> * mediawiki-quibble-vendor-mysql-php70-docker SUCCESS in 6m 48s
> * mediawiki-quibble-vendor-mysql-hhvm-docker SUCCESS in 8m 32s
> * mediawiki-quibble-vendor-postgres-php72-docker SUCCESS in 10m 05s
> * mediawiki-quibble-vendor-sqlite-php72-docker SUCCESS in 7m 04s
> * mediawiki-quibble-composer-mysql-php70-docker SUCCESS in 8m 14s
>(+ jobs that take less than 3 minutes: composer-test, npm-test, and phan.)
These can be grouped in two kinds of jobs:
* wmf-quibble: These install MW with the gated extensions, and then run all PHPUnit, Selenium and QUnit tests.
* mediawiki-quibble: These install MW bundled extensions only, and then run PHPUnit, Selenium and QUnit tests.
Stats from [`wmf-quibble-core-vendor-mysql-php72-docker`](https://integration.wikimedia.org/ci/job/wmf-quibble-core-vendor-mysql-php72-docker/buildTimeTrend)
* 9-15 minutes (mediawiki-core, master, gate-and-submit)
** PHPUnit (dbless): 1.91 minutes / 15,782 tests.
** QUnit: 29 seconds / 1286 tests.
** Selenium: 143 seconds / 43 tests.
** PHPUnit (db): 3.85 minutes / 4377 tests.
Stats from [`wmf-quibble-core-vendor-mysql-hhvm-docker`](https://integration.wikimedia.org/ci/job/wmf-quibble-core-vendor-mysql-hhvm-docker/buildTimeTrend):
* 13-17 minutes (mediawiki-core, master, gate-and-submit)
** PHPUnit (dbless): 2.43 minutes / 15,782 tests.
** QUnit: 32 seconds / 1286 tests.
** Selenium: 187 seconds / 43 tests.
** PHPUnit (db): 4.78 minutes / 4377 tests.
### Scope of task
This task represents the goal of reaching 5 minutes or less. The work tracked here includes researching ways to get there, trying them out, and putting one or more ideas into practice. The task can be closed once we have reached the goal or if we have concluded it isn't feasible or useful.
Feel free to add/remove subtasks as we go along and consider different things.
### Stuff done
* Speed up LocalisationCache in Quibble jobs by switching from DB to file-based (by setting `$wgCacheDirectory`). – T225730#5400979
### Ideas to explore and related work
* Look at the PHPUnit "Test Report" for a commit and sort the root by duration. Find the slowest ones and look at its test suite to look for ways to improve it. Is it repeating expensive setups? Perhaps that can be skipped or re-used. Is it running hundreds of variations for the same integration test? Perhaps reduce it to just 1 case for that story, and apply the remaining cases to a lighter unit test instead.