Problem/Motivation
Core has three overall stages in gitlab pipelines: Build, Lint and Test.
The build stage consists of two jobs - composer and yarn, which exist only to build caches/artifiacts for later stages.
However, composer install and yarn install very fast, maybe 10 seconds or so on gitlab, while waiting for a runner, downloading an image and running a job in total is at least 45s-1m.
If we flatten the build and yarn jobs, and have the lint jobs do their own yarn and composer installs, then we only add 5-10 seconds to each lint job, but we save a full minute by running the build and lint jobs in parallel.
Because the lint jobs will now be doing composer install and yarn install, we can then go a step further and use those to build the caches for the test pipeline/stage, removing the composer and yarn jobs altogether.
This means we lose two jobs from the pipeline (couple of minutes of compute time), while doing an extra 2-3 composer/yarn installs (probably 30-60s of compute time). It should save on both wall time and compute time overall.