Skip to content

Commit

Permalink
Add test for config_update and fix missing dependency (#217)
Browse files Browse the repository at this point in the history
  • Loading branch information
mglaman authored Mar 17, 2021
1 parent b73fc8a commit 5854972
Show file tree
Hide file tree
Showing 4 changed files with 116 additions and 57 deletions.
63 changes: 60 additions & 3 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,16 @@ jobs:
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: Setup Drupal
run: |
COMPOSER_MEMORY_LIMIT=-1 composer create-project drupal/recommended-project:${{ matrix.drupal }} ~/drupal --no-interaction
cd ~/drupal
composer config minimum-stability dev
composer config prefer-stable true
composer config preferred-install dist
composer config repositories.0 path $GITHUB_WORKSPACE
composer config repositories.0 "{\"type\": \"path\", \"url\": \"$GITHUB_WORKSPACE\", \"options\": {\"symlink\": false}}"
composer config repositories.1 composer https://packages.drupal.org/8
COMPOSER_MEMORY_LIMIT=-1 composer require drupal/core-dev:${{ matrix.drupal }} --with-all-dependencies
- name: "Add phpspec/prophecy-phpunit"
Expand All @@ -67,8 +69,63 @@ jobs:
- name: "Analyze core/install.php"
run: |
cd ~/drupal
./vendor/bin/drupal-check web/core/install.php
./vendor/bin/drupal-check -vvv web/core/install.php
- name: "Analyze dynamic_page_cache"
run: |
cd ~/drupal
./vendor/bin/drupal-check web/core/modules/dynamic_page_cache || if (($? == 255)); then false; else true; fi
./vendor/bin/drupal-check -vvv web/core/modules/dynamic_page_cache || if (($? == 255)); then false; else true; fi
contrib:
runs-on: "ubuntu-latest"
name: "${{ matrix.project }} | PHP ${{ matrix.php-version }} | Drupal ${{ matrix.drupal }}"
strategy:
matrix:
include:
- php-version: "7.3"
drupal: "~8.9"
project: config_update
additional_projects: ''
type: module
- php-version: "7.3"
drupal: "~8.9"
project: blazy
additional_projects: 'drupal/token drupal/ctools'
type: module
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: Setup Drupal
run: |
COMPOSER_MEMORY_LIMIT=-1 composer create-project drupal/recommended-project:${{ matrix.drupal }} ~/drupal --no-interaction
cd ~/drupal
composer config minimum-stability dev
composer config prefer-stable true
composer config preferred-install dist
composer config repositories.0 "{\"type\": \"path\", \"url\": \"$GITHUB_WORKSPACE\", \"options\": {\"symlink\": false}}"
composer config repositories.1 composer https://packages.drupal.org/8
COMPOSER_MEMORY_LIMIT=-1 composer require drupal/core-dev:${{ matrix.drupal }} --with-all-dependencies
- name: "Add phpspec/prophecy-phpunit"
run: |
cd ~/drupal
COMPOSER_MEMORY_LIMIT=-1 composer require --dev phpspec/prophecy-phpunit:^2
if: ${{ matrix.drupal == '^9.0' }}
- name: "require drupal-check"
run: |
cd ~/drupal
COMPOSER_MEMORY_LIMIT=-1 composer require mglaman/drupal-check *@dev
- name: "verify drupal-check version"
run: |
cd ~/drupal
./vendor/bin/drupal-check --version
- name: 'Check ${{ matrix.project }}'
run: |
cd ~/drupal
COMPOSER_MEMORY_LIMIT=-1 composer require drupal/${{ matrix.project }} ${{ matrix.additional_projects }}
./vendor/bin/drupal-check -vvv web/${{ matrix.type }}s/contrib/${{ matrix.project }} --no-progress || if (($? == 255 || $? == 127)); then false; else true; fi
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
"jean85/pretty-package-versions": "^1.5.0 || ^2.0.1",
"mglaman/phpstan-drupal": "^0.12.8",
"nette/neon": "^3.1",
"phpstan/phpstan-deprecation-rules": "^0.12.6",
"symfony/console": "~3.2 || ~4.0",
"symfony/process": "~3.2 || ~4.0",
"webflo/drupal-finder": "^1.1"
},
"require-dev": {
"phpstan/phpstan": "^0.12.81",
"phpstan/phpstan-deprecation-rules": "^0.12.6",
"phpstan/phpstan-strict-rules": "^0.12.9",
"squizlabs/php_codesniffer": "^3.4"
},
Expand Down
104 changes: 52 additions & 52 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion src/Command/CheckCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace DrupalCheck\Command;

use DrupalCheck\Util\Tty;
use DrupalFinder\DrupalFinder;
use Nette\Neon\Neon;
use PHPStan\ShouldNotHappenException;
Expand Down Expand Up @@ -179,6 +178,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$pharPath = \Phar::running();
if ($pharPath !== '') {
// Running in packaged Phar archive.
$output->writeln('<comment>Assumed running as Phar</comment>', OutputInterface::VERBOSITY_DEBUG);
$phpstanBin = \realpath('vendor/phpstan/phpstan/phpstan.phar');
$configuration_data['parameters']['bootstrapFiles'] = [\realpath($pharPath . '/error-bootstrap.php')];
$configuration_data['includes'] = [
Expand All @@ -187,6 +187,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
];
} elseif (file_exists(__DIR__ . '/../../vendor/autoload.php')) {
// Running as a project dependency.
$output->writeln('<comment>Assumed running as local dependency</comment>', OutputInterface::VERBOSITY_DEBUG);
$phpstanBin = \realpath(__DIR__ . '/../../vendor/phpstan/phpstan/phpstan.phar');
$configuration_data['parameters']['bootstrapFiles'] = [\realpath(__DIR__ . '/../../error-bootstrap.php')];
$configuration_data['includes'] = [
Expand All @@ -195,6 +196,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
];
} elseif (file_exists(__DIR__ . '/../../../../autoload.php')) {
// Running as a global dependency.
$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.
Expand Down

0 comments on commit 5854972

Please sign in to comment.