diff --git a/.github/workflows/Install.yaml b/.github/workflows/Install.yaml new file mode 100644 index 0000000..23d1a36 --- /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: "Playwright Install" + 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" + ] }