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>
15 lines
467 B
Makefile
15 lines
467 B
Makefile
.phony: test-all test-changed update-tests
|
|
|
|
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 \;
|