This project was created to show how to integrate Checkly CLI with ngrok tunnels to test feature branches source code before merging them into staging or production stages, using Github Actions CI/CD workflows.
You can sign up for a free Checkly account here and ngrok account here.
After you get your Checkly API Key and ngrok authtoken, you must configure the following secrets within your project settings:
| secret | description | type |
|---|---|---|
CHECKLY_ACCOUNT_ID |
Access your Account settings to get the value. | UUID |
CHECKLY_API_KEY |
Access the API Keys section to create a new API Key. | String (cu_...) |
NGROK_AUTHTOKEN |
Access the Your Authtoken section to create a new Authtoken. | String |
This example uses a Vue 3 boilerplate project and has two open pull-request:
- PR #10 with all tests passing, executing the checks running the branch source-code.
- PR #9 with tests failing, restricting the pull request to be merged.
You can execute test pointing to your local server using process.env.NGROK_URL as URL string:
# Terminal 1
# set the ngrok authtoken
export NGROK_AUTHTOKEN=<your_ngrok_auth_token>
# runs (and keep running) your local server listening in localhost:5173 connected to an ngrok tunnel
npm run tunnel:dev# Terminal 2
# run 'npx checkly login' or set the following environment variables
export CHECKLY_ACCOUNT_ID=<your_checkly_account_id>
export CHECKLY_API_KEY=<your_checkly_api_key>
# execute 'npx checkly test' sending NGROK_URL
npm run tunnel:checkly:test