From 0242c6e940f9564d40c79e71617b3aa5eef2d573 Mon Sep 17 00:00:00 2001 From: Mohamed El Mrabet Date: Sun, 30 Aug 2026 08:42:26 +0100 Subject: [PATCH 1/6] Improve open-source readiness: docs, CI, contribution guides - Fix misleading "zero core overrides" claim in README (it is a DI preference override) - Document Magento Marketplace auth.json requirement for composer install - Add CHANGELOG.md, CONTRIBUTING.md, SECURITY.md - Add phpunit.xml.dist and composer test script - Add GitHub Actions CI workflow (composer validate + unit tests) --- .github/workflows/ci.yml | 36 +++++++++++++++++++++++++++++++ CHANGELOG.md | 19 +++++++++++++++++ CONTRIBUTING.md | 46 ++++++++++++++++++++++++++++++++++++++++ README.md | 13 ++++++++---- SECURITY.md | 18 ++++++++++++++++ composer.json | 6 ++++++ phpunit.xml.dist | 11 ++++++++++ 7 files changed, 145 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 CHANGELOG.md create mode 100644 CONTRIBUTING.md create mode 100644 SECURITY.md create mode 100644 phpunit.xml.dist diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..5ebc0a2 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,36 @@ +name: CI + +on: + push: + branches: [master] + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + php: ["8.2", "8.3", "8.4"] + steps: + - uses: actions/checkout@v4 + + - uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: none + + - name: Validate composer.json + run: composer validate --strict --no-check-all + + - name: Configure Magento Marketplace auth + if: ${{ env.MAGENTO_USERNAME != '' }} + env: + MAGENTO_USERNAME: ${{ secrets.MAGENTO_USERNAME }} + MAGENTO_PASSWORD: ${{ secrets.MAGENTO_PASSWORD }} + run: composer config http-basic.repo.magento.com "$MAGENTO_USERNAME" "$MAGENTO_PASSWORD" + + - name: Install dependencies + run: composer install --prefer-dist --no-progress + + - name: Run unit tests + run: composer test diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..2a89b74 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,19 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/). + +## [1.0.0] - 2025-11-22 + +### Added + +- Initial release. +- DI override of `Magento\Developer\Console\Command\DevTestsRunCommand` to run + developer tests through ParaTest. +- `--processes` option to set the number of ParaTest worker processes. +- `--runner` option to select the ParaTest runner (default: `WrapperRunner`). +- Support for static, unit, integration and integrity test suites. + +[1.0.0]: https://github.com/CleatSquad/module-parallel-tests-plus/releases/tag/v1.0.0 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..29446c3 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,46 @@ +# Contributing + +Thanks for considering a contribution to `module-parallel-tests-plus`. + +## Getting started + +```bash +git clone https://github.com/CleatSquad/module-parallel-tests-plus.git +cd module-parallel-tests-plus +composer install +``` + +> Resolving `magento/module-developer` requires a valid Magento Marketplace +> `auth.json` (see the README's Installation section). + +## Running the tests + +```bash +composer test +``` + +or directly: + +```bash +vendor/bin/phpunit --testsuite unit +``` + +## Submitting changes + +1. Fork the repository and create a branch from `master`. +2. Keep changes focused — one topic per pull request. +3. Add or update unit tests for any behavior change in + `Console/DevTestsRunCommand.php`. +4. Make sure `composer test` passes before opening the PR. +5. Describe the *why* of the change in the PR description, not just the *what*. + +## Reporting bugs + +Open an issue at +https://github.com/CleatSquad/module-parallel-tests-plus/issues with the +Magento version, PHP version, the command you ran, and the full output. + +## Security issues + +Do not open a public issue for a security vulnerability — see +[SECURITY.md](SECURITY.md). diff --git a/README.md b/README.md index 8c6999f..b07b9d0 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,11 @@ A Magento 2 extension that enhances the core `dev:tests:run` command by enabling **parallel execution** of developer tests using **ParaTest**. -This module significantly reduces execution time for static, unit, integration and integrity tests — with zero core overrides and full CI/CD compatibility. +This module significantly reduces execution time for static, unit, integration and integrity tests — via a clean declarative DI override (no core file patching) and full CI/CD compatibility. ## Badges +[![CI](https://github.com/CleatSquad/module-parallel-tests-plus/actions/workflows/ci.yml/badge.svg)](https://github.com/CleatSquad/module-parallel-tests-plus/actions/workflows/ci.yml) [![Latest Stable Version](http://poser.pugx.org/cleatsquad/module-parallel-tests-plus/v)](https://packagist.org/packages/cleatsquad/module-parallel-tests-plus) [![Total Downloads](http://poser.pugx.org/cleatsquad/module-parallel-tests-plus/downloads)](https://packagist.org/packages/cleatsquad/module-parallel-tests-plus) [![Latest Unstable Version](http://poser.pugx.org/cleatsquad/module-parallel-tests-plus/v/unstable)](https://packagist.org/packages/cleatsquad/module-parallel-tests-plus) @@ -40,12 +41,14 @@ You can install this module using Composer (recommended) or manually. ### 🔹 1. Install via Composer (recommended) -Requires Packagist entry: - ``` composer require cleatsquad/module-parallel-tests-plus --dev ``` +> **Note:** this package depends on `magento/module-developer`, resolved via +> `repo.magento.com`. Make sure your project has a valid Magento Marketplace +> `auth.json` configured, otherwise Composer will fail to resolve it. + Then upgrade Magento: ``` @@ -111,7 +114,9 @@ bin/magento dev:tests:run integration --processes 2 -c" testsuite/Magento/Catalo ## 🤝 Support & Contributions -Issues and pull requests are welcome. +Issues and pull requests are welcome — see [CONTRIBUTING.md](CONTRIBUTING.md). +For security issues, see [SECURITY.md](SECURITY.md) instead of opening a +public issue. GitHub: https://github.com/CleatSquad/module-parallel-tests-plus diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..8fa5e0b --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,18 @@ +# Security Policy + +## Supported Versions + +Only the latest published `1.x` release is supported with security fixes. + +## Reporting a Vulnerability + +This module builds and runs a shell command (via `passthru()`) to invoke +ParaTest. If you find a way to make it execute unintended shell content, or +any other security issue, please report it privately rather than opening a +public GitHub issue: + +- Email: contact@cleatsquad.dev + +Please include a description of the issue, the steps to reproduce it, and +the Magento/PHP versions involved. We aim to acknowledge reports within a +few business days. diff --git a/composer.json b/composer.json index 233c517..ec8b6dc 100644 --- a/composer.json +++ b/composer.json @@ -47,11 +47,17 @@ "brianium/paratest": "^7.4", "magento/module-developer": "^100.4" }, + "require-dev": { + "phpunit/phpunit": "^10.5 || ^11.0" + }, "minimum-stability": "stable", "prefer-stable": true, "config": { "allow-plugins": { "magento/composer-dependency-version-audit-plugin": true } + }, + "scripts": { + "test": "phpunit --testsuite unit" } } diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 0000000..bbd16b8 --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,11 @@ + + + + + Test/Unit + + + From 44133bccf1901058cc2e689347685e9220116c70 Mon Sep 17 00:00:00 2001 From: Mohamed El Mrabet Date: Sun, 30 Aug 2026 08:44:01 +0100 Subject: [PATCH 2/6] Use CleatSquad's shared magento-php-qa-action for CI Align with the pattern used in magento2-logstream: run PHPStan, PHP-CS-Fixer and PHPUnit through mohaelmrabet/magento-php-qa-action on the mohelmrabet/magento-frankenphp image, instead of a bespoke composer install/validate workflow. --- .github/workflows/ci.yml | 71 +++++++++++++++++++++++++++------------- 1 file changed, 49 insertions(+), 22 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5ebc0a2..9d22f59 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,36 +1,63 @@ -name: CI +--- +name: Code style and static analysis on: + pull_request: push: branches: [master] - pull_request: + +permissions: + contents: read jobs: - test: + phpstan: + name: PHPStan runs-on: ubuntu-latest - strategy: - matrix: - php: ["8.2", "8.3", "8.4"] + + container: + image: mohelmrabet/magento-frankenphp:php8.2-fp1.10.1-dev + steps: - - uses: actions/checkout@v4 + - name: Checkout + uses: actions/checkout@v4 - - uses: shivammathur/setup-php@v2 + - name: Run PHPStan + uses: mohaelmrabet/magento-php-qa-action@v1 with: - php-version: ${{ matrix.php }} - coverage: none + command: phpstan + composer-auth: ${{ secrets.COMPOSER_AUTH }} - - name: Validate composer.json - run: composer validate --strict --no-check-all + php-cs-fixer: + name: PHP-CS-Fixer + runs-on: ubuntu-latest - - name: Configure Magento Marketplace auth - if: ${{ env.MAGENTO_USERNAME != '' }} - env: - MAGENTO_USERNAME: ${{ secrets.MAGENTO_USERNAME }} - MAGENTO_PASSWORD: ${{ secrets.MAGENTO_PASSWORD }} - run: composer config http-basic.repo.magento.com "$MAGENTO_USERNAME" "$MAGENTO_PASSWORD" + container: + image: mohelmrabet/magento-frankenphp:php8.2-fp1.10.1-dev - - name: Install dependencies - run: composer install --prefer-dist --no-progress + steps: + - name: Checkout + uses: actions/checkout@v4 - - name: Run unit tests - run: composer test + - name: Run PHP-CS-Fixer + uses: mohaelmrabet/magento-php-qa-action@v1 + with: + command: cs-fixer + composer-auth: ${{ secrets.COMPOSER_AUTH }} + + unit-tests: + name: PHPUnit + runs-on: ubuntu-latest + + container: + image: mohelmrabet/magento-frankenphp:php8.2-fp1.10.1-dev + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Run PHPUnit + uses: mohaelmrabet/magento-php-qa-action@v1 + with: + command: phpunit + composer-auth: ${{ secrets.COMPOSER_AUTH }} + phpunit-path: ./Test/Unit From ca56c2a1d58e294e644537f5ca2dbaee52035279 Mon Sep 17 00:00:00 2001 From: Mohamed El Mrabet Date: Sun, 30 Aug 2026 08:46:47 +0100 Subject: [PATCH 3/6] Add PHPStan and PHP-CS-Fixer config, matching magento2-logstream The CI workflow's phpstan and cs-fixer jobs need vendor/bin/phpstan and vendor/bin/php-cs-fixer available, plus config files to run against. --- .php-cs-fixer.dist.php | 13 +++++++++++++ composer.json | 8 ++++++-- phpstan.neon.dist | 4 ++++ 3 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 .php-cs-fixer.dist.php create mode 100644 phpstan.neon.dist diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php new file mode 100644 index 0000000..7540d31 --- /dev/null +++ b/.php-cs-fixer.dist.php @@ -0,0 +1,13 @@ +in(__DIR__ . '/Console') + ->in(__DIR__ . '/Test'); + +return (new PhpCsFixer\Config()) + ->setRules([ + '@PSR12' => true, + ]) + ->setFinder($finder); diff --git a/composer.json b/composer.json index ec8b6dc..0bad560 100644 --- a/composer.json +++ b/composer.json @@ -48,7 +48,9 @@ "magento/module-developer": "^100.4" }, "require-dev": { - "phpunit/phpunit": "^10.5 || ^11.0" + "phpunit/phpunit": "^10.5 || ^11.0", + "phpstan/phpstan": "^1.0", + "friendsofphp/php-cs-fixer": "^3.0" }, "minimum-stability": "stable", "prefer-stable": true, @@ -58,6 +60,8 @@ } }, "scripts": { - "test": "phpunit --testsuite unit" + "test": "phpunit --testsuite unit", + "phpstan": "phpstan analyse", + "cs-fixer": "php-cs-fixer fix --dry-run --diff" } } diff --git a/phpstan.neon.dist b/phpstan.neon.dist new file mode 100644 index 0000000..a49d0fb --- /dev/null +++ b/phpstan.neon.dist @@ -0,0 +1,4 @@ +parameters: + level: 5 + paths: + - Console From 1551fa70a78479daf9efaadc49b327165869b86c Mon Sep 17 00:00:00 2001 From: Mohamed El Mrabet Date: Sun, 30 Aug 2026 08:49:33 +0100 Subject: [PATCH 4/6] Fix CI: build composer-auth from org-wide Magento secrets The repo doesn't have a repo-level COMPOSER_AUTH secret like magento2-logstream does. It does have the org-wide MAGENTO_AUTH_USERNAME/MAGENTO_AUTH_PASSWORD secrets (available to all repos), so build the composer-auth JSON from those instead. --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9d22f59..2f629c7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,7 +25,7 @@ jobs: uses: mohaelmrabet/magento-php-qa-action@v1 with: command: phpstan - composer-auth: ${{ secrets.COMPOSER_AUTH }} + composer-auth: ${{ format('{{"http-basic":{{"repo.magento.com":{{"username":"{0}","password":"{1}"}}}}}}', secrets.MAGENTO_AUTH_USERNAME, secrets.MAGENTO_AUTH_PASSWORD) }} php-cs-fixer: name: PHP-CS-Fixer @@ -42,7 +42,7 @@ jobs: uses: mohaelmrabet/magento-php-qa-action@v1 with: command: cs-fixer - composer-auth: ${{ secrets.COMPOSER_AUTH }} + composer-auth: ${{ format('{{"http-basic":{{"repo.magento.com":{{"username":"{0}","password":"{1}"}}}}}}', secrets.MAGENTO_AUTH_USERNAME, secrets.MAGENTO_AUTH_PASSWORD) }} unit-tests: name: PHPUnit @@ -59,5 +59,5 @@ jobs: uses: mohaelmrabet/magento-php-qa-action@v1 with: command: phpunit - composer-auth: ${{ secrets.COMPOSER_AUTH }} + composer-auth: ${{ format('{{"http-basic":{{"repo.magento.com":{{"username":"{0}","password":"{1}"}}}}}}', secrets.MAGENTO_AUTH_USERNAME, secrets.MAGENTO_AUTH_PASSWORD) }} phpunit-path: ./Test/Unit From 3581b60cae202c389fe9d71586fcccbbb3db439f Mon Sep 17 00:00:00 2001 From: Mohamed El Mrabet Date: Sun, 30 Aug 2026 08:51:44 +0100 Subject: [PATCH 5/6] Fix PHPUnit bootstrap: fake Magento BP for standalone test runs DevTestsRunCommand reads Magento's BP constant and app/etc/vendor_path.php, which only exist inside a real Magento installation. The module's own unit tests never ran standalone before (no CI existed), so this was never exercised. Bootstrap now fakes a minimal Magento directory layout in a temp dir so the tests can run outside a full Magento app. --- Test/Unit/_files/bootstrap.php | 41 ++++++++++++++++++++++++++++++++++ phpunit.xml.dist | 2 +- 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 Test/Unit/_files/bootstrap.php diff --git a/Test/Unit/_files/bootstrap.php b/Test/Unit/_files/bootstrap.php new file mode 100644 index 0000000..e9085af --- /dev/null +++ b/Test/Unit/_files/bootstrap.php @@ -0,0 +1,41 @@ + From 8bfc79148debc4030b8987908d297a3a56ad7081 Mon Sep 17 00:00:00 2001 From: Mohamed El Mrabet Date: Sun, 30 Aug 2026 08:54:51 +0100 Subject: [PATCH 6/6] Fix PHPStan/PHP-CS-Fixer CI failures - Add a PHPStan bootstrap stub declaring BP so it can resolve the constant statically without a real Magento installation - Apply PSR12 blank_line_after_opening_tag across PHP files - Remove a duplicate blank line before require_once in the test file --- .phpstan-bootstrap.php | 18 ++++++++++++++++++ Console/DevTestsRunCommand.php | 1 + Test/Unit/Console/DevTestsRunCommandTest.php | 2 +- Test/Unit/_files/bootstrap.php | 1 + Test/Unit/_files/mock_passthru.php | 1 + phpstan.neon.dist | 2 ++ registration.php | 1 + 7 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 .phpstan-bootstrap.php diff --git a/.phpstan-bootstrap.php b/.phpstan-bootstrap.php new file mode 100644 index 0000000..3957bb0 --- /dev/null +++ b/.phpstan-bootstrap.php @@ -0,0 +1,18 @@ +