Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved task runner #741

Merged
merged 47 commits into from
Jun 3, 2020
Merged

Improved task runner #741

merged 47 commits into from
Jun 3, 2020

Conversation

veewee
Copy link
Contributor

@veewee veewee commented Feb 14, 2020

Working on an improved task runner system.
Goals:

  • Add middleware system for task runner
  • Add middleware system for single task handler
  • Introducing parallel execution of tasks #586 / FR: Add parallel execution option and task execution stages #581 : Parallel task execution
    • Enable / disable through config
    • Parallel Exception logging
  • Remove Symfony Progress bar component for output
  • Phpcs option for auto fixing or prompt to fix #663 Add FixableResult + middleware that fixes failed tasks (but does not commit ! )
    • How to run in git mode? (non-interactive)
    • Enable / disable through config?
    • Fixer task might fail whilst still fixed some files. E.g. phpcbf couldn't fix ALL files. Should it display fail or not?
  • Maybe better to move the git stash logic to a middleware as well? Not needed for now
  • Use namespaced Symfony config tree instead of raw parameters with gracefull fallback for old configs
  • Rework configuration models
  • Removed phpcsfixer v1
  • Improve task config:
    • Configurable task priority from task service config
    • Multiple aliases for a single task service
  • Keep phpparser visitors in light container
  • Testing
    • Add spec tests
    • Add unit tests
    • Add e2e tests
    • Windows
    • Phar:
      • Call to undefined function _HumbugBoxc0ef9bc7da1a\Amp\Promise\wait() in phar
      • $this in object context
    • ext-parallel, ext-threads
      • $this in object context
    • Lowest dependencies
  • Update documentation
    • Added parallel config
    • Added fixer config + update tasks documentation
    • Fix old parameter syntaxes
    • Remove removed config parameters
    • Remove old FAQ item
  • Provide changelog / migration info
    • config: Removed process_async params
    • config: parameters to grumphp extension
    • removed phpcsfixer (v1) task in favour of phpcsfixer2
  • Fix all reported psalm issues + add task to grumphp.yml -> WONTDO in this ticket (currently it is not possible to get psalm to work with composer2, See enhancement Use stand-alone tools instead of composer dependencies #769. Removed the dependency, but kept the types and configuration!)

Parallel test container:

FROM php:7.3-zts-stretch

# Parellel
RUN pecl install parallel
RUN docker-php-ext-enable parallel

# GrumPHP specific:
RUN apt-get update \
    && apt-get -y --no-install-recommends install git \
    && apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*

Upgrading

Validated GrumPHP parameters

The new version will validate the structure and content of the GrumPHP parameters.
Therefor you need to move the grumphp parameters out of the regular parameters section.
If you are not using any symfony/dependency-injection parameters, you only need to rename the parameters keyword:

# grumphp.yaml

- parameters:
+ grumphp:

Removed support for PHP-CS-Fixer v1.

Since PHP-CS-Fixer is out for quite some time and because v3 is in the making, we drop support for version 1.
If you still want to use version 1, you can use an older version of GrumPHP or provide a custom extension for your project.

By default, the phpcsfixer will now load the task for the latest PHP-CS-fixer.
We also provided a phpcsfixer2 alias to make sure existing projects don't break.
However, you can now rename the task inside your configuration:

# grumphp.yaml

grumphp:
    tasks:
-       phpcsfixer2:
+       phpcsfixer:

We added a way of running the PHP-CS-Fixer v1 in parallel to improve execution speed.
However, this code is not needed anymore inside the new version and might be confusing with the actual parallel implementation.
Therefore, we removed following parameters:

# grumphp.yaml

grumphp:
-     process_async_limit: 10
-     process_async_wait: 1000

Bump to Symfony 4.4

In this release, we bump the dependencies up to Symfony 4.4.
This is because the parallel system requires the Advanced console output improvements inside SF 4.1. Since that version is not supported by Symfony anymore, we decided to bump to the version 4 LTS.

If your package still requires older dependencies, you can install the grumphp-shim package which works dependency-less.

@veewee
Copy link
Contributor Author

veewee commented Feb 14, 2020

@Landerstraeten : Can you take a quick look at this? It's still in an early phase and quite experimental - but wanted your early feedback.
It's a bit more complex then regular middleware systems because of 2 stages : run all tasks / run single task and highly inspired by tactician.

It looks like this approach should be something I could get to work.

@veewee veewee added this to the 0.19.0 milestone Feb 25, 2020
@veewee veewee changed the title [WIP] Improved task runner Improved task runner May 29, 2020
@janvernieuwe
Copy link
Member

This should fix issue #755 as well

@janvernieuwe janvernieuwe linked an issue May 29, 2020 that may be closed by this pull request
README.md Outdated Show resolved Hide resolved
@veewee
Copy link
Contributor Author

veewee commented May 29, 2020

GREEN

What a journey :)

@veewee veewee merged commit 140376e into phpro:master Jun 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Convention variables validation bug
3 participants