Cloudflare Pages and Workers
Run Smoketest after Cloudflare Pages or Workers deployments.
Cloudflare Pages and Workers can be deployed from Git, deploy hooks, Wrangler, or CI. Use Smoketest after the deployment is live.
Pages with GitHub Actions
name: Deploy Pages and run Smoketest
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Deploy Pages
run: npx wrangler pages deploy dist --project-name "$CLOUDFLARE_PAGES_PROJECT"
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
CLOUDFLARE_PAGES_PROJECT: acme-site
- name: Trigger Smoketest
run: |
curl -sf -X POST -G "$SMOKETEST_DEPLOYMENT_WEBHOOK_URL" \
-H "Idempotency-Key: ${{ github.run_id }}-${{ github.run_attempt }}" \
--data-urlencode "targetUrl=$DEPLOYMENT_URL" \
--data-urlencode "commitSha=${{ github.sha }}" \
--data-urlencode "branch=${{ github.ref_name }}" \
--data-urlencode "externalId=${{ github.run_id }}-${{ github.run_attempt }}"
env:
SMOKETEST_DEPLOYMENT_WEBHOOK_URL: ${{ secrets.SMOKETEST_DEPLOYMENT_WEBHOOK_URL }}
DEPLOYMENT_URL: https://www.example.comWorkers with Wrangler
name: Deploy Worker and run Smoketest
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Deploy Worker
run: npx wrangler deploy
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
- name: Trigger Smoketest
run: |
curl -sf -X POST -G "$SMOKETEST_DEPLOYMENT_WEBHOOK_URL" \
-H "Idempotency-Key: ${{ github.run_id }}-${{ github.run_attempt }}" \
--data-urlencode "targetUrl=$DEPLOYMENT_URL" \
--data-urlencode "commitSha=${{ github.sha }}" \
--data-urlencode "branch=${{ github.ref_name }}" \
--data-urlencode "externalId=${{ github.run_id }}-${{ github.run_attempt }}"
env:
SMOKETEST_DEPLOYMENT_WEBHOOK_URL: ${{ secrets.SMOKETEST_DEPLOYMENT_WEBHOOK_URL }}
DEPLOYMENT_URL: https://api.example.comCloudflare deploy hooks
Cloudflare deploy hooks trigger Cloudflare deployments; they are not post-deploy notifications to Smoketest. Use your CI pipeline after deployment, or trigger Smoketest from the same script that calls the Cloudflare deploy hook after the site is reachable.