-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTaskfile.yml
More file actions
63 lines (54 loc) · 1.94 KB
/
Taskfile.yml
File metadata and controls
63 lines (54 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
version: '3'
vars:
CONTAINER_NAME: phpstan-rules
DOCKER_IMAGE_TAG: docker-phpstan-rules:beta
tasks:
build:
desc: Build Docker image with dev target
cmds:
- docker build --target dev -t {{.DOCKER_IMAGE_TAG}} .
stop:
desc: Stop the Docker container
silent: true
cmds:
- docker rm -f {{.CONTAINER_NAME}}
run:
desc: Run the Docker container with volume mounts
silent: true
cmds:
- |
if ! docker image inspect {{.DOCKER_IMAGE_TAG}} > /dev/null 2>&1; then
echo "Image {{.DOCKER_IMAGE_TAG}} not found, building..."
task build
fi
- task stop
- docker run -d --rm --name {{.CONTAINER_NAME}} -v "{{.PWD}}:/var/www/html" -v "composer-cache:/composer-cache" -v "${HOME}/.ssh:/home/admin/.ssh:ro" -v "${HOME}/.ssh/known_hosts:/home/admin/.ssh/known_hosts:rw" {{.DOCKER_IMAGE_TAG}}
composer_install:
desc: Run composer install inside the Docker container
cmds:
- docker exec -u admin -it {{.CONTAINER_NAME}} composer install
cli:
desc: Run the Docker container with volume mounts and interactive shell
silent: true
cmds:
- task run
- task composer_install
- docker exec -u admin -it {{.CONTAINER_NAME}} bash
test:
desc: Run tests inside the Docker container
cmds:
- task run
- task composer_install
- docker exec -u admin -it {{.CONTAINER_NAME}} vendor/bin/phpunit
quality:
desc: Run quality checks inside the Docker container
cmds:
- task run
- task composer_install
- docker exec -u admin -it {{.CONTAINER_NAME}} vendor/bin/rector process --config rector.php
- docker exec -u admin -it {{.CONTAINER_NAME}} vendor/bin/php-cs-fixer fix --config .php-cs-fixer.php --diff
- docker exec -u admin -it {{.CONTAINER_NAME}} vendor/bin/phpstan analyse --level max --configuration phpstan.neon src tests
default:
desc: List available tasks
cmds:
- task --list