Saibamen
Saibamen

Reputation: 648

How to setup travis-ci with Laravel 5? InvalidArgumentException

I tried to run Travis-ci with Laravel 5.2 several times, but nothing works for me. I can run phpunit locally and it works, but not in travis.

My current travis.yml:

language: php

php:
  - 5.5
  - 5.6
  - 7.0
  #- hhvm
  #- nightly

sudo: required

before_script:
  - mkdir bootstrap/cache
  - mkdir storage
  - mkdir storage/framework
  - mkdir storage/framework/cache
  - sudo chmod -R 777 bootstrap/cache
  - sudo chmod -R 777 storage
  #- cp .env.travis .env
  - composer self-update
  - composer install --no-interaction
  #- php artisan key:generate

script:
  - vendor/bin/phpunit

The latest error in travis is a failed request to [http://localhost]. Received status code [500]. Caused by exception 'InvalidArgumentException' with message 'Please provide a valid cache path.' in /home/travis/build/Saibamen/laravel5-travis/bootstrap/cache/compiled.php:15392

All commits and travis logs are here: click

Upvotes: 0

Views: 1960

Answers (2)

Saibamen
Saibamen

Reputation: 648

Correct travis file is:

language: php

php:
  - 5.6
  - 7.0

before_script:
  - mkdir bootstrap/cache
  - mkdir storage
  - mkdir storage/app
  - mkdir storage/framework
  - mkdir storage/framework/sessions
  - mkdir storage/framework/cache
  - mkdir storage/framework/views
  - chmod 777 -R storage
  - cp .env.travis .env
  - mysql -e 'create database homestead_test;'
  - composer self-update
  - composer install --no-interaction
  - php artisan key:generate

script:
  - vendor/bin/phpunit

Upvotes: 2

Erik
Erik

Reputation: 555

My .travis.yml

language: php

php:
  - 5.6
  - 7.0

before_script:
  - cp .env.travis .env
  - composer self-update
  - composer install --no-interaction
  - php artisan key:generate

script:
  - vendor/bin/phpunit

Upvotes: 1

Related Questions