Skip to content
Latchkey

How to Run a Smoke Test After Deploy in GitHub Actions

A smoke test is a small set of requests against the just-deployed environment that must all pass before the release is trusted.

Add a verify job that runs after deploy via needs:, sends a few requests to the deployed URL, and exits non-zero on any failure so the run is marked failed.

Steps

  • Add a verify job with needs: deploy.
  • Hit each critical path with curl --fail --show-error.
  • Return non-zero on the first failed check so the job fails.
  • Gate promotion (or trigger rollback) on this job's result.

Workflow

.github/workflows/ci.yml
jobs:
  verify:
    needs: deploy
    runs-on: ubuntu-latest
    steps:
      - name: Smoke test critical paths
        env:
          BASE: ${{ vars.DEPLOY_URL }}
        run: |
          set -euo pipefail
          curl --fail --show-error --silent "$BASE/healthz"
          curl --fail --show-error --silent "$BASE/api/status"
          curl --fail --show-error --silent -o /dev/null "$BASE/"

Gotchas

  • curl --fail returns exit 22 on HTTP >= 400, which fails the step; without it curl exits 0 on a 500.
  • Smoke tests should be fast and read-only; save deep flows for the e2e job.
  • Pair this job with automated rollback so a failed smoke test reverts the release, not just reports it.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →