For my Laravel application, I have created a bitbucket-pipeline
:
image: php:8.0
pipelines:
branches:
stage:
- step:
name: Install Dependencies
caches:
- composer
- node
script:
- apt-get update && apt-get install -y unzip libpng-dev libjpeg-dev libfreetype6-dev
- docker-php-ext-configure gd --with-freetype --with-jpeg
- docker-php-ext-install gd
- curl -sS https://getcomposer.org/installer | php
- mv composer.phar /usr/local/bin/composer
- composer install --no-scripts
- curl -sL https://deb.nodesource.com/setup_16.x | bash -
- apt-get install -y nodejs
- npm install --legacy-peer-deps
- step:
name: Run Tests
script:
- vendor/bin/phpunit
- step:
name: Build Assets
caches:
- node
script:
- npm run prod
- step:
name: Migrate Database
script:
- php artisan migrate --force
- php artisan key:generate
- php artisan jwt:secret
services:
- mysql
definitions:
services:
mysql:
image: mysql:5.7
caches:
composer: ~/.composer/cache
node: ~/.npm
So far so good, but when I run this, I get the error:
bash: vendor/bin/phpunit: No such file or directory
I checked that the folder exist and everything is fine, but i still get the error.
can someone help me out?
2
Answers
Try use absolute path.
I think that step "Run Tests" must be after "Migrate Database".
Exercise for the reader: link all questions regarding this recurring confusion.
Each pipeline steps happens in a pristine docker container. Thus, the installation instructions of any tooling must be repeated in every and each step using that tooling! You must not rely on caches making software available, caches are solely meant to speed-up the install instructions, but aren’t guaranteed to be present (e.g. think about re-running a step after a cache has been cleared or expired).
From https://support.atlassian.com/bitbucket-cloud/docs/cache-dependencies/#Best-practices