Skip to content

Instantly share code, notes, and snippets.

@ojkelly
Forked from iamEAP/.travis.yml
Last active August 29, 2015 14:15
Show Gist options
  • Select an option

  • Save ojkelly/853e2e36b54609456cf4 to your computer and use it in GitHub Desktop.

Select an option

Save ojkelly/853e2e36b54609456cf4 to your computer and use it in GitHub Desktop.

Revisions

  1. @iamEAP iamEAP revised this gist Oct 2, 2014. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions .travis.yml
    Original file line number Diff line number Diff line change
    @@ -135,3 +135,9 @@ after_script:

    # Delete the git branch we created.
    - cd $TRAVIS_BUILD_DIR; git push pantheon :$PSITE

    # Continuous delivery! Handy for advanced QA/UAT workflows.
    after_success:
    # If this was a master branch build (as opposed to PR), and the build passed:
    # Go ahead and push the changes up to the dev environment and "deploy."
    - if [ $TRAVIS_BRANCH = 'master' ] && [ $TRAVIS_PULL_REQUEST = 'false' ] ; then pushd $TRAVIS_BUILD_DIR && git push pantheon $PSITE:master && popd && drush @pantheon.$PNAME.dev updb -y --strict=0 ; fi
  2. @iamEAP iamEAP revised this gist May 21, 2014. 1 changed file with 1 addition and 4 deletions.
    5 changes: 1 addition & 4 deletions .travis.yml
    Original file line number Diff line number Diff line change
    @@ -85,9 +85,6 @@ before_script:
    # Authenticate with Pantheon via Terminus.
    - drush pauth $PEMAIL --password=$PPASS

    # Create a new Git branch on Pantheon using our random ci-name.
    - drush psite-bcreate $PUUID --name=$PSITE

    # Add Pantheon as a remote to our repo and force push to it.
    - cd $TRAVIS_BUILD_DIR
    - git checkout -b $PSITE
    @@ -137,4 +134,4 @@ after_script:
    - drush psite-edelete $PUUID $PSITE -y

    # Delete the git branch we created.
    - drush psite-bdel $PUUID --name=$PSITE -y
    - cd $TRAVIS_BUILD_DIR; git push pantheon :$PSITE
  3. @iamEAP iamEAP revised this gist Apr 11, 2014. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion .travis.yml
    Original file line number Diff line number Diff line change
    @@ -107,7 +107,9 @@ before_script:
    # When new modules are added to the codebase, updb can sometimes fail (thus
    # causing a failed build) because the system table and modules are out of
    # sync. We get around this by clearing all caches before attempting anything.
    - drush @pantheon.$PNAME.$PSITE cc all --strict=0
    # The "|| true" works around issues where Views and Block conflict during
    # cache clears / block rehashes.
    - drush @pantheon.$PNAME.$PSITE cc all --strict=0 || true

    # Run all available updates as if deploying. For now, append the
    # --strict=0 option for Drush 6.x compatibility on Pantheon.
  4. @iamEAP iamEAP revised this gist Mar 4, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion .travis.yml
    Original file line number Diff line number Diff line change
    @@ -95,7 +95,7 @@ before_script:
    - git push --force pantheon $PSITE

    # Create a new Pantheon environment using the above branch.
    - drush psite-ecreate $PUUID $PSITE --source=$PSOURCE
    - drush psite-ecreate $PUUID $PSITE --source=$PSOURCE || true

    # Update our drush aliases file.
    - drush paliases
  5. @iamEAP iamEAP revised this gist Feb 14, 2014. 1 changed file with 5 additions and 4 deletions.
    9 changes: 5 additions & 4 deletions .travis.yml
    Original file line number Diff line number Diff line change
    @@ -55,10 +55,11 @@ env:
    #
    - secure: "encrypted_password_value_here"

    # Generate a random branch / multidev name, prefixed with "ci-" and
    # suffixed with the Travis build number (for easier build debug).
    - PSITE=$(cat /dev/urandom | tr -cd 'a-z0-9' | head -c 5)
    - PSITE="ci-$PSITE-$TRAVIS_BUILD_NUMBER"
    # Generate a random branch / multidev name, prefixed with "ci" followed
    # by the Travis build number. Note, due to Pantheon multidev environment
    # name limits, builds will start failing at #100000.
    - PSITE=$(cat /dev/urandom | tr -cd 'a-z0-9' | head -c 4)
    - PSITE="ci$TRAVIS_BUILD_NUMBER-$PSITE"

    # You can use $PHOST as a reference to the resulting multidev hostname.
    - PHOST="https://$PSITE-$PNAME.gotpantheon.com"
  6. @iamEAP iamEAP revised this gist Feb 13, 2014. 1 changed file with 6 additions and 3 deletions.
    9 changes: 6 additions & 3 deletions .travis.yml
    Original file line number Diff line number Diff line change
    @@ -69,9 +69,8 @@ install:
    - echo "StrictHostKeyChecking no" > ~/.ssh/config

    # Install Drush.
    - pear channel-discover pear.drush.org
    - pear install drush/drush-6.2.0.0
    - phpenv rehash
    - composer global require drush/drush:6.2.0
    - export PATH="$HOME/.composer/vendor/bin:$PATH"

    # Install Terminus.
    - git clone https://github.com/pantheon-systems/terminus.git $HOME/.drush/terminus
    @@ -116,6 +115,10 @@ before_script:
    # Enable additional test dependencies here, like SimpleTest.
    - drush @pantheon.$PNAME.$PSITE en simpletest -y --strict=0

    # If you're using SimpleTest, you'll want to disable verbose logging. This
    # ensures no false build failures from file write errors.
    - drush @pantheon.$PNAME.$PSITE vset -y simpletest_verbose 0 --strict=0

    script:
    #
    # This is where you run your tests, be they SimpleTest, Casper, Behat,
  7. @iamEAP iamEAP revised this gist Feb 12, 2014. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions .travis.yml
    Original file line number Diff line number Diff line change
    @@ -104,6 +104,11 @@ before_script:
    # We cannot be in a Drupal directory to run aliased drush commands.
    - cd $HOME

    # When new modules are added to the codebase, updb can sometimes fail (thus
    # causing a failed build) because the system table and modules are out of
    # sync. We get around this by clearing all caches before attempting anything.
    - drush @pantheon.$PNAME.$PSITE cc all --strict=0

    # Run all available updates as if deploying. For now, append the
    # --strict=0 option for Drush 6.x compatibility on Pantheon.
    - drush @pantheon.$PNAME.$PSITE updb -y --strict=0
  8. @iamEAP iamEAP revised this gist Feb 11, 2014. 1 changed file with 4 additions and 3 deletions.
    7 changes: 4 additions & 3 deletions .travis.yml
    Original file line number Diff line number Diff line change
    @@ -55,9 +55,10 @@ env:
    #
    - secure: "encrypted_password_value_here"

    # Generate a random branch / multidev name, prefixed with "ci-"
    - PSITE=$(cat /dev/urandom | tr -cd 'a-z' | head -c 8)
    - PSITE="ci-$PSITE"
    # Generate a random branch / multidev name, prefixed with "ci-" and
    # suffixed with the Travis build number (for easier build debug).
    - PSITE=$(cat /dev/urandom | tr -cd 'a-z0-9' | head -c 5)
    - PSITE="ci-$PSITE-$TRAVIS_BUILD_NUMBER"

    # You can use $PHOST as a reference to the resulting multidev hostname.
    - PHOST="https://$PSITE-$PNAME.gotpantheon.com"
  9. @iamEAP iamEAP created this gist Feb 7, 2014.
    128 changes: 128 additions & 0 deletions .travis.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,128 @@
    language: php

    #
    # Important to note, this is the version of PHP used to run this build, not the
    # one used to run your Drupal installation. Ensure compatibility with the Drush
    # and Terminus versions you're using for this build.
    #
    php:
    - 5.3

    #
    # Travis/Pantheon integration requires an RSA key that at least has read access
    # to your GitHub repo and write access to Pantheon's git repo. Create a user on
    # both systems with the most restricted access, given the aforementioned
    # constraints. Then, for the given user, generate and load a public key to both
    # GitHub/Pantheon. Follow instructions from Travis-CI on using this new key.
    #
    # Keep the Pantheon account e-mail address and password handy, you'll need it
    # below in env.global.
    #
    # http://docs.travis-ci.com/user/travis-pro/
    # https://help.github.com/articles/generating-ssh-keys
    #
    source_key: INSERT_KEY_HERE

    env:
    global:
    # Your Pantheon site's UUID (e.g. from your dashboard URL)
    - PUUID='aaaaaaaa-0000-bbbb-1111-cccccccccccc'

    # Your Pantheon site's name.
    - PNAME='site-name'

    # The Pantheon environment name from which Multidev DB/files will be pulled.
    # Probably one of: dev, test, live.
    - PSOURCE='test'

    #
    # PEMAIL environment variable: represents the Pantheon account e-mail with
    # access to this site. Used to authenticate to Pantheon via Terminus. You
    # must cd to your project root and run:
    #
    # travis encrypt PEMAIL='[email protected]' --add env.global
    #
    # Which will eventually look something like the key below.
    # See: http://docs.travis-ci.com/user/build-configuration/#Secure-environment-variables
    #
    - secure: "encrypted_email_value_here"

    #
    # PPASS environment variable: represents the Pantheon account password for
    # the above encrypted e-mail address. Run:
    #
    # travis encrypt PPASS='my_account_password' --add env.global
    #
    - secure: "encrypted_password_value_here"

    # Generate a random branch / multidev name, prefixed with "ci-"
    - PSITE=$(cat /dev/urandom | tr -cd 'a-z' | head -c 8)
    - PSITE="ci-$PSITE"

    # You can use $PHOST as a reference to the resulting multidev hostname.
    - PHOST="https://$PSITE-$PNAME.gotpantheon.com"

    install:
    # Dynamic hosts through Pantheon mean constantly checking interactively
    # that we mean to connect to an unknown host. We ignore those here.
    - echo "StrictHostKeyChecking no" > ~/.ssh/config

    # Install Drush.
    - pear channel-discover pear.drush.org
    - pear install drush/drush-6.2.0.0
    - phpenv rehash

    # Install Terminus.
    - git clone https://github.com/pantheon-systems/terminus.git $HOME/.drush/terminus
    - cd $HOME/.drush/terminus
    - composer update --no-dev
    - drush cc drush

    # Install additional test dependencies here (like Casper, Behat, etc).

    before_script:
    # Authenticate with Pantheon via Terminus.
    - drush pauth $PEMAIL --password=$PPASS

    # Create a new Git branch on Pantheon using our random ci-name.
    - drush psite-bcreate $PUUID --name=$PSITE

    # Add Pantheon as a remote to our repo and force push to it.
    - cd $TRAVIS_BUILD_DIR
    - git checkout -b $PSITE
    - git remote add pantheon ssh://[email protected].$PUUID.drush.in:2222/~/repository.git
    - git push --force pantheon $PSITE

    # Create a new Pantheon environment using the above branch.
    - drush psite-ecreate $PUUID $PSITE --source=$PSOURCE

    # Update our drush aliases file.
    - drush paliases
    - drush cc drush

    # We cannot be in a Drupal directory to run aliased drush commands.
    - cd $HOME

    # Run all available updates as if deploying. For now, append the
    # --strict=0 option for Drush 6.x compatibility on Pantheon.
    - drush @pantheon.$PNAME.$PSITE updb -y --strict=0

    # Enable additional test dependencies here, like SimpleTest.
    - drush @pantheon.$PNAME.$PSITE en simpletest -y --strict=0

    script:
    #
    # This is where you run your tests, be they SimpleTest, Casper, Behat,
    # or otherwise. Here's a SimpleTest example. I've found that drush
    # likes to exit with odd codes if you run multiple classes at once.
    # You may have to run one class at a time.
    #
    - drush @pantheon.$PNAME.$PSITE test-run MyTestClass --strict=0
    - drush @pantheon.$PNAME.$PSITE test-run MyTestClass2 --strict=0

    after_script:
    # Destroy the Pantheon environment
    - drush psite-edelete $PUUID $PSITE -y

    # Delete the git branch we created.
    - drush psite-bdel $PUUID --name=$PSITE -y