Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Many modules and projects use Travis CI to run tests.
The recommended way of integrating Travis is via lionsad/drupal_ti.
Avoiding rate limiting
Too many projects hitting GitHub via Composer at the same time from the same place (Travis) often triggers rate limiting, with the following error:
[Composer\Downloader\TransportException]
Could not authenticate against github.com
The solution to this is to setup a GitHub OAuth token for your repository:
- Create a token at https://github.com/settings/tokens.
Leave all scopes unchecked, they're not needed. This token has read-only to public data, so it's harmless. - Go to https://travis-ci.org/drupalcommerce/commerce/settings (replace drupalcommerce/commerce with your own repo)
and add a GITHUB_OAUTH_TOKEN env variable, containing the token you just created. Make sure to set "Display value in build log" to ON, won't work otherwise. - Use the non-interactive (-n) mode in .travis-before-script.sh:
# Initialize composer_manager. php modules/composer_manager/scripts/init.php composer drupal-rebuild composer update -n --lock --verbose
- In .travis.yml your before-install needs to have the git config line:
before_install:
- composer self-update
# Add the oauth token to prevent GitHub timeouts.
- git config --global github.accesstoken $GITHUB_OAUTH_TOKEN
- composer global require "lionsad/drupal_ti:dev-master"
- drupal-ti before_install