Hey! These docs are for version 1, which is no longer officially supported. Click here for the latest version, 2!

Travis CI

Configure Percy environment variables in Travis CI

Percy is designed to integrate with your tests and CI environment. To enable Percy, the token environment variable must be configured in your CI service:

  • PERCY_TOKEN: The Percy repo write-only API token. This is unique for each Percy repository.

Travis repo settings


Travis CI provides an easy way to set environment variables in settings for a repository:

https://docs.travis-ci.com/user/environment-variables/#Defining-Variables-in-Repository-Settings

In your Travis repository go to Settings > Environment Variables.

Then set PERCY_TOKEN to the write-only token from your Percy repo. This token can be found in each Percy repo's settings.

🚧

IMPORTANT: Keep your Percy token secret. Anyone with access to your token can consume your account quota, though they cannot read data.

For Travis CI, make sure the "Display value in build log" toggle is off.

Alternative .travis.yml setup


A slightly more complicated way to set secret environment variables in Travis is to encrypt them and store them in your .travis.yml. See the Travis: Encrypted Variables docs for more info.

Next step: integrate with tests


You're done with setup---the last step is to integrate Percy into your tests and run them. Just choose your client library:

JavaScript

Ruby

Python

Static sites

Everything else