Allow testing for just examples with changed files.
The full test suite takes a long time to test. Generally changes in this repo only will change one project. So lets find the directories with changes and only test those. By default we will compare against origin/master which should cover testing PRs. If you're doing development and want to test your current changes you could do: BASE_REF=HEAD make test-changed Or if you're testing against your fork: BASE_REF=myremote/branch make test-changed Signed-off-by: Chad Metcalf <chad@docker.com>
This commit is contained in:
parent
d8a95fadd8
commit
e059c77a47
13
Makefile
13
Makefile
@ -1,7 +1,14 @@
|
||||
.phony: test
|
||||
.phony: test-all test-changed update-tests
|
||||
|
||||
test:
|
||||
@bats -T -r .
|
||||
BASE_REF ?= origin/master
|
||||
|
||||
all: test-changed
|
||||
|
||||
test-all:
|
||||
@bats -T $(shell find . -name test.bats| sort )
|
||||
|
||||
test-changed:
|
||||
@bats -T $(shell git diff --name-status ${BASE_REF} | awk '{print $2}' | xargs dirname | uniq | grep -v -E '^(\.|lib)' | xargs -I% echo -n " %/test.bats" )
|
||||
|
||||
update-tests:
|
||||
@find . -maxdepth 1 -type d -not -path '*/\.*' -not -path '.' -not -path './lib' -exec cp ./lib/test.bats.example {}/test.bats \;
|
||||
|
Loading…
Reference in New Issue
Block a user