diff --git a/.circleci/config.yml b/.circleci/config.yml index 57944bd..9f88ed0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -97,11 +97,11 @@ jobs: - run: name: Global - Run against a file command: | - drupal-check /tmp/drupal/core/install.php + drupal-check -vvv /tmp/drupal/core/install.php - run: name: Global - Run against a module command: | - drupal-check /tmp/drupal/core/modules/dynamic_page_cache + drupal-check -vvv /tmp/drupal/core/modules/dynamic_page_cache test_drupal_project: <<: *defaults steps: @@ -111,11 +111,11 @@ jobs: - run: name: Global - Run against a file command: | - drupal-check /tmp/drupal/web/core/install.php + drupal-check -vvv /tmp/drupal/web/core/install.php - run: name: Global - Run against a module command: | - drupal-check /tmp/drupal/web/core/modules/dynamic_page_cache + drupal-check -vvv /tmp/drupal/web/core/modules/dynamic_page_cache test_drupal_local_require: <<: *defaults steps: @@ -152,7 +152,7 @@ jobs: - run: name: Phar - Run against a module command: | - drupal-check /tmp/drupal/web/modules/contrib/ctools || if (($? == 255)); then false; else true; fi + drupal-check -vvv /tmp/drupal/web/modules/contrib/ctools || if (($? == 255)); then false; else true; fi test_global_require_with_drush: <<: *defaults steps: @@ -166,11 +166,11 @@ jobs: - run: name: Run against a file command: | - drupal-check /tmp/drupal/web/core/install.php + drupal-check -vvv /tmp/drupal/web/core/install.php - run: name: Run against a module command: | - drupal-check /tmp/drupal/web/core/modules/dynamic_page_cache + drupal-check -vvv /tmp/drupal/web/core/modules/dynamic_page_cache test_contained_not_initialized: <<: *defaults steps: @@ -184,7 +184,7 @@ jobs: - run: name: Phar - Run against a file command: | - drupal-check /tmp/drupal/web/modules/contained_not_initialized -vvv + drupal-check -vvv /tmp/drupal/web/modules/contained_not_initialized -vvv workflows: version: 2 test_and_deploy: diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index ccf51a1..3665e17 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -7,6 +7,33 @@ on: branches: [main] jobs: + lint: + runs-on: "ubuntu-latest" + strategy: + matrix: + experimental: [false] + php-version: + - "7.4" + - "8.0" + - "8.1" + steps: + - name: "Checkout" + uses: "actions/checkout@v2" + - name: "Install PHP" + uses: "shivammathur/setup-php@v2" + with: + coverage: "none" + php-version: "${{ matrix.php-version }}" + tools: composer:v2 + extensions: dom, curl, libxml, mbstring, zip, pdo, mysql, pdo_mysql, bcmath, gd, exif, iconv + - name: Validate composer.json and composer.lock + run: composer validate --strict + - name: "Install dependencies" + run: "composer install --no-progress --prefer-dist" + - name: "PHPCS" + run: "php vendor/bin/phpcs src" +# - name: "PHPStan" +# run: "php vendor/bin/phpstan analyze src" tests: continue-on-error: ${{ matrix.experimental }} runs-on: "ubuntu-latest" @@ -15,18 +42,17 @@ jobs: matrix: experimental: [false] php-version: - - "7.3" - "7.4" drupal: - "^8.9" - "^9.0" include: - - php-version: "7.2" - drupal: "~8.9" - experimental: false - php-version: "8.0" drupal: "^9.0" - experimental: true + experimental: false + - php-version: "8.0" + drupal: "10.0.x-dev" + experimental: false steps: - name: "Checkout" uses: "actions/checkout@v2" @@ -37,18 +63,13 @@ jobs: php-version: "${{ matrix.php-version }}" tools: composer:v2 extensions: dom, curl, libxml, mbstring, zip, pdo, mysql, pdo_mysql, bcmath, gd, exif, iconv - - name: Validate composer.json and composer.lock - run: composer validate --strict - - name: "Install dependencies" - run: "composer install --no-progress --prefer-dist" - - name: "PHPCS" - run: "php vendor/bin/phpcs src" -# - name: "PHPStan" -# run: "php vendor/bin/phpstan analyze src" - - name: Remove vendor directory for integration testing - run: rm -rf vendor + - name: Debug it assuming to be global + run: | + cd src/Command + ls $(php -r "print __DIR__ . '/../../../..';") + php -r "var_export(file_exists(__DIR__ . '/../../../../autoload.php'));" - name: Setup Drupal - uses: bluehorndigital/setup-drupal@v1.0.1 + uses: bluehorndigital/setup-drupal@v1.0.3 with: version: ${{ matrix.drupal }} path: ~/drupal @@ -56,6 +77,11 @@ jobs: run: | cd ~/drupal COMPOSER_MEMORY_LIMIT=-1 composer require mglaman/drupal-check *@dev + - name: Debug it assuming to be global + run: | + cd ~/drupal/vendor/mglaman/drupal-check/src/Command + ls $(php -r "print __DIR__ . '/../../../..';") + php -r "var_export(file_exists(__DIR__ . '/../../../../autoload.php'));" - name: "Analyze core/install.php" run: | cd ~/drupal @@ -92,7 +118,7 @@ jobs: tools: composer:v2 extensions: dom, curl, libxml, mbstring, zip, pdo, mysql, pdo_mysql, bcmath, gd, exif, iconv - name: Setup Drupal - uses: bluehorndigital/setup-drupal@v1.0.1 + uses: bluehorndigital/setup-drupal@v1.0.3 with: version: ${{ matrix.drupal }} path: ~/drupal diff --git a/src/Command/CheckCommand.php b/src/Command/CheckCommand.php index f52ea68..791759a 100644 --- a/src/Command/CheckCommand.php +++ b/src/Command/CheckCommand.php @@ -202,11 +202,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int $output->writeln('Assumed running as global dependency', OutputInterface::VERBOSITY_DEBUG); $phpstanBin = \realpath(__DIR__ . '/../../../../phpstan/phpstan/phpstan.phar'); $configuration_data['parameters']['bootstrapFiles'] = [\realpath(__DIR__ . '/../../error-bootstrap.php')]; - // The phpstan/extension-installer doesn't seem to register. - $configuration_data['includes'] = [ - \realpath(__DIR__ . '/../../../../phpstan/phpstan-deprecation-rules/rules.neon'), - \realpath(__DIR__ . '/../../../../mglaman/phpstan-drupal/extension.neon'), - ]; + if (!class_exists('PHPStan\ExtensionInstaller\GeneratedConfig')) { + $configuration_data['includes'] = [ + \realpath(__DIR__ . '/../../../../phpstan/phpstan-deprecation-rules/rules.neon'), + \realpath(__DIR__ . '/../../../../mglaman/phpstan-drupal/extension.neon'), + ]; + } } else { throw new ShouldNotHappenException('Could not determine if local or global installation'); }