rework phpstan task to use inotifywait
This commit is contained in:
parent
ff18453205
commit
d5c043e846
|
@ -3,11 +3,11 @@
|
|||
"tasks": [
|
||||
{
|
||||
"type": "shell",
|
||||
"label": "phpstan-8.1 (background)",
|
||||
"label": "phpstan 8.1 (watcher)",
|
||||
"isBackground": true,
|
||||
"problemMatcher": {
|
||||
"fileLocation": ["relative", "${workspaceRoot}"],
|
||||
"owner": "phpstan-8.1",
|
||||
"owner": "phpstan-watcher-8.1",
|
||||
"pattern": {
|
||||
"regexp": "^/app/(.*?):([0-9\\?]*):(.*)$",
|
||||
"file": 1,
|
||||
|
@ -21,22 +21,7 @@
|
|||
|
||||
}
|
||||
},
|
||||
"command": "while true; do docker run --rm -v $(pwd):/app -v /tmp/phpstan-8.1:/tmp/phpstan --workdir /app php:8.1-cli php -d memory_limit=-1 ./vendor/bin/phpstan --memory-limit=2G --error-format=raw || true; echo 'All done'; sleep 30; done",
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"label": "phpstan-8.0 (run once)",
|
||||
"problemMatcher": {
|
||||
"fileLocation": ["relative", "${workspaceRoot}"],
|
||||
"owner": "phpstan-8.0",
|
||||
"pattern": {
|
||||
"regexp": "^/app/(.*?):([0-9\\?]*):(.*)$",
|
||||
"file": 1,
|
||||
"line": 2,
|
||||
"message": 3
|
||||
}
|
||||
},
|
||||
"command": "docker run --rm -v $(pwd):/app -v /tmp/phpstan-8.0:/tmp/phpstan --workdir /app php:8.0-cli php -d memory_limit=-1 ./vendor/bin/phpstan --memory-limit=2G --error-format=raw || true",
|
||||
"command": "${workspaceRoot}/utils/phpstan-watcher.sh",
|
||||
},
|
||||
{
|
||||
"type": "gulp",
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
#!/bin/sh
|
||||
|
||||
PHP_VERSION="$1"
|
||||
|
||||
[ -z "$PHP_VERSION" ] && PHP_VERSION=8.1
|
||||
|
||||
echo PHP_VERSION: ${PHP_VERSION}
|
||||
echo PWD: $(pwd)
|
||||
|
||||
while true; do
|
||||
inotifywait . -e close_write -r -t 300 | grep -q .php && \
|
||||
(
|
||||
docker run --rm -v $(pwd):/app -v /tmp/phpstan-8.1:/tmp/phpstan \
|
||||
--workdir /app php:${PHP_VERSION}-cli php -d memory_limit=-1 ./vendor/bin/phpstan --memory-limit=2G --error-format=raw
|
||||
echo All done, RC=$?.
|
||||
)
|
||||
sleep 1
|
||||
done
|
Loading…
Reference in New Issue