Skip to content

Instantly share code, notes, and snippets.

@renatomefi
Created March 31, 2015 12:43
Show Gist options
  • Save renatomefi/a34274978c088fae3852 to your computer and use it in GitHub Desktop.
Save renatomefi/a34274978c088fae3852 to your computer and use it in GitHub Desktop.
Running Travis after_script only once
# 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
# 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