Skip to content

Fix: Travis configuration #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 11, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,30 @@
language: php

sudo: false
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jpignata

This sends builds to container-based infrastructure, see Using container-based infrastructure:

Jobs running on container-based infrastructure:

  1. start up faster
  2. allow the use of caches for public repositories
  3. disallow the use of sudo, setuid and setgid executables


php:
- 5.5

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jpignata

The --dev option is the default, so I removed it.

See https://getcomposer.org/doc/03-cli.md#install:

--dev: Install packages listed in require-dev (this is the default behavior).
--no-dev: Skip installing packages listed in require-dev. The autoloader generation skips the autoload-dev rules.

cache:
directories:
- $HOME/.composer/cache
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jpignata

As pointed out above, when builds are sent to container-based infrastructure, caching can be used.

The change above allows to cache dependencies installed with composer between builds, meaning that builds run faster, as dependencies do not need to be fetched from remote (unless they have changed, of course).

See Arbitrary directories.


env:
global:
secure: Yc+Xohkr/iEUU7FCQuSLXAE9ywNW9g6CfrM1Ki0Hl+fS15F3AXT7dFY8EyCJ4dP1/oI0dBmwrGWrltXV0XWIjGV1Ms3tefCgQpBBAqwT+hImzVP3RbpZW8Iyo2d0VgiDemQF1LWYD/pKu6d8WljTnv5D77NIMdEJjQ0uzeTLWdw=
install: composer install --dev

before_install:
- composer self-update
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jpignata

Composer generally emits warnings when it hasn't been updated in a while, and you may run into issues when you're using a different version of composer in development than what lives on Travis.

For example, when composer introduced the ^ operator for specifying version requirements, and locally, you started using that operator, but Travis wouldn't have that version yet, builds failed.

You can avoid this by either


install:
- composer install --prefer-dist

before_script:
- git config --global user.email "[email protected]"
- git config --global user.name "Travis CI"

script:
- vendor/bin/phpunit
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jpignata

Similar to https://github.com/codeclimate/php-test-reporter/pull/33/files#r47942080, and since you're requiring phpunit/phpunit in composer.json, you should run the same version if it as installed with composer, instead of the one available on Travis.

Otherwise you could possibly see yourself dealing with issues related to tests passing locally, but not on Travis.

This change here explicitly runs phpunit as installed with composer.


after_script:
- php composer/bin/test-reporter