Integrate App percy with Heroku CI
Integrate App percy with Heroku CI, Heroku’s continuous integration service
Follow these steps to integrate App percy with Heroku CI:
Configuring Heroku CI environment variables
Start by configuring PERCY_TOKEN, our project-specific, write-only API token. It can be found in your App percy project settings.
In your Heroku app’s pipeline, go to Settings > Heroku CI > Test config vars and add PERCY_TOKEN. Heroku CI passes test config vars to test runs but keeps them out of your build logs.
Alternatively, you can export the variable as part of your build script:
Commit, branch, and pull request information
App percy auto-detects Heroku CI builds via the HEROKU_TEST_RUN_ID environment variable. Heroku CI also exposes:
-
HEROKU_TEST_RUN_COMMIT_VERSION— commit SHA. -
HEROKU_TEST_RUN_BRANCH— branch name. Only populated when the test run is triggered through Heroku’s GitHub integration. Manual runs (Heroku dashboard,heroku ci:run, or API) do not set this variable; setPERCY_BRANCHexplicitly in those cases. -
HEROKU_PR_NUMBER— pull request number (when the test run is associated with a PR).
If HEROKU_PR_NUMBER or HEROKU_TEST_RUN_BRANCH is not available in your environment, set PERCY_PULL_REQUEST and PERCY_BRANCH to populate those fields manually. See the environment variables docs page for more details.
Run your tests
With your environment configured, run your App percy snapshots via your test suite or another mechanism. Your App percy build will be created with the correct meta-data.
Parallelized build processes
If you parallelize your build across multiple test runs, PERCY_PARALLEL_TOTAL and PERCY_PARALLEL_NONCE need to be configured. App percy automatically uses Heroku CI’s HEROKU_TEST_RUN_ID as the parallel build nonce. Set PERCY_PARALLEL_TOTAL to the total number of parallel runs.
Keep your Percy token secret.
Anyone with access to your Percy token can add builds to your project, though they cannot read data. If your code is public, do not commit the PERCY_TOKEN to your code.
Reference Topic
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
Thank you for your valuable feedback!