Skip to content

Commit

Permalink
Add testing for D10
Browse files Browse the repository at this point in the history
  • Loading branch information
mglaman committed Feb 2, 2022
1 parent ca1cd63 commit 0bedfbc
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 30 deletions.
16 changes: 8 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand Down
60 changes: 43 additions & 17 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -37,25 +63,25 @@ 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/[email protected].1
uses: bluehorndigital/[email protected].3
with:
version: ${{ matrix.drupal }}
path: ~/drupal
- name: "require drupal-check"
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
Expand Down Expand Up @@ -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/[email protected].1
uses: bluehorndigital/[email protected].3
with:
version: ${{ matrix.drupal }}
path: ~/drupal
Expand Down
11 changes: 6 additions & 5 deletions src/Command/CheckCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$output->writeln('<comment>Assumed running as global dependency</comment>', 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');
}
Expand Down

0 comments on commit 0bedfbc

Please sign in to comment.