Two tips to speed up bitbucket pipelines
Published 3 years and 5 months ago, Categorized under: Code, docker, PHP

In the past few days, I was playing around with pipelines to see what can I do with it, and how much can I squeeze it to get as much as I can from the functionality they offer. And I wanted to point out to two main things that you can do to speed up your PHP testing a bit, not much but a bit which counts.

First of all, if you don't use the built-in composer cache functionality, then you need to do that right away, and enabling it is just a small line of code that you add to the test section like

  - composer

Nothing else, once you have done that you will use the cache they offer and no need to redownload the packages from the internet and the cache will be invalidated automatically after 7 days (if am not mistaken), but this does not mean you don't have the ability to delete the cache manually. But keep in your mind that each section should use the caches tag otherwise it won't be useful, sadly Bitbucket pipeline does not offer a global cache feature.

Secondly, remember to install and use hirak/prestissimo package globally, which will give you a nice speed as we all know.

so your file can have something like:

clone:           # the 'clone' section
  depth: 1       # the depth, in this case the clone will contain last commit

  max-time: 10
  docker: true

image: zaherg/php-7.1-xdebug-alpine:latest


    - step:
        name: Build and push the image
        deployment: staging
          - composer
          - composer config -g $GITHUB_TOKEN
          - composer global require hirak/prestissimo
          - composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader


Share It via: