bashy

This is the script I use for a lot of projects.

before_script:
  - git submodule update --init
  - php -v
  - composer --version
  - git --version
  - ls -lah
  - composer self-update
  - composer config --global github-oauth.github.com $GITHUB_TOKEN
  - composer install --no-interaction
  - php artisan env
  - touch database/testing.sqlite
  - php artisan migrate --database=testing --env=testing

stages:
  - test

test:
  script:
  - vendor/bin/phpunit
  - vendor/bin/phpmd app/ text phpmd.xml
  - vendor/bin/phpcs --standard=psr2 app

I also use this locally to test the build before commiting.

#!/bin/sh

# Run some general commands so we're up-to-date
composer self-update
composer install --no-interaction --optimize-autoloader

# Setup db
touch database/testing.sqlite
echo "" > database/testing.sqlite
php artisan migrate --database=testing --env=testing

# Start tests
vendor/bin/phpmd app/ text phpmd.xml
vendor/bin/phpcbf --standard=psr2 app/
vendor/bin/phpcs --standard=psr2 --colors app/
vendor/bin/phpunit

Got a docker build for Laravel (php7) if you want to use it for the runner: https://hub.docker.com/r/bashy/docker-build/

Source: https://github.com/WithSocial/docker-build

Return to Thread...