From 199d2f7e3ca6830725add9428ea2a9d3bfa00c7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Geffroy?= Date: Mon, 25 Aug 2025 22:30:05 +0200 Subject: [PATCH 1/2] fix: install --- .github/workflows/Install.yaml | 31 ++++++++++++++++++++++ bin/{install-server => playwright-install} | 19 +++++++++++-- composer.json | 11 +++++--- 3 files changed, 55 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/Install.yaml rename bin/{install-server => playwright-install} (95%) diff --git a/.github/workflows/Install.yaml b/.github/workflows/Install.yaml new file mode 100644 index 0000000..b4627f2 --- /dev/null +++ b/.github/workflows/Install.yaml @@ -0,0 +1,31 @@ +name: "Install" + +on: + schedule: + - cron: '7 7 * * *' # At 07:07 every day + workflow_dispatch: + +permissions: + contents: read + +jobs: + scratch: + name: "Install" + runs-on: ubuntu-latest + steps: + + - name: "PHP: setup 8.4" + uses: shivammathur/setup-php@v2 + with: + php-version: 8.4 + coverage: none + tools: composer + + - name: "Composer: require" + run: composer require --dev playwright-php/playwright + + - name: "Composer: show" + run: composer show -i "playwright-php/playwright" + + - name: "TwigMetrics: version" + run: vendor/bin/playwright-install --help diff --git a/bin/install-server b/bin/playwright-install similarity index 95% rename from bin/install-server rename to bin/playwright-install index 6696839..6d15eb8 100755 --- a/bin/install-server +++ b/bin/playwright-install @@ -6,7 +6,22 @@ * Installs Node.js dependencies for the Playwright server using Symfony Process */ -require_once __DIR__.'/../vendor/autoload.php'; +$possibleFiles = [__DIR__.'/../../../autoload.php', __DIR__.'/../../autoload.php', __DIR__.'/../vendor/autoload.php']; +$file = null; + +foreach ($possibleFiles as $possibleFile) { + if (file_exists($possibleFile)) { + $file = $possibleFile; + + break; + } +} + +if (null === $file) { + throw new RuntimeException('Unable to locate autoload.php file.'); +} + +require_once $file; use Symfony\Component\Console\Output\ConsoleOutput; use Symfony\Component\Console\Output\OutputInterface; @@ -260,7 +275,7 @@ $help = \in_array('-h', $_SERVER['argv'] ?? [], true) if ($help) { echo "Playwright Server Installer\n"; echo "\n"; - echo "Usage: bin/install-server [options]\n"; + echo "Usage: bin/playwright-install [options]\n"; echo "\n"; echo "Options:\n"; echo " -v, --verbose Show detailed output\n"; diff --git a/composer.json b/composer.json index 5147537..6300ec8 100644 --- a/composer.json +++ b/composer.json @@ -70,9 +70,9 @@ } }, "scripts": { - "post-install-cmd": "bin/install-server", - "install-browsers": "bin/install-server -v && npm run install-browsers --prefix bin", - "install-browsers-with-deps": "bin/install-server -v && npm run install-browsers-with-deps --prefix bin", + "post-install-cmd": "bin/playwright-install", + "install-browsers": "bin/playwright-install -v && npm run install-browsers --prefix bin", + "install-browsers-with-deps": "bin/playwright-install -v && npm run install-browsers-with-deps --prefix bin", "cs-check": "vendor/bin/php-cs-fixer fix --dry-run --diff", "cs-fix": "vendor/bin/php-cs-fixer fix", "sa": "vendor/bin/phpstan analyze --memory-limit=-1", @@ -80,5 +80,8 @@ "test-coverage": "vendor/bin/phpunit --coverage-xml coverage", "test:integration": "vendor/bin/phpunit --testsuite integration", "test:unit": "vendor/bin/phpunit --testsuite unit" - } + }, + "bin": [ + "bin/playwright-install" + ] } From 103770b133b95290fdce759cb2608b49d94dfea7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Geffroy?= <81738559+raphael-geffroy@users.noreply.github.com> Date: Fri, 29 Aug 2025 00:03:33 +0200 Subject: [PATCH 2/2] fix: Install workflow name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Simon André --- .github/workflows/Install.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Install.yaml b/.github/workflows/Install.yaml index b4627f2..23d1a36 100644 --- a/.github/workflows/Install.yaml +++ b/.github/workflows/Install.yaml @@ -27,5 +27,5 @@ jobs: - name: "Composer: show" run: composer show -i "playwright-php/playwright" - - name: "TwigMetrics: version" + - name: "Playwright Install" run: vendor/bin/playwright-install --help