Created
March 31, 2015 12:43
-
-
Save renatomefi/a34274978c088fae3852 to your computer and use it in GitHub Desktop.
Running Travis after_script only once
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a workaround for running Travis after_script only once in a matrix, it has one fault, | |
# if your chosen build was successful and the others don't, it will run anyway, there are more | |
# complete solutions available, but here is a simple one. | |
language: php | |
php: | |
- 5.4 | |
- 5.5 | |
- 5.6 | |
# Prepare your environment | |
before_script: ~ | |
# Run your build | |
script: ~ | |
# I want to echo "Uhul" only when my build is successful at PHP 5.6, and it's only once in a matrix | |
after_script: > | |
if [ $(phpenv version-name) = '5.6' ]; then | |
echo Uhul | |
; fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# My real case scenario with Symfony 2 and Code Climate sending messages to Gitter | |
language: php | |
php: | |
- 5.4 | |
- 5.5 | |
- 5.6 | |
env: | |
global: | |
- SYMFONY_ENV=test | |
services: | |
- mongodb | |
before_script: | |
- echo "version $(phpenv version-name)" | |
- npm install -g bower | |
- ln -s $(which bower) bin/bower | |
- echo "extension = mongo.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini | |
- composer self-update | |
- composer install --optimize-autoloader --prefer-source | |
- php app/console --env=test doctrine:mongodb:schema:create --index | |
- php app/console --env=test doctrine:mongodb:fixtures:load --append | |
script: phpunit --verbose --repeat=3 -c app/phpunitTravis.xml | |
after_script: > | |
if [ $(phpenv version-name) = '5.6' ]; then | |
bin/test-reporter | |
&& curl -d message="[CodeClimate]($CODECLIMATE_URL) updated" $CODECLIMATE_GITTER_URL | |
|| curl -d message="CodeClimate failed to update" -d level=error $CODECLIMATE_GITTER_URL | |
; fi | |
notifications: | |
webhooks: | |
urls: | |
- https://webhooks.gitter.im/e/token | |
on_success: always | |
on_failure: always |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment