Heroku CI

This chapter shows how to integrate with FeaturePeek when using Heroku CI.

Prerequisite: You should create a FeaturePeek account and configure your peek.yml file before following the steps in this chapter.

Example config file

If you already have your config file set up, simply add the FeaturePeek CI command as a test in your pipeline.

You may already have test scripts set up — in that case, you'll want to create a script that builds your frontend, pings FeaturePeek, and then runs your tests. It's recommended to ping FeaturePeek before running your test so that your deployment comes up faster.

Your /app.json file should contain a test environment where you can run custom scripts. You'll need to build your frontend here, and then ping FeaturePeek. You can use the test-setup key to build your frontend, and then the test key to run our CI command.

You'll also need to add an environment variable called GITHUB_SLUG. This value should be the URL to your repo, without the https://github.com/ in the front. For example, if your repo URL is https://github.com/my-github-org/my-github-repo, your GITHUB_SLUG should be my-github-org/my-github-repo.

Your /app.json should look something like this:

{
"name": "my-heroku-app",
"stack": "heroku-18",
"scripts": {},
"addons": [],
"buildpacks": [],
"env": {},
"formation": {},
"environments": {
"test": {
"scripts": {
"test-setup": "npm run build",
"test": "bash <(curl -s https://peek.run/ci)"
},
"env": {
"GITHUB_SLUG": "my-github-org/my-github-repo"
}
}
}
}

Note: The command in the snippet above is just for static builds — if you are building a Docker image, you'll need to pass in more arguments.

Sample code repo

You can search the FeaturePeek org on GitHub to find sample repos of frontends that integrate FeaturePeek with Heroku. Be sure to visit the open pull requests to find links to running public FeaturePeek deployment.

Try it out

Try opening a new pull request that contain the changes in this chapter. When your CI finishes successfully, you should see the FeaturePeek bot comment a link on your pull request. If not, consult our Troubleshooting section.