Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

premiSoft's avatar

How to set up CI/CD with Bitbucket pipelines.

This is my first time working with any CI/CD script. So, I have installed envoy on my app to handle the needed tasks. I have the test/build script running fine. But somewhere I am off with my deployment. Would someone mind looking over my .yml code and helping me understand what I have wrong.


pipelines:
  default:
    - step:
        name: Build and test
        caches:
          - composer
        script:
          - apt-get update && apt-get install -qy git curl libmcrypt-dev mariadb-client ghostscript
          - yes | pecl install mcrypt-1.0.3
          - docker-php-ext-install pdo_mysql bcmath exif
          - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --file           name=composer
          - composer install
          - ln -f -s .env.pipelines .env
          - php artisan migrate
          - ./vendor/bin/phpunit
        services:
          - mysql
          - redis
definitions:
  services:
    mysql:
      image: mysql:5.7
      environment:
        MYSQL_DATABASE: "laravel-pipeline"
        MYSQL_RANDOM_ROOT_PASSWORD: "yes"
        MYSQL_USER: "homestead"
        MYSQL_PASSWORD: "secret"
    redis:
      image: redis
  script:
 - pipe: atlassian/scp-deploy:0.3.13
   variables:
    USER: '${remoteUser}'
    SERVER: '${server}'
    REMOTE_PATH: '${remote}'
    LOCAL_PATH: '${BITBUCKET_CLONE_DIR}/*'
0 likes
1 reply

Please or to participate in this conversation.