{"id":15527822,"url":"https://github.com/swissspidy/wp-performance-action","last_synced_at":"2025-04-16T03:45:45.883Z","repository":{"id":186767460,"uuid":"674602443","full_name":"swissspidy/wp-performance-action","owner":"swissspidy","description":"Reusable GitHub action to measure performance metrics of WordPress sites","archived":false,"fork":false,"pushed_at":"2024-04-29T11:50:58.000Z","size":4514,"stargazers_count":19,"open_issues_count":4,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-05-02T00:41:34.636Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/swissspidy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-08-04T10:43:32.000Z","updated_at":"2024-05-06T12:37:19.680Z","dependencies_parsed_at":null,"dependency_job_id":"73377cf6-4fe6-4784-a6ac-e65b53634eae","html_url":"https://github.com/swissspidy/wp-performance-action","commit_stats":null,"previous_names":["swissspidy/wp-performance-action"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swissspidy%2Fwp-performance-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swissspidy%2Fwp-performance-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swissspidy%2Fwp-performance-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swissspidy%2Fwp-performance-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/swissspidy","download_url":"https://codeload.github.com/swissspidy/wp-performance-action/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249192210,"owners_count":21227748,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-02T11:09:22.263Z","updated_at":"2025-04-16T03:45:45.863Z","avatar_url":"https://github.com/swissspidy.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# wp-performance-action\n\nA GitHub action to measure performance metrics of WordPress sites.\n\nResults are posted as comments to pull requests and as [GitHub Action job summaries](https://github.blog/2022-05-09-supercharging-github-actions-with-job-summaries/).\n\nIt collects data from the `Server-Timing` header and runs Lighthouse on a given set of URLs.\n\n**Note:** Tests are run using [WordPress Playground](https://wordpress.org/playground/), which means you can use [blueprints](https://wordpress.github.io/wordpress-playground/blueprints) to prepare the test environment suitable to your needs.\n\n## Example\n\n\u003cimg width=\"1154\" alt=\"Screenshot of a GitHub Action job summary output by this action\" src=\"https://github.com/swissspidy/wp-performance-action/assets/841956/bb543ba2-a142-49d5-bb45-77d11f121824\"\u003e\n\n## Usage\n\nSee [action.yml](action.yml)\n\n\u003c!-- start usage --\u003e\n```yaml\n- uses: swissspidy/wp-performance-action@v2\n  with:\n    # Personal access token (PAT) used to comment on pull requests.\n    #\n    # [Learn more about creating and using encrypted secrets](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets)\n    #\n    # Default: ${{ github.token }}\n    github-token: ''\n\n    # Whether to create PR comments with performance results.\n    #\n    # Might require a custom `github-token` to be set.\n    #\n    # Default: false\n    create-comment: ''\n\n    # Whether to add results to the workflow summary.\n    #\n    # Default: true\n    print-results: ''\n\n    # Whether to upload any artifacts.\n    #\n    # Default: true\n    upload-artifacts: ''\n\n    # Whether to log additional debugging information\n    #\n    # Default: ${{ runner.debug == '1' }}\n    debug: ''\n\n    # List of URLs on the WordPress site to test.\n    #\n    # Each URL should be separated with new lines.\n    #\n    # Default: ''\n    urls: ''\n\n    # List of plugin directories to mount.\n    #\n    # Each plugin should be separated with new lines.\n    # Needs to be a path to a local directory.\n    # For installing plugins from the plugin directory\n    # or a ZIP file, use a blueprint.\n    #\n    # Default: ''\n    plugins: ''\n\n    # List of theme directories to mount.\n    #\n    # Each theme should be separated with new lines.\n    # Needs to be a path to a local directory.\n    # For installing themes from the theme directory\n    # or a ZIP file, use a blueprint.\n    #\n    # Default: ''\n    themes: ''\n\n    # Blueprint to use for setting up the environment.\n    #\n    # Use this to install or activate additional plugins, defining constants,\n    # and much more.\n    #\n    # See https://wordpress.github.io/wordpress-playground/blueprints for more information.\n    #\n    # Default: ''\n    blueprint: ''\n\n    # WordPress version to use.\n    #\n    # Loads the specified WordPress version.\n    # Accepts the last four major WordPress versions.\n    # You can also use the generic values 'latest', 'nightly', or 'beta'.\n    #\n    # Default: 'latest'\n    wp-version: ''\n\n    # PHP version to use.\n    #\n    # Accepts 7.0, 7.1, 7.2, 7.3, 7.4, 8.0, 8.1, 8.2, 8.3.\n    #\n    # Default: 'latest'\n    php-version: ''\n \n    # Number of times the tests should be repeated.\n    #\n    # Default: 2\n    repetitions: ''\n\n    # Number of iterations (loops) within a single run.\n    #\n    # Default: 20\n    iterations: ''\n\n    # Shard to use if running tests in parallel.\n    # Valid values are 1/2, 1/4, etc.\n    #\n    # Default: ''\n    shard: ''\n\n    # Action to perform, can be either \"test\" or \"merge\".\n    # Merging is needed when running tests in parallel\n    # in a test matrix, where you later need to merge\n    # the results from the individual jobs together.\n    #\n    # Default: 'test'\n    action: ''\n\n    # Path to a file with previous performance results for comparison.\n    # Useful when running tests for a pull request and\n    # the target branch, so that the performance impact can be measured.\n    #\n    # Default: ''\n    previous-results: ''\n```\n\u003c!-- end usage --\u003e\n\n### Basic\n\nAdd a workflow (`.github/workflows/build-test.yml`):\n\n```yaml\nsteps:\n  - name: Checkout\n    uses: actions/checkout@v4\n  \n  - name: Run performance tests\n    uses: swissspidy/wp-performance-action@v2\n    with:\n      plugins: |\n        ./my-awesome-plugin\n      urls: |\n        /\n        /sample-page/\n```\n\n### Advanced\n\nAdd a workflow (`.github/workflows/build-test.yml`):\n\n```yaml\nsteps:\n  - name: Checkout\n    uses: actions/checkout@v4\n  \n  - name: Run performance tests\n    uses: swissspidy/wp-performance-action@v2\n    with:\n      urls: |\n        /\n        /sample-page/\n      plugins: |\n        ./my-awesome-plugin\n      blueprint: ./my-custom-blueprint.json\n      iterations: 5\n      repetitions: 1\n```\n\nAdd a blueprint (`my-custom-blueprint.json`):\n\n```json\n{\n  \"$schema\": \"https://playground.wordpress.net/blueprint-schema.json\",\n  \"plugins\": [\n    \"performant-translations\",\n    \"akismet\"\n  ],\n  \"steps\": [\n    {\n      \"step\": \"defineWpConfigConsts\",\n      \"consts\": {\n        \"WP_DEBUG\": true\n      }\n    },\n    {\n      \"step\": \"activatePlugin\",\n      \"pluginName\": \"My Awesome Plugin\",\n      \"pluginPath\": \"/wordpress/wp-content/plugins/my-awesome-plugin\"\n    }\n  ]\n}\n\n```\n\n### Running tests in parallel (sharding)\n\n```yaml\njobs:\n  matrix:\n    timeout-minutes: 60\n    runs-on: ubuntu-latest\n    strategy:\n      fail-fast: false\n      matrix:\n        shard: [1/4, 2/4, 3/4, 4/4]\n    steps:\n    - uses: actions/checkout@v4\n\n    - name: Run performance tests\n      uses: swissspidy/wp-performance-action@v2\n      id: run-tests\n      with:\n        urls: |\n          /\n          /sample-page/\n        plugins: |\n          ./my-awesome-plugin\n        shard: ${{ matrix.shard }}\n\n  merge-reports:\n    if: always()\n    needs: [matrix]\n    runs-on: ubuntu-latest\n    steps:\n    - uses: actions/checkout@v4\n\n    - name: Merge performance test results\n      uses: swissspidy/wp-performance-action@v2\n      with:\n        action: 'merge'\n```\n\n### Performance results output\n\nThe `results` step output contains information regarding where the raw performance results numbers are stored.\nThis output can be used for a variety of purposes such as logging or for a comparison with previous results.\n\nIn addition to that, the raw results are also uploaded as a [workflow artifact](https://docs.github.com/en/actions/using-workflows/storing-workflow-data-as-artifacts).\n\n```yaml\nsteps:\n  - name: Checkout\n    uses: actions/checkout@v4\n  \n  - name: Run performance tests\n    uses: swissspidy/wp-performance-action@v2\n    id: performance-tests\n    with:\n      plugins: |\n        ./my-awesome-plugin\n      urls: |\n        /\n        /sample-page/\n\n  - name: 'Echo results path'\n    run: echo ${{steps.performance-tests.outputs.results}}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswissspidy%2Fwp-performance-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fswissspidy%2Fwp-performance-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswissspidy%2Fwp-performance-action/lists"}