Calibre’s CLI is optimised for use in CI/CD environments. You can use the CLI to automate performance testing of your sites in Calibre.
Check Command Line Interface documentation for more information about the available commands.
Detect Pull Request preview deployments from GitHub. Each time a Pull Request is deployed to a preview environment, Calibre will run a performance test and compare the results to the production environment.
1name: Calibre Pull Request Review2on: [deployment_status]34jobs:5 # Start a new Pull Request Review.6 # Output will be written to the GitHub Step Summary.7 # See https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary for more info.89 pr_review:10 # Only run this job if the deployment status is successful11 # Only complete this job if the deployment's branch corresponds to a Pull Request12 # Optional: filter by environment name or URL - contains(github.event.deployment_status.environment_url, 'onrender.com')13 if: github.event.deployment_status.state == 'success' && contains(github.event.deployment_status.environment_url, 'onrender.com')14 name: Pull Request Review15 runs-on: ubuntu-latest16 steps:17 - uses: actions/checkout@v4 # Required for `gh pr view`18 - id: pr19 env:20 GH_TOKEN: ${{ github.token }}21 run: |22 echo "PR_TITLE=$(gh pr view "${{ github.ref_name }}" --json 'title' --jq '.title')" >> "$GITHUB_OUTPUT"23 - name: Run Pull Request Review24 id: pull_request_review25 if: steps.pr.outputs.PR_TITLE != null26 env:27 CALIBRE_API_TOKEN: ${{ secrets.CALIBRE_API_TOKEN }}28 run: |29 echo "PULL_REQUEST_REVIEW_REPORT=$(npx calibre site create-pull-request-review \30 --title="${{ steps.pr.outputs.PR_TITLE }}" \31 --site="${{ secrets.CALIBRE_SITE_SLUG }}" \32 --branch="${{ github.ref_name }}" \33 --sha="${{ github.sha }}" \34 --url="${{ github.event.deployment_status.environment_url }}" \35 --waitForResult \36 --markdown)" >> $GITHUB_OUTPUT37 - name: Post PR comment38 if: steps.pr.outputs.PR_TITLE != null39 env:40 GH_TOKEN: ${{ github.token }}41 run: |42 gh pr comment "${{ github.ref_name }}" --body "${{ steps.pull_request_review.outputs.PULL_REQUEST_REVIEW_REPORT }}"43 - name: Post Job summary44 if: steps.pr.outputs.PR_TITLE != null45 env:46 GH_TOKEN: ${{ github.token }}47 run: |48 echo "${{ steps.pull_request_review.outputs.PULL_REQUEST_REVIEW_REPORT }}" > $GITHUB_STEP_SUMMARY
Merges to the main branch will trigger the workflow and create a deploy marker in Calibre.
1name: Notify Calibre of production deploy2on:3 push:4 branches:5 - main67jobs:8 build:9 name: Notify Calibre10 runs-on: ubuntu-latest11 steps:12 - name: Create deploy13 uses: actions/setup-node@v314 env:15 CALIBRE_API_TOKEN: ${{ secrets.CALIBRE_API_TOKEN }}16 run: |17 npx calibre site create-deploy --site=${{ secrets.CALIBRE_SITE_SLUG }} --revision=${{ env.GITHUB_SHA }} --repository https://github.com/${{ env.GITHUB_REPOSITORY }}18 - name: Get result19 run: echo "${{steps.set-result.outputs.result}}"
On this page