mirror of
https://github.com/yldio/copilot.git
synced 2024-11-10 21:30:06 +02:00
docker: only build dockerfile's on changes
This commit is contained in:
parent
a44c7c0bf8
commit
7581c0df8b
28
Makefile
28
Makefile
@ -4,7 +4,7 @@ check:
|
||||
-@./bin/setup
|
||||
|
||||
SUBDIRS := $(dir $(wildcard */Makefile))
|
||||
TARGETS := install clean test test-ci lint lint-ci build push # whatever else, but must not contain '/'
|
||||
TARGETS := install clean test test-ci lint lint-ci # whatever else, but must not contain '/'
|
||||
|
||||
# foo/.all bar/.all foo/.clean bar/.clean
|
||||
SUBDIRS_TARGETS := \
|
||||
@ -23,3 +23,29 @@ $(TARGETS): %: $(addsuffix %,$(SUBDIRS))
|
||||
# $(@F:.%=%) is just all
|
||||
$(SUBDIRS_TARGETS):
|
||||
$(MAKE) --no-print-directory -C $(@D) $(@F:.%=%)
|
||||
|
||||
DIFF := $(lastword $(subst /, ,${CIRCLE_COMPARE_URL}))
|
||||
CHANGES := $(filter $(dir $(shell git diff --name-only $(DIFF))), $(SUBDIRS))
|
||||
.PHONY: diff
|
||||
diff:
|
||||
echo $(CHANGES)
|
||||
|
||||
BUILDS := build push
|
||||
|
||||
# foo/.all bar/.all foo/.clean bar/.clean
|
||||
BUILDS_TARGETS := \
|
||||
$(foreach t,$(BUILDS),$(addsuffix $t,$(CHANGES)))
|
||||
|
||||
.PHONY: $(BUILDS) $(BUILDS_TARGETS)
|
||||
|
||||
# static pattern rule, expands into:
|
||||
# all clean: %: foo/.% bar/.%
|
||||
$(BUILDS): %: $(addsuffix %,$(CHANGES))
|
||||
@echo 'Done "$*" target'
|
||||
|
||||
# here, for foo/.all:
|
||||
# $(@D) is foo
|
||||
# $(@F) is .all, with leading period
|
||||
# $(@F:.%=%) is just all
|
||||
$(BUILDS_TARGETS):
|
||||
$(MAKE) --no-print-directory -C $(@D) $(@F:.%=%)
|
||||
|
Loading…
Reference in New Issue
Block a user