platformsh / gha-template-pr-tests

Performs a series of tests on the pull request environment for a pull request

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Platform.sh Template Pull Request Tests

Performs a series of tests on the pull request environment for each pull request.

Will check for the status of the PR environment. Once available will retrieve the URL for the environment, and then begin a visual regression test between the production environment and PR environment. If the visual regression test fails, will create a comment in the PR with a link to the visual regression report.

Note that this action assumes it is ok to check the PR environment even if a valid certificate has not been issued when testing begins.

Inputs

  • github-token - REQUIRED. Github personal access token with access rights to the target repository so we can work with the github api. You can reuse the default GITHUB_TOKEN that's created for the runner.
  • baseline-url - REQUIRED. Full URL to the "production" version of the template. This URL is used to create the reference set of images in the visual regression tests. It must include a trailing slash.
  • delay-start - Optional. Delay the start of testing for X seconds after the PR environment is available. Please note this is in seconds, not milliseconds. Must be a valid integer.
  • baseline-header-response - Optional. The header response that we consider valid when checking the root of the baseline URL. Defaults to 200.
  • test-header-response - Optional. The header response that we consider valid when checking the root of the
  • pr-timeout - Optional. The number of seconds the action should wait for Platform.sh to report back with a PR environment URL. Defaults to 300

Outputs

  • None

Example Usage

name: "Test the Pr Environment"
on:
  workflow_run:
    workflows: [ "platformsh" ]
    types:
      - completed
  pull_request:
    branches:
      - master
      - main
jobs:
  test-pr-env:
    name: TestPrEnvironment
    runs-on: ubuntu-latest
    if: ${{ github.repository_owner == 'platformsh-templates' }}
    steps:
      - name: 'Run Pull Request Tests'
        id: pr-tests
        uses: platformsh/gha-template-pr-tests@main
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          baseline-url: ${{ vars.BASELINE_URL }}
          delay-start: 2

Uses

Roadmap

  • Expand checks on baseline-url to ensure a valid URL, and contains trailing slash, add if missing
  • Add behavioral testing
  • Add performance/Blackfire.io testing

About

Performs a series of tests on the pull request environment for a pull request