Skip to content

CapRover

Run Smoketest after CapRover deployments from GitHub Actions or another CI pipeline.

View as Markdown

CapRover supports several deployment methods, including CLI and GitHub Actions. Trigger Smoketest after the CapRover deployment command completes.

GitHub Actions

.github/workflows/caprover-smoketest.yml
name: Deploy to CapRover and run Smoketest

on:
  push:
    branches: [main]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Deploy to CapRover
        run: |
          npm install -g caprover
          caprover deploy \
            --caproverUrl "$CAPROVER_URL" \
            --caproverPassword "$CAPROVER_PASSWORD" \
            --caproverApp "$CAPROVER_APP"
        env:
          CAPROVER_URL: ${{ secrets.CAPROVER_URL }}
          CAPROVER_PASSWORD: ${{ secrets.CAPROVER_PASSWORD }}
          CAPROVER_APP: acme-web
      - 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://app.example.com

CapRover repository webhooks

CapRover's repository webhooks trigger CapRover deployments. They are not post-deploy notifications to Smoketest. If you deploy through repository webhooks, add Smoketest to the CI path that triggers CapRover or use a server-side script after deployment.

On this page