-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
165 lines (141 loc) · 4.85 KB
/
Copy pathTaskfile.yml
File metadata and controls
165 lines (141 loc) · 4.85 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
# https://taskfile.dev
version: "3"
tasks:
default:
cmd: task --list-all
silent: true
ddev:
desc: "Run DDEV command"
cmd: ddev {{.TASK_ARGS}} {{.CLI_ARGS}}
internal: true
coding-standards:apply:
desc: "Apply coding standards"
cmds:
- task: coding-standards:composer:apply
- task: coding-standards:markdown:apply
- task: coding-standards:php:apply
- task: coding-standards:yaml:apply
coding-standards:check:
desc: "Check coding standards"
cmds:
- task: coding-standards:composer:check
- task: coding-standards:markdown:check
- task: coding-standards:php:check
- task: coding-standards:yaml:check
coding-standards:composer:apply:
desc: "Apply coding standards for composer"
cmds:
- task: ddev
vars:
TASK_ARGS: composer normalize
coding-standards:composer:check:
- task: coding-standards:composer:apply
- task: ddev
vars:
TASK_ARGS: composer normalize --dry-run
- task: ddev
vars:
TASK_ARGS: composer validate
coding-standards:markdown:apply:
desc: "Apply coding standards for Markdown"
cmds:
# Cf. .github/workflows/markdown.yaml
- docker compose run --rm markdownlint markdownlint '**/*.md' --fix
coding-standards:markdown:check:
desc: "Apply and check coding standards for Markdown"
cmds:
- task: coding-standards:markdown:apply
# Cf. .github/workflows/markdown.yaml
- docker compose run --rm markdownlint markdownlint '**/*.md'
coding-standards:php:apply:
desc: "Apply coding standards for PHP"
cmds:
# Cf. .github/workflows/php.yaml
- task: ddev
vars:
TASK_ARGS: phpcbf
coding-standards:php:check:
desc: "Apply and check coding standards for PHP"
cmds:
- task: coding-standards:php:apply
# Cf. .github/workflows/php.yaml
- task: ddev
vars:
TASK_ARGS: phpcs
coding-standards:yaml:apply:
desc: "Apply coding standards for YAML"
cmds:
# Cf. .github/workflows/yaml.yaml
- docker compose run --rm prettier '**/*.{yml,yaml}' --write
coding-standards:yaml:check:
desc: "Apply coding standards for YAML"
cmds:
- task: coding-standards:yaml:apply
# Cf. .github/workflows/yaml.yaml
- docker compose run --rm prettier '**/*.{yml,yaml}' --check
code-analysis:
desc: "Run static code analysis"
cmds:
- task: code-analysis:rector
- task: code-analysis:phpstan
code-analysis:phpstan:
desc: "Run PHPStan"
cmds:
- task: ddev
vars:
TASK_ARGS: phpstan
rector:
desc: "Run rector"
cmds:
- task: ddev
vars:
TASK_ARGS: php vendor/bin/rector
ddev:start:
desc: Start DDEV setup (https://github.com/ddev/ddev-drupal-contrib)
# https://github.com/ddev/ddev-drupal-contrib
deps:
- composer:install:lenient
cmds:
- ddev add-on get ddev/ddev-drupal-contrib
- ddev restart
- ddev poser --no-interaction
- ddev symlink-project
# Detect expected Drupal and PHP versions.
- ddev config --update
composer:install:lenient:
cmds:
# Create a temporary composer file to install https://github.com/mglaman/composer-drupal-lenient before the real install needs it.
- for:
- init --no-interaction
- config --no-plugins allow-plugins.mglaman/composer-drupal-lenient true
- require mglaman/composer-drupal-lenient:^1.0
cmd: ddev exec -- COMPOSER=composer.lenient.json composer {{.ITEM}}
# Clean up
- rm -f composer.lenient.*
internal: true
translations:extract:
desc: Extract module translations
cmds:
- ddev drush --yes site:install minimal
- ddev drush --yes pm:install drupal_translation_extractor
- for:
- da
cmd: ddev drush --yes drupal_translation_extractor:translation:extract {{.ITEM}} --dump-messages --force --output=%source/translations/%module.%locale.po --require-context=os2forms_f2 module:os2forms_f2 --debug
translations:git:diff:
desc: "`git diff` all translation files ignoring timestamp changes"
# Ignore some PO metadata when git diff'ing, e.g.
#
# "POT-Creation-Date: 2025-03-12 18:18+0100\n"
# "PO-Revision-Date: 2025-03-12 18:18+0100\n"
cmd: git diff --exit-code --ignore-blank-lines --ignore-matching-lines='^"PO.*-Date' '*.po'
translations:git:restore:
desc: '`git restore` all translation file changes if only timestamps are changed (cf. `task {{.TASK | replace ":restore" ":diff" }}`)'
# https://taskfile.dev/reference/schema#preconditions
preconditions:
- sh: task {{.TASK | replace ":restore" ":diff" }}
msg: |
Translations seem to have changed.
Run
task {{.TASK | replace ":restore" ":diff" }}
to check.
cmd: git restore '*.po'