Skip to content

Instantly share code, notes, and snippets.

@xicond
Last active March 9, 2022 04:19
Show Gist options
  • Save xicond/b991a981f014ae1aff6577a36e99032c to your computer and use it in GitHub Desktop.
Save xicond/b991a981f014ae1aff6577a36e99032c to your computer and use it in GitHub Desktop.
Laravel Bitbucket Pipeline Example
# Template PHP Build
# This template allows you to validate your PHP application.
# The workflow allows running tests and code linting on the default branch.
image: php:7.4-alpine
pipelines:
default:
- parallel:
- step:
name: Test
script:
- |
# Setup PHP
set -xe; \
apk update && apk add rabbitmq-c rabbitmq-c-dev git curl mysql-client libzip-dev zip unzip libzip gnupg libmemcached-dev freetype-dev libjpeg-turbo-dev jpeg-dev libpng-dev oniguruma-dev libressl libressl-dev autoconf linux-headers build-base libxml2-dev; \
php -i|grep tokenizer || docker-php-ext-install tokenizer ; \
docker-php-ext-configure zip; \
docker-php-ext-configure gd --with-freetype --with-jpeg; \
docker-php-ext-install sockets zip gd mysqli pdo pdo_mysql pcntl exif mbstring xml; \
pecl channel-update pecl.php.net; \
pecl install memcached; \
pecl install amqp; \
docker-php-ext-enable amqp memcached gd zip mysqli pcntl pdo_mysql sodium exif xml; \
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
- COMPOSER_ALLOW_SUPERUSER=1 composer install
- ln -f -s .env.example .env
# - php artisan migrate
- php artisan serve &
- sleep 5
# - ./vendor/bin/phpunit
- curl -vk http://localhost:8000
caches:
- composer
- php-ext-source
- php-ext
- apk
- step:
name: Lint
caches:
- composer
- php-ext
script:
- find . \( -path "./vendor/**" -o -path "./storage/framework/views/*" \) -prune -o -name \*.php -type f -print0 | xargs -n 1 -0 php -l
definitions:
caches:
apk: /etc/apk/cache
php-ext-source: /usr/src/php/ext
php-ext: /usr/local/lib/php/extensions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment