Configure Your Project for CI/CD
To connect an Emtrey project to a CI/CD, follow these steps:
- Sign into your Emtrey dashboard
- Select the project to connect to CI/CD
- Choose SETTINGS from the project menu
- Click the CONNECT TO YOUR CI/CD PIPELINE button:
- Click CONNECT TO CI/CD button and copy your unique EMTREY_CICD_TOKEN
- Add a new environment variable to your CI/CD pipeline settings, named
EMTREY_CICD_TOKEN
, and paste your token from above as it’s value.
Configuring Your CI/CD Tool
Each CI/CD tool needs to be configured a little differently, but the basic steps to running Emtrey remotely are similar:
- Install headless Chrome/Firefox browser (if needed)
- Run the web app locally
- Run the Emtrey CLI tool
To see how to configure your particular tool, refer to one of the following sections below.
CircleCI
To setup the Emtrey CLI tool to run in CircleCI, you must first connect your application to CircleCI by following their Getting Started tutorial. You can also check out a working example React project configured to work with CircleCI on Emtrey’s GitHub.
EXAMPLE: Check out a working example React project configured to work with CircleCI on Emtrey’s GitHub.
After you can successfully trigger a run in CircleCI, you can ammend the circleci/config.yml
to run the Emtrey CLI.
- Add the
circleci/browser-tools
orb toorbs
section:
orbs: browser-tools: circleci/browser-tools@1.1.3
- Add a step to install a headless version of the Chrome browser:
steps: # Other steps... - browser-tools/install-chrome
- Add a new step to run your application in the background. For example:
steps: # Previous steps... - run: name: start server command: node server.js background: true - run: name: emtrey command: npx emtrey --port=3000
where PORT
should be replaced by the port number of the local server set in server.js
. For example, the default settings for a React application tells it to start running on port 8080.
At this point, CircleCi is configured to run Emtrey when the pipeline is run!
You must set the
EMTREY_CICD_TOKEN
in your CircleCI’s project environment variables. Refer to the above section for instructions on how to find your token.