Skip to content

Commit

Permalink
Merge pull request #555 from ec-europa/feature/DQA-4440
Browse files Browse the repository at this point in the history
DQA-4440: Drop grumphp dependency.
  • Loading branch information
jonhy81 authored Sep 28, 2022
2 parents 188b19d + cc665af commit c7979d9
Show file tree
Hide file tree
Showing 77 changed files with 1,961 additions and 8,784 deletions.
40 changes: 18 additions & 22 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,25 @@ workspace:
base: /test
path: toolkit

matrix:
PHP_VERSION:
- 8.1
COMPOSER_VERSION:
- 2
COMPOSER_BOUNDARY:
- lowest
- highest

services:
web:
image: registry.fpfis.eu/fpfis/httpd-php:${PHP_VERSION=7.4}-ci
image: registry.fpfis.eu/fpfis/httpd-php:${PHP_VERSION=8.1}-ci
environment:
- DOCUMENT_ROOT=/test/toolkit

pipeline:
composer-install:
group: composer
image: registry.fpfis.eu/fpfis/httpd-php:${PHP_VERSION=7.4}-ci
image: registry.fpfis.eu/fpfis/httpd-php:${PHP_VERSION=8.1}-ci
volumes:
- /cache/${DRONE_REPO_NAME}:/cache
commands:
Expand All @@ -27,7 +36,7 @@ pipeline:

composer-update-lowest:
group: composer
image: registry.fpfis.eu/fpfis/httpd-php:${PHP_VERSION=7.4}-ci
image: registry.fpfis.eu/fpfis/httpd-php:${PHP_VERSION=8.1}-ci
volumes:
- /cache/${DRONE_REPO_NAME}:/cache
commands:
Expand All @@ -37,45 +46,32 @@ pipeline:
matrix:
COMPOSER_BOUNDARY: lowest

grumphp:
phpcs:
group: test
image: registry.fpfis.eu/fpfis/httpd-php:${PHP_VERSION=7.4}-ci
image: registry.fpfis.eu/fpfis/httpd-php:${PHP_VERSION=8.1}-ci
commands:
- ./vendor/bin/phpcs -i
- ./vendor/bin/grumphp run
- ./vendor/bin/phpcs -p

phpunit:
group: test
image: registry.fpfis.eu/fpfis/httpd-php:${PHP_VERSION=7.4}-ci
image: registry.fpfis.eu/fpfis/httpd-php:${PHP_VERSION=8.1}-ci
commands:
- ./vendor/bin/phpunit

lint-yaml:
group: test
image: registry.fpfis.eu/fpfis/httpd-php:${PHP_VERSION=7.4}-ci
image: registry.fpfis.eu/fpfis/httpd-php:${PHP_VERSION=8.1}-ci
secrets: [ github_api_token, composer_auth ]
commands:
- ./vendor/bin/yaml-lint *.yml *.yml.dist
- CONFIG_FOLDER=$(if test -d config; then find config -type f -name "*.yml"; fi)
- if ! [ -z "$CONFIG_FOLDER" ]; then ./vendor/bin/yaml-lint $CONFIG_FOLDER; fi
- LIB_FOLDER=$(if test -d lib; then find lib -type f -name "*.yml"; fi)
- if ! [ -z "$LIB_FOLDER" ]; then ./vendor/bin/yaml-lint $LIB_FOLDER; fi

lint-php:
group: test
image: registry.fpfis.eu/fpfis/httpd-php:${PHP_VERSION=7.4}-ci
image: registry.fpfis.eu/fpfis/httpd-php:${PHP_VERSION=8.1}-ci
secrets: [ github_api_token, composer_auth ]
commands:
- ./vendor/bin/parallel-lint --exclude web --exclude vendor -e module -e inc -e theme -e install -e php .

matrix:
PHP_VERSION:
- 7.4
- 8.0
- 8.1
COMPOSER_BOUNDARY:
- lowest
- highest
COMPOSER_VERSION:
- 1
- 2
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ locally and can be used in CI tools like Jenkins, Drone or Travis.
- [Continuous integration](/docs/continuous-integration.md)
- [Available tasks](/docs/available-tasks.md)
- [Building assets](/docs/building-assets.md)
- [Git Hooks](/docs/git-hooks.md)
- [Update Project Documentation](/docs/project-documentation.md)
- [Changelog](/CHANGELOG.md)

Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
"source": "https://github.com/ec-europa/toolkit"
},
"require": {
"php": ">=7.4",
"php": ">=8.1",
"ext-curl": "*",
"ext-dom": "*",
"ext-json": "*",
"ext-simplexml": "*",
"behat/behat": "^3.7 || ^3.8",
"cweagans/composer-patches": "^1.4 || ^1.7",
"drush/drush": "^9.7.1 || ^10.0.0 || ^11.0.4",
"ec-europa/qa-automation": "^8.1.5",
"ec-europa/qa-automation": "^9.0",
"guzzlehttp/guzzle": "^6.3 || ^7.0",
"j13k/yaml-lint": "^1.1",
"openeuropa/task-runner": "^2.0@alpha",
Expand Down Expand Up @@ -57,7 +57,7 @@
"post-install-cmd": [
"./vendor/bin/phpcs --config-set installed_paths '../../drupal/coder/coder_sniffer,../../phpcompatibility/php-compatibility,phpcs,../../ec-europa/qa-automation/phpcs'"
],
"post-update-cmd" : [
"post-update-cmd": [
"./vendor/bin/phpcs --config-set installed_paths '../../drupal/coder/coder_sniffer,../../phpcompatibility/php-compatibility,phpcs,../../ec-europa/qa-automation/phpcs'"
]
}
Expand Down
4 changes: 4 additions & 0 deletions config/commands/githooks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
command:
toolkit:
hooks:
active: ${toolkit.hooks.active}
29 changes: 28 additions & 1 deletion config/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ toolkit:
- "/"
- "/user"
phpcs:
mode: grumphp
mode: phpcs
config: phpcs.xml
ignore_annotations: 0
show_sniffs: 0
Expand Down Expand Up @@ -129,3 +129,30 @@ toolkit:
invalid-versions:
- 1.x
- 2.x
hooks:
# A relative path from the project root where the hooks are located.
dir: 'resources/git/hooks'
active:
# Check for modified files and run PHPcs.
- pre-commit
# Check if the commit message is properly formatted.
- prepare-commit-msg
# Run the PHPcs and linters (configurable).
- pre-push
prepare-commit-msg:
example: 'ABC-123: The commit message.'
conditions:
- message: "The commit message must start with the JIRA issue number."
regex: /^[A-Z]+\-\d+/
- message: "The JIRA issue number must be followed by a colon and space."
regex: /^[A-Z]+\-\d+:\ /
- message: "The subject must start with capital letter."
regex: /^[A-Z]+\-\d+:\ [A-Z]/
- message: "The commit message must end with a period."
regex: /\.$/
pre-push:
commands:
- toolkit:test-phpcs
- toolkit:lint-yaml
- toolkit:lint-php
- toolkit:opts-review
9 changes: 4 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
version: '2'
services:
web:
image: registry.fpfis.eu/fpfis/httpd-php:7.4-dev
image: registry.fpfis.eu/fpfis/httpd-php:8.1-dev
working_dir: ${PWD}
volumes:
- ${PWD}:${PWD}
- ${HOME}/.composer/auth.json:/root/.composer/auth.json
- ${PWD}/resources/xDebug/xdebug.custom.ini:/etc/php/8.1/mods-available/xdebug.ini
# - ${HOME}/.composer/auth.json:/root/.composer/auth.json
environment:
DOCUMENT_ROOT: ${PWD}
ASDA_USER:
ASDA_PASSWORD:
NEXTCLOUD_USER:
NEXTCLOUD_PASS:
QA_API_BASIC_AUTH:
XDEBUG_CONFIG: remote_host=host.docker.internal remote_port=9003 remote_enable=1
PHP_IDE_CONFIG: "serverName=Docker"
Expand Down
95 changes: 50 additions & 45 deletions docs/available-tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,57 +5,61 @@ To list all available tasks, please run:
docker-composer exec web ./vendor/bin/run
```

See bellow current list for version `8.6.19`.
See bellow current list for version `9.0.0`.
```
Available commands:
help Displays help for a command
list Lists commands
help Displays help for a command
list Lists commands
changelog
changelog:generate [changelog:g|cg] Generate a changelog based on GitHub issues and pull requests.
changelog:generate [changelog:g|cg] Generate a changelog based on GitHub issues and pull requests.
drupal
drupal:drush-setup Write Drush configuration files to given directories.
drupal:permissions-setup Setup Drupal permissions.
drupal:settings-setup Setup Drupal settings.php file in compliance with Toolkit conventions.
drupal:setup-test
drupal:site-install [drupal:si|dsi] Install target site.
drupal:site-post-install Run Drupal post-install commands.
drupal:site-pre-install Run Drupal pre-install commands.
drupal:drush-setup Write Drush configuration files to given directories.
drupal:permissions-setup Setup Drupal permissions.
drupal:settings-setup Setup Drupal settings.php file in compliance with Toolkit conventions.
drupal:site-install [drupal:si|dsi] Install target site.
drupal:site-post-install Run Drupal post-install commands.
drupal:site-pre-install Run Drupal pre-install commands.
release
release:create-archive [release:ca|rca] Create a release for the current project.
release:create-archive [release:ca|rca] Create a release for the current project.
toolkit
toolkit:build-assets [tba] Build theme assets (Css and Js).
toolkit:build-dev Build site for local development.
toolkit:build-dev-reset Build site for local development from scratch with a clean git.
toolkit:build-dist Build the distribution package.
toolkit:check-version Check the Toolkit version.
toolkit:code-review This command will execute all the testing tools.
toolkit:complock-check Check if 'composer.lock' exists on the project root folder.
toolkit:component-check Check composer.json for components that are not whitelisted/blacklisted.
toolkit:disable-drupal-cache Disable aggregation and clear cache.
toolkit:download-dump Download ASDA snapshot.
toolkit:drupal-upgrade-status [tdus] Check project compatibility for Drupal 9/10 upgrade.
toolkit:fix-permissions Run script to fix permissions (experimental).
toolkit:import-config Import config.
toolkit:install-clean Install a clean website.
toolkit:install-clone Install a clone website.
toolkit:install-dependencies Install packages present in the opts.yml file under extra_pkgs section.
toolkit:install-dump Import the production snapshot.
toolkit:lint-php [tlp] Run lint PHP.
toolkit:lint-yaml [tly] Run lint YAML.
toolkit:notifications Display toolkit notifications.
toolkit:opts-review Check project's .opts.yml file for forbidden commands.
toolkit:requirements Check the Toolkit Requirements.
toolkit:run-blackfire [tbf] Run Blackfire.
toolkit:run-deploy Run deployment sequence.
toolkit:run-phpcbf [tpb] Run PHP code autofixing.
toolkit:run-phpcbf-standalone Run PHP code autofixing in standalone mode.
toolkit:setup-blackfire-behat Copy the needed resources to run Behat with Blackfire.
toolkit:setup-phpcs Setup PHP code sniffer for standalone execution.
toolkit:test-behat [tb] Run Behat tests.
toolkit:test-phpcs [tp] Run PHP code sniffer.
toolkit:test-phpmd Run PHPMD standalone.
toolkit:test-phpunit [tp] Run PHPUnit tests.
toolkit:vendor-list Check 'Vendor' packages being monitorised.
toolkit:build-assets [tba|tk-assets] Build theme assets (Css and Js).
toolkit:build-dev [tk-bdev] Build site for local development.
toolkit:build-dev-reset Build site for local development from scratch with a clean git.
toolkit:build-dist [tk-bdist] Build the distribution package.
toolkit:check-version Check the Toolkit version.
toolkit:check-phpcs-requirements Make sure that the config file exists and configuration is correct.
toolkit:code-review This command will execute all the testing tools.
toolkit:complock-check Check if 'composer.lock' exists on the project root folder.
toolkit:component-check Check composer.json for components that are not whitelisted/blacklisted.
toolkit:disable-drupal-cache Disable aggregation and clear cache.
toolkit:download-dump Download ASDA snapshot.
toolkit:drupal-upgrade-status [tdus] Check project compatibility for Drupal 9/10 upgrade.
toolkit:fix-permissions Run script to fix permissions (experimental).
toolkit:hooks-delete-all Remove all existing hooks, this will ignore active hooks list.
toolkit:hooks-disable Disable the git hooks.
toolkit:hooks-enable Enable the git hooks defined in the configuration or in given option.
toolkit:hooks-list List available hooks and its status.
toolkit:hooks-run Run a specific hook.
toolkit:import-config [tk-ci] Import config.
toolkit:install-clean [tk-iclean] Install a clean website.
toolkit:install-clone [tk-iclone] Install a clone website.
toolkit:install-dependencies Install packages present in the opts.yml file under extra_pkgs section.
toolkit:install-dump Import the production snapshot.
toolkit:lint-php [tlp|tk-php] Run lint PHP.
toolkit:lint-yaml [tly|tk-yaml] Run lint YAML.
toolkit:notifications Display toolkit notifications.
toolkit:opts-review Check project's .opts.yml file for forbidden commands.
toolkit:requirements Check the Toolkit Requirements.
toolkit:run-blackfire [tbf|tk-bfire] Run Blackfire.
toolkit:run-deploy Run deployment sequence.
toolkit:run-phpcbf [tk-phpcbf] Run PHP code autofixing.
toolkit:setup-blackfire-behat Copy the needed resources to run Behat with Blackfire.
toolkit:setup-phpcs Setup PHP code sniffer.
toolkit:test-behat [tb|tk-behat] Run Behat tests.
toolkit:test-phpcs [tk-phpcs] Run PHP code sniffer.
toolkit:test-phpmd [tk-phpmd] Run PHPMD.
toolkit:test-phpunit [tp|tk-phpunit] Run PHPUnit tests.
toolkit:vendor-list Check 'Vendor' packages being monitorised.
```

### Other topics
Expand All @@ -67,5 +71,6 @@ Available commands:
- [Continuous integration](/docs/continuous-integration.md)
- Available tasks
- [Building assets](/docs/building-assets.md)
- [Git Hooks](/docs/git-hooks.md)
- [Update Project Documentation](/docs/project-documentation.md)
- [Changelog](/CHANGELOG.md)
1 change: 1 addition & 0 deletions docs/building-assets.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,5 +143,6 @@ docker-compose exec web ./vendor/bin/run toolkit:build-assets --validate=fix
- [Continuous integration](/docs/continuous-integration.md)
- [Available tasks](/docs/available-tasks.md)
- Building assets
- [Git Hooks](/docs/git-hooks.md)
- [Update Project Documentation](/docs/project-documentation.md)
- [Changelog](/CHANGELOG.md)
Loading

0 comments on commit c7979d9

Please sign in to comment.