GitHub Actions: Deploy and test
- Applies to
- Gatewayruntime for API, AI, and MCP gateways
- Hosting
- Managed EdgeManaged DedicatedSelf-HostedDiffers
1 difference by hosting option
Add --self-hosted-endpoint with your management API hostname to each zuplo deploy command so it targets your cluster. See zuplo deploy.
Run your test suite against the deployed environment to validate changes before considering them complete.
.github/workflows/deploy-and-test.yaml
This workflow:
- Deploys to Zuplo and captures the deployment URL.
- Runs your test suite against the live deployment.
- Fails the workflow if any tests fail.
The deploy step passes --environment explicitly because this workflow runs on
both push and pull_request events. The expression
${{ github.head_ref || github.ref_name }} resolves to the branch name on
either trigger, so every run for a branch updates the same environment. Without
it, pull_request runs create a second environment named after the PR merge ref
instead of your branch. For details, see
PR preview environments.
Write tests
describe, it, and TestHelper come from @zuplo/test, which a Zuplo
project already has through the zuplo package. Assertions use
chai, which a new project does not
include. Install it first:
Code
Place test files in the tests folder with the .test.ts extension:
tests/api.test.ts
TestHelper.TEST_URL is the value passed to --endpoint, so the same files run
against every environment. For the full setup, see
Get started with zuplo test.
Next steps
- Add PR preview environments with automatic cleanup
- Run local tests before deploying