Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Make task runners great again
Search
GBProd
June 12, 2017
Programming
2
310
Make task runners great again
GBProd
June 12, 2017
Tweet
Share
More Decks by GBProd
See All by GBProd
Les tests en Symfony
gbprod
0
200
Gilles, craftman from father to son
gbprod
0
120
SOLID/STUPID
gbprod
0
310
DDD: Retour d'expérience
gbprod
0
33
Artisan développeur
gbprod
0
54
Other Decks in Programming
See All in Programming
「とりあえず動く」コードはよい、「読みやすい」コードはもっとよい / Code that 'just works' is good, but code that is 'readable' is even better.
mkmk884
6
1.4k
どうして手を動かすよりもチーム内のコードレビューを優先するべきなのか
okashoi
3
870
見えないメモリを観測する: PHP 8.4 `pg_result_memory_size()` とSQL結果のメモリ管理
kentaroutakeda
0
930
php-conference-japan-2024
tasuku43
0
430
混沌とした例外処理とエラー監視に秩序をもたらす
morihirok
13
2.2k
HTML/CSS超絶浅い説明
yuki0329
0
190
生成AIでGitHubソースコード取得して仕様書を作成
shukob
0
630
週次リリースを実現するための グローバルアプリ開発
tera_ny
1
1.2k
各クラウドサービスにおける.NETの対応と見解
ymd65536
0
250
ISUCON14感想戦で85万点まで頑張ってみた
ponyo877
1
590
盆栽転じて家具となる / Bonsai and Furnitures
aereal
0
1.8k
Azure AI Foundryのご紹介
qt_luigi
1
190
Featured
See All Featured
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
120k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Practical Orchestrator
shlominoach
186
10k
YesSQL, Process and Tooling at Scale
rocio
170
14k
Rails Girls Zürich Keynote
gr2m
94
13k
4 Signs Your Business is Dying
shpigford
182
22k
A designer walks into a library…
pauljervisheath
205
24k
Raft: Consensus for Rubyists
vanstee
137
6.7k
Keith and Marios Guide to Fast Websites
keithpitt
410
22k
How to Ace a Technical Interview
jacobian
276
23k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
27
1.5k
Unsuck your backbone
ammeep
669
57k
Transcript
MAKE TASK RUNNER GREAT AGAIN @GillesRoustan
BASH PHING COMPOSER ROBO BLDR GRUMPHP NPM GULP GRUNT... @GillesRoustan
None
MAKE ONE TOOL TO RULE THEM ALL @GillesRoustan
INDEPENDANT
HOW-TO ? @GillesRoustan
# Makefile target:[prerequisites] [recipe]
# Makefile target:[prerequisites] \t [recipe]
$ make target
MAKE IS NOT A TASK RUNNER
file.o: file.c gcc file.c -o file.o
.PHONY: install install: file.o file.o: file.c gcc file.c -o file.o
$ make install gcc file.c -o file.o ...
$ make install Rien à faire pour la règle ...
MAKE ME UP, BEFORE YOU GO GO @GillesRoustan
vendor: composer.lock composer install composer.lock: composer.json composer update
.PHONY: install install: vendor [...]
$ make install composer install ...
$ make --always-make install composer update ...
.PHONY: install update update: $(MAKE) --always-make install install: vendor
MAKE CONFIGURATION @GillesRoustan
ENV = dev
ENV ?= dev
ENV ?= dev vendor: composer.lock ifeq ($(ENV), prod) composer install
--no-dev --optimize-autoloader else composer install endif
$ make install composer install ...
$ make install ENV=prod composer install --no-dev --optimize-autoloader ...
GREATER ? @GillesRoustan
ENV ?= dev COMPOSER_ARGS ?= ifeq ($(ENV), prod) COMPOSER_ARGS= --no-dev
--optimize-autoloader endif vendor: composer.lock composer install $(COMPOSER_ARGS)
INCLUDE EH MAKE, ELLE EST OÙ MA CAISSE ? @GillesRoustan
include *.mk
include .env
https://github.com/symfony/dotenv
.env: @if [ ! -e .env ]; then \ cp
env.dist .env; \ fi include .env
MAKE CONTINOUS INTEGRATION GREAT AGAIN @GillesRoustan
test-unit: install vendor/bin/phpunit $(PHPUNIT_ARGS)
# .travis.yml sudo: required services: - docker script: - make
test-unit
MAKE IT WITH DOCKER @GillesRoustan
test-unit: install docker exec -it my-container vendor/bin/phpunit
EXEC=docker exec -it my-container test-unit: install $(EXEC) vendor/bin/phpunit
MAKE FUNCTIONS ? @GillesRoustan
test-unit: install $(call execute, vendor/bin/phpunit) define execute docker exec -it
my-container $(1) @echo $(1) >> make.log endef
DOCKER EST UN ENVIRONNEMENT
# .env ENV=dev DOCKER=true
ifeq ($(DOCKER), true) define execute docker exec -it my-container $(1)
endef else define execute $(1) endef endif
clean: $(call execute, \ chmod -R 0777 var && \
rm -Rf var/cache/prod && \ rm -Rf var/cache/dev \ )
MAKE MONO-REPOSITORY @GillesRoustan
.PHONY: install install: $(MAKE) --directory=app-php install
.PHONY: install install: $(MAKE) -directory=app-php install $(MAKE) -directory=app-js install $(MAKE)
-C app-ologies install $(MAKE) -C app-artement install $(MAKE) -C app-toum install $(MAKE) -C app-app-app install
.PHONY: install install: $(MAKE) -directory=app-php install $(MAKE) -directory=app-js install $(MAKE)
-C app-ologies install $(MAKE) -C app-artement install $(MAKE) -C app-toum install $(MAKE) -C app-app-app install
MAKE MONO-REPOSITORY EASY ! @GillesRoustan
DIRS:=$(dir $(wildcard */)) .PHONY: install $(DIRS) install: $(DIRS) test-unit: $(DIRS)
$(DIRS): $(MAKE) --directory=$@ $(MAKECMDGOALS)
MAKE I HELP YOU ? @GillesRoustan
help: ## This help @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(TARGETS) |
sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
help: ## This help @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(TARGETS) |
sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' https://marmelab.com/blog/2016/02/29/au to-documented-makefile.html
$ make help install Install app undate Update app test-unit
Unit test app minify Minify js/css serve Run server ...
ADOPTE UN MAKE
https://github.com/gbprod/conf-makefile
THANK YOU QUESTIONS ?