MarcoROG / Courses

0 stars 0 forks source link

Add Travis CI for easy management #4

Open ludo237 opened 6 years ago

ludo237 commented 6 years ago

TravisCI helps to test and deploy with Confidence, it's really easy to set-up in a FOSS project like this and can help manage the pull request health before merging them!

https://travis-ci.org/

ludo237 commented 6 years ago

A simple snippet for Laravel based projects:

language: php

sudo: false

php:
  - 7.1

services:
  - mysql
  - redis-server

before_script:
  - mysql -e 'create database courses;'
  - chmod 777 -R storage
  - cp .env.travis .env
  - php artisan key:generate
  - php artisan migrate:fresh --seed
  - npm install
  - npm run dev

after_script:
  - vendor/bin/test-reporter

matrix:
  fast_finish: true
  include:
    - php: 7.1
      env: setup=stable

cache:
  directories:
    - $HOME/.composer/cache

before_install:
  - printf "\n" | pecl install -f redis
  - travis_retry composer self-update

install:
  - if [[ $setup = 'basic' ]]; then travis_retry composer install --dev --no-interaction --prefer-dist --no-suggest; fi
  - if [[ $setup = 'stable' ]]; then travis_retry composer install --dev --prefer-dist --no-interaction --no-suggest; fi
  - if [[ $setup = 'edgy' ]]; then travis_retry composer install --dev --prefer-dist --no-interaction --prefer-lowest --no-suggest; fi

script: vendor/bin/phpunit --log-junit="./reports/phpunit/junit.xml" --coverage-html="./reports/phpunit/coverage" --testdox-html="./reports/phpunit/testdox" --coverage-clover build/logs/clover.xml

notifications:
  email: false