{"id":28056288,"url":"https://github.com/staabm/phpunit-github-action-matrix","last_synced_at":"2025-06-25T22:06:28.559Z","repository":{"id":290019299,"uuid":"973107994","full_name":"staabm/phpunit-github-action-matrix","owner":"staabm","description":"GitHub Action to parallelize a PHPUnit test suite over multiple GitHub Action jobs.","archived":false,"fork":false,"pushed_at":"2025-06-06T10:30:53.000Z","size":25,"stargazers_count":30,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-06-21T22:51:48.211Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/staabm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null},"funding":{"github":["staabm"]}},"created_at":"2025-04-26T09:19:53.000Z","updated_at":"2025-06-11T16:20:27.000Z","dependencies_parsed_at":"2025-04-26T11:40:15.422Z","dependency_job_id":null,"html_url":"https://github.com/staabm/phpunit-github-action-matrix","commit_stats":null,"previous_names":["staabm/phpunit-github-action-matrix"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/staabm/phpunit-github-action-matrix","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/staabm%2Fphpunit-github-action-matrix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/staabm%2Fphpunit-github-action-matrix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/staabm%2Fphpunit-github-action-matrix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/staabm%2Fphpunit-github-action-matrix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/staabm","download_url":"https://codeload.github.com/staabm/phpunit-github-action-matrix/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/staabm%2Fphpunit-github-action-matrix/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261960540,"owners_count":23236574,"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":"2025-05-12T06:03:10.229Z","updated_at":"2025-06-25T22:06:28.551Z","avatar_url":"https://github.com/staabm.png","language":"PHP","funding_links":["https://github.com/sponsors/staabm"],"categories":["PHP"],"sub_categories":[],"readme":"GitHub Action to parallelize a PHPUnit test suite over multiple GitHub Action jobs.\n\n## Motivation\n\nUnit test suites grow over time and at a certain point take a considerable amount of time to execute.\nAt this point there are several ways to scale your continous integration system with the goal to shorten the feedback loop again.\n\nIn comparison to existing PHPUnit parallelization plugins, this action distributes the load over several jobs and therefore utilizes more CPUs.\nOther PHPUnit parallelization plugins are used to run tests in parallel, to saturate all available CPUs on a single host.\n\nRunning tests in parallel GitHub Action jobs has the advantage, that there is still only a single test running at a time in each job,\nwhich means this approach does not necessarily need a test-suite which was designed with parallel execution in mind.\n\nAfter segmenting a test-suite across multiple GitHub Action jobs, you may still/additionally use in-job parallelization with well known PHPUnit plugins.\n\n## Input Parameters\n\n### `strategy`\n\nStrategy on how to segment the test suite. Supported values are `groups` and `suites`.\n\n### `phpunit-path`\n\nPath to PHPUnit executable. Default is `vendor/bin/phpunit`.\nYou may append additional parameters to the command, e.g. `vendor/bin/phpunit --condfiguration=path/to/phpunit.xml`.\n\n## Example GitHub Actions workflow\n\nThe workflow shows a typical usage example within a GitHub Actions workflow which segments by test-suite.\nYou may adjust this workflow as you see fit to e.g.\n\n- use a different Test Runner (e.g. ParaTest)\n- segment per groups instead of suites\n- in case you don't need dynamic building of the test-matrix you can hard-code your segments in `run-test-segment` and drop the `tests-segmentation` job.\n\n```yaml\n# https://help.github.com/en/categories/automating-your-workflow-with-github-actions\n\nname: \"Tests\"\n\non:\n  pull_request:\n\njobs:\n  tests-segmentation:\n    name: \"Segment PHPUnit Test Suite\"\n    runs-on: ubuntu-latest\n    timeout-minutes: 10\n\n    steps:\n      - name: \"Checkout\"\n        uses: actions/checkout@v4\n\n      - name: \"Install PHP\"\n        uses: \"shivammathur/setup-php@v2\"\n        with:\n          coverage: \"none\"\n          php-version: \"8.3\"\n          \n      - name: \"Install dependencies\"\n        run: \"composer install --no-interaction --no-progress\"\n\n      - name: \"Segment PHPUnit test-suite\"\n        id: segmentation\n        uses: staabm/phpunit-github-action-matrix@main\n        with:\n          phpunit-path: \"vendor/bin/phpunit\"\n          strategy: \"suites\"\n          \n    outputs:\n      phpunit-test-segments-json: ${{ steps.segmentation.outputs.segments-json }}\n\n  run-test-segment:\n    needs: tests-segmentation\n\n    name: \"Run PHPUnit segment ${{ matrix.suite-name }}\"\n    runs-on: ubuntu-latest\n    timeout-minutes: 60\n\n    strategy:\n      fail-fast: false\n      matrix:\n        suite-name: \"${{fromJson(needs.tests-segmentation.outputs.phpunit-test-segments-json)}}\"\n\n    steps:\n      - name: \"Checkout\"\n        uses: actions/checkout@v4\n\n      - name: \"Install PHP\"\n        uses: \"shivammathur/setup-php@v2\"\n        with:\n          coverage: \"none\"\n          php-version: \"8.3\"\n\n      - name: \"Install dependencies\"\n        run: \"composer install --no-interaction --no-progress\"\n\n      - name: \"Tests\"\n        run: \"vendor/bin/phpunit --testsuite ${{ matrix.suite-name }}\"\n\n```\n\n## Alternatives\n\nAfter implementation was finished and we made same noise in social media regarding this repo, the following alternatives were mentioned which achieve similar things\n- https://github.com/DaveLiddament/test-splitter - Splits PHPUnit tests into batches\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstaabm%2Fphpunit-github-action-matrix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstaabm%2Fphpunit-github-action-matrix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstaabm%2Fphpunit-github-action-matrix/lists"}