generated from itk-dev/drupal-11-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.yml
134 lines (115 loc) · 4.52 KB
/
Taskfile.yml
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
version: '3'
dotenv: [".task.env", ".env"]
vars:
DOCKER_COMPOSE: '{{ .TASK_DOCKER_COMPOSE | default "docker compose" }}'
# https://taskfile.dev/reference/templating/
BASE_URL: '{{.TASK_BASE_URL | default .COMPOSE_SERVER_DOMAIN | default .COMPOSE_DOMAIN | default ""}}'
tasks:
compose:
desc: "Run `docker compose` command. Example: task compose -- up --detach"
cmds:
- '{{ .DOCKER_COMPOSE }} {{ .CLI_ARGS }}'
compose-exec:
desc: "Run `docker compose exec` command handling content on stdin. Example: task compose-exec -- phpfpm php -v"
cmds:
# Check if we have content on stdin (cf.
# https://unix.stackexchange.com/questions/762992/bash-check-if-the-standard-input-contains-anything)
- if [[ ! -t 0 ]]; then task compose -- exec --no-TTY {{ .CLI_ARGS }}; else task compose -- exec {{ .CLI_ARGS }}; fi
silent: true
composer:
desc: "Run composer command. Example: task composer -- install"
cmds:
- task compose-exec -- phpfpm composer {{ .CLI_ARGS }}
silent: true
start:
desc: "Start docker compose stuff and install composer stuff"
cmds:
- task compose -- pull
- task compose -- up --detach --remove-orphans --wait
- task composer -- install
silent: true
drush:
desc: "Run Drush command. Example: task drush -- user:login"
cmds:
# Notice: To make debugging (with Xdebug) work, we have to call
# vendor/bin/drush.php directly (and not vendor/bin/drush)
- task compose-exec -- phpfpm vendor/bin/drush.php --uri={{.URI}} {{ .CLI_ARGS }}
vars:
URI:
sh: task site-url
silent: true
build-site:new:
desc: "Build a new site"
cmds:
- task drush -- site:install minimal -y
build-site:existing-conf:
desc: "Build the site using existing configuration from the config/sync folder"
cmds:
- task compose -- up --detach
- task composer -- install
- task drush -- site-install --existing-config --yes
site-url:
desc: "Show site URL"
cmds:
- echo {{.URL}}
vars:
URL:
# Compute base URL if not set.
sh: if [ ! -z "{{.BASE_URL}}" ]; then echo "https://{{.BASE_URL}}"; else echo "http://$(task compose -- port nginx 8080)"; fi
silent: true
site-update:
desc: "Update site"
prompt: "This will reset your configuration. Continue?"
cmds:
- task start
- task drush -- deploy
- task theme-build
- task drush -- cache:rebuild
- task drush -- browse --no-browser
- task drush -- user:login
silent: true
site-install-new:
desc: "Install minimal Drupal site from scratch"
prompt: "This will reset your setup. Continue?"
cmds:
- task start
- task drush -- --yes site:install minimal
site-install:
desc: "Install Drupal site with exiting config"
prompt: "This will reset your setup. Continue?"
cmds:
- task start
- task drush -- site-install --existing-config --yes
theme-build:
desc: "Build theme"
cmds:
- task compose -- run --rm node yarn --cwd /app/web/themes/custom/itkdev/itkdev_base_theme install
- task compose -- run --rm node yarn --cwd /app/web/themes/custom/itkdev/itkdev_base_theme build
theme-watch:
desc: "Build theme and watch for changes"
cmds:
- task theme-build
- task compose -- run --rm node yarn --cwd /app/web/themes/custom/itkdev/itkdev_base_theme watch
simulate-github-actions:
desc: "Simulate most github actions to prepare the code and catch errors before github does"
cmds:
- task composer -- normalize
- task check-code
check-code:
desc: "Check coding standards"
cmds:
- docker run --rm --volume "$PWD:/md" peterdavehello/markdownlint markdownlint $(git ls-files *.md)
- task composer -- code-analysis
- task composer -- coding-standards-check/twig-cs-fixer
apply-fixtures:
desc: "Apply fixtures. Any cli arguments will be passed to `drush content-fixtures:load`"
prompt: "This will reset your content. Continue?"
cmds:
- task drush -- --yes pm:install ai_screening_fixtures_base
- task drush -- --yes content-fixtures:load {{.CLI_ARGS}}
- task drush -- --yes pm:uninstall ai_screening_fixtures_base content_fixtures
test-module-test:
desc: "Run custom module unit tests. Any additional arguments are passed to `phpunit`, e.g. `task test-module-test -- --debug`"
cmds:
- task compose -- exec phpfpm bash -c 'cd web && ../vendor/bin/phpunit --configuration ../phpunit.xml modules/custom {{.CLI_ARGS}}'
silent: true