-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTaskfile.yml
246 lines (219 loc) · 6.95 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
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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
version: '3'
silent: true
tasks:
# Docker tasks
docker-compose:
desc: Call docker compose cli
cmds:
- docker compose {{.CLI_ARGS}}
up:
desc: Create and start a container
cmds:
- task: docker-compose
vars:
# Add --build once when you add changes to the dockerfile
CLI_ARGS: up --detach --no-deps {{.SERVICE | default "php"}}
status:
- docker compose ps --services --status=running | grep {{.SERVICE | default "php"}}
down:
desc: Stop and remove containers
cmds:
- task: docker-compose
vars:
CLI_ARGS: down -v
run:
desc: Run a one-off command on a container
cmds:
- task: docker-compose
vars:
CLI_ARGS: run --rm --no-deps {{.SERVICE | default "php"}} {{.CLI_ARGS}}
exec:
desc: Execute a command in a running container
cmds:
- task: docker-compose
vars:
CLI_ARGS: exec {{.SERVICE | default "php"}} {{.CLI_ARGS}}
preconditions:
- task: docker-compose
vars:
CLI_ARGS: ps --services --status=running | grep {{.SERVICE | default "php"}}
execrun:
desc: Launch a command using "exec" if container is running, or with "run" otherwise
cmds:
- cmd: |
if [[ -n `docker compose ps --services --status=running | grep {{.SERVICE | default "php"}}` ]]; then
task exec SERVICE={{.SERVICE | default "php"}} -- {{.CLI_ARGS}}
else
task run SERVICE={{.SERVICE | default "php"}} -- {{.CLI_ARGS}}
fi;
# Services
php:
desc: Run php in background
run: once
cmds:
- task: up
vars:
SERVICE: php
database:
desc: Run database in background
run: once
vars:
PORT: 3306
cmds:
- task: up
vars:
SERVICE: database
- task: shell
vars:
CLI_ARGS: -c "while ! nc -z database {{.PORT}} 2> /dev/null; do sleep 0.1; done;" 2> /dev/null
# CLI tasks
shell:
desc: Run shell
cmds:
- task: execrun
vars:
SERVICE: php
CLI_ARGS: /bin/sh {{.CLI_ARGS}}
php-cli:
desc: Run PHP-cli
cmds:
- task: execrun
vars:
SERVICE: php
CLI_ARGS: php {{.CLI_ARGS | default "-a"}}
composer:
desc: Run composer
cmds:
- task: execrun
vars:
SERVICE: composer
CLI_ARGS: composer {{.CLI_ARGS}}
# Tools tasks
artisan:
desc: Run Laravel Artisan
cmds:
- task: php-cli
vars:
CLI_ARGS: artisan {{.CLI_ARGS}}
tinker:
desc: Run Laravel Tinker
interactive: true
deps:
- task: database
cmds:
- task: artisan
vars:
CLI_ARGS: tinker {{.CLI_ARGS}}
test:
desc: Run Laravel Tests
deps:
- task: database
cmds:
- task: artisan
vars:
CLI_ARGS: test {{.TEST_ARGS}} {{.CLI_ARGS}}
test:unit:
desc: Run Laravel Unit Tests
deps:
- task: database
cmds:
- task: artisan
vars:
CLI_ARGS: test --testsuite=Unit {{.TEST_ARGS}} {{.CLI_ARGS}}
test:integration:
desc: Run Laravel Intagration Tests
deps:
- task: database
cmds:
- task: artisan
vars:
CLI_ARGS: test --testsuite=Integration {{.TEST_ARGS}} {{.CLI_ARGS}}
ide-helper:
desc: Generate ide-helper files
cmds:
- task: artisan
vars:
CLI_ARGS: clear-compiled
- task: artisan
vars:
CLI_ARGS: ide-helper:generate
- task: artisan
vars:
CLI_ARGS: ide-helper:meta
- task: artisan
vars:
CLI_ARGS: ide-helper:eloquent
models-ac:
desc: Generate ide-helper models autocomplete
deps:
- task: database
cmds:
- task: artisan
vars:
CLI_ARGS: clear-compiled
- task: artisan
vars:
CLI_ARGS: ide-helper:models
pint:
desc: Run Pint
cmds:
- task: php-cli
vars:
CLI_ARGS: vendor/bin/pint {{.PINT_ARGS}} {{.CLI_ARGS}}
rector:
desc: Run rector
cmds:
- task: php-cli
vars:
CLI_ARGS: vendor/bin/rector process {{.RECTOR_ARGS}} {{.CLI_ARGS}}
phpstan:
desc: Run Phpstan
cmds:
- task: phpstan:app
- task: phpstan:tests
phpstan:app:
desc: Run Phpstan for App code
cmds:
- task: php-cli
vars:
CLI_ARGS: vendor/bin/phpstan analyse -c phpstan-baseline-app.neon ./app {{.PINT_ARGS}} {{.CLI_ARGS}}
phpstan:tests:
desc: Run Phpstan for Tests code
cmds:
- task: php-cli
vars:
CLI_ARGS: vendor/bin/phpstan analyse -c phpstan-baseline-tests.neon --level=7 ./tests {{.PINT_ARGS}} {{.CLI_ARGS}}
lint:
desc: Run linting
cmds:
- cmd: |
printf "\n\033[0;36m\033[1mRunning Pint\033[0m\n"
task pint -- --test
ignore_error: true
- cmd: |
printf "\n\033[0;36m\033[1mRunning Rector\033[0m\n\n"
task rector -- --dry-run
ignore_error: true
- cmd: |
printf "\n\033[0;36m\033[1mRunning Phpstan\033[0m\n\n"
task phpstan
lint:fix:
desc: Run linting
cmds:
- cmd: |
printf "\n\033[0;36m\033[1mRunning Pint\033[0m\n"
task pint
- cmd: |
printf "\n\033[0;36m\033[1mRunning Rector\033[0m\n\n"
task rector
- cmd: |
printf "\n\033[0;36m\033[1mRunning Phpstan\033[0m\n\n"
task phpstan
# Wrapper tasks
install:
desc: Install the project for the first time
cmds:
- task: composer
vars:
CLI_ARGS: install
- task: ide-helper