generated from itk-dev/drupal-11-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTaskfile.yml
More file actions
220 lines (191 loc) · 7.26 KB
/
Taskfile.yml
File metadata and controls
220 lines (191 loc) · 7.26 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
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
version: "3"
dotenv: [".task.env", ".env"]
includes:
coding-standards:
taskfile: ./task/Taskfile.coding-standards.yml
translation:
taskfile: ./task/Taskfile.translation.yml
vars:
TRANSLATION_MODULES:
- ai_screening
# - ai_screening_fixtures_base
- ai_screening_project
- ai_screening_project_track
- ai_screening_reports
TRANSLATION_THEMES:
- itkdev_base_theme
- itkdev_project_theme
TRANSLATION_LANGUAGES:
- da
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}} {{.TASK_ARGS}} {{.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
- task set-user-roles
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
- task set-user-roles
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-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 theme-build
- task drush -- site-install --existing-config --yes
- task translation:import --yes
- task set-user-roles
- task drush -- cache:rebuild
site-update:
desc: "Update site"
prompt: "This will reset your configuration. Continue?"
cmds:
- task start
- task theme-build
- task drush -- deploy
- task translation:import --yes
- task set-user-roles
- task drush -- cache:rebuild
- task drush -- browse --no-browser
- task drush -- user:login
silent: true
theme-build:
desc: "Build theme"
cmds:
- task compose -- run --rm node yarn --cwd /app/web/themes/custom/itkdev/itkdev_project_theme install
- 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-clean-up:
desc: "Clean up theme building"
cmds:
- sudo chown -R $(id -u):$(id -g) web/themes/custom/itkdev/*/node_modules
- rm -rf web/themes/custom/itkdev/*/node_modules
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:
- task composer -- code-analysis
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
test-playwright-test:
desc: "Run playwright tests"
cmds:
# Trigger task to pass on `--yes` (and other task flags), cf.
# https://taskfile.dev/reference/schema#command and
# https://taskfile.dev/reference/cli#flags
- task: test-playwright-initialize
# See https://playwright.dev/docs/test-reporters#html-reporter
- task compose -- run --rm --env _CI=1 --env PLAYWRIGHT_HTML_OPEN=never playwright npx playwright test || true
- open playwright-report/index.html
test-playwright-test-ui:
desc: "Run playwright tests UI"
cmds:
# Trigger task to pass on `--yes` (and other task flags), cf.
# https://taskfile.dev/reference/schema#command and
# https://taskfile.dev/reference/cli#flags
- task: test-playwright-initialize
- xhost + 127.0.0.1
- task compose -- run --rm --env DISPLAY=host.docker.internal:0 playwright npx playwright test --ui
test-playwright-initialize:
internal: true
cmds:
# Trigger task to pass on `--yes` (and other task flags), cf.
# https://taskfile.dev/reference/schema#command and
# https://taskfile.dev/reference/cli#flags
- task: site-install
# Delete all translations.
- task drush -- sql:query "DELETE FROM locales_target";
- task drush -- cache:rebuild
- task compose -- run --rm node npm install
- task compose -- run --rm playwright npx playwright install
set-user-roles:
desc: "Set some user's roles"
cmds:
- task drush -- user:role:add 'administrator' admin
silent: true
prettier:
desc: "Run Prettier on tests source"
cmds:
- docker run --rm -v $(pwd):/work tmknom/prettier --write tests
- docker run --rm -v $(pwd):/work tmknom/prettier --check tests
code-analysis:
desc: "Run static code analysis"
cmds:
- task: compose
vars:
TASK_ARGS: exec phpfpm vendor/bin/phpstan