diff --git a/.travis.yml b/.travis.yml index 7448e41..61e67ca 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,7 @@ -sudo: required - -services: - - docker - -install: - - make build-all - -script: - - make version +language: ruby +os: linux +dist: bionic +services: docker +install: make build-all +before_script: sudo apt-get install -y ldap-utils openssl jq +script: make test-all diff --git a/CHANGELOG.md b/CHANGELOG.md index f98edbf..d3bdde7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - [acme](src/acme) Added module providing Let's encrypt TLS certificates using ACME. - [acme](src/acme) Fixed ACME module shell (ash and bash) portability. - [test](test/Makefile) Arrange build tests. +- [travis-ci](.travis.yml) Travis CI now run test-all. # 1.2.2 diff --git a/Makefile b/Makefile index 1399aac..8f1d26f 100644 --- a/Makefile +++ b/Makefile @@ -5,17 +5,16 @@ BLD_ARG ?= BLD_REPO ?= mlan/kopano BLD_VER ?= latest BLD_TGT ?= full -SRC_VER ?= $(shell src/kopano/bin/kopano-webaddr.sh -VV) - -_version = $(if $(findstring $(BLD_TGT),$(1)),$(2),$(if $(findstring latest,$(2)),$(1),$(1)-$(2))) - -.PHONY: - -variables: - make -pn | grep -A1 "^# makefile"| grep -v "^#\|^--" | sort | uniq - -ps: - docker ps -a +SRC_CMD ?= src/kopano/bin/kopano-webaddr.sh -VV +SRC_VER ?= $(shell $(SRC_CMD)) +IMG_REPO ?= $(BLD_REPO) +IMG_VER ?= $(BLD_VER) +TST_ENV ?= -C test +TST_TGTE ?= $(addprefix test-,all diff down env htop imap lmtp logs mail pop3 sh sv up) +TST_TGTI ?= test_% test-up_% +_version = $(if $(findstring $(BLD_TGT),$(1)),\ +$(if $(findstring latest,$(2)),latest $(1) $(SRC_VER) $(1)-$(SRC_VER),$(2) $(1)-$(2)),\ +$(if $(findstring latest,$(2)),$(1) $(1)-$(SRC_VER),$(1)-$(2))) build-all: build_core build_full @@ -23,14 +22,25 @@ build: build_$(BLD_TGT) build_%: Dockerfile docker build $(BLD_ARG) --target $* \ - -t $(BLD_REPO):$(call _version,$*,$(BLD_VER)) \ - -t $(BLD_REPO):$(call _version,$*,$(SRC_VER)) . + $(addprefix --tag $(BLD_REPO):,$(call _version,$*,$(BLD_VER))) . version: - src/kopano/bin/kopano-webaddr.sh -VV + $(SRC_CMD) + +variables: + make -pn | grep -A1 "^# makefile"| grep -v "^#\|^--" | sort | uniq + +ps: + docker ps -a prune: docker image prune clean: docker images | grep $(BLD_REPO) | awk '{print $$1 ":" $$2}' | uniq | xargs docker rmi + +$(TST_TGTE): + ${MAKE} $(TST_ENV) $@ + +$(TST_TGTI): + ${MAKE} $(TST_ENV) $@ diff --git a/test/Makefile b/test/Makefile index c30355a..4de5aa9 100644 --- a/test/Makefile +++ b/test/Makefile @@ -91,8 +91,9 @@ test-all: test-up_0 test_1 test_%: test-up_% test-waitl_% test-logs_% test-mail_% test-down_% +test-up: test-up_1 -test-up_0: +test-up_0: test-up-net # # # test (0) run without envvars (is there smoke?) @@ -215,7 +216,7 @@ test-logs: test-sh: docker exec -it $(APP_NAME) sh -c 'exec $$(getent passwd root | sed "s/.*://g")' -test-diff-srv: +test-diff: docker container diff $(APP_NAME) test-sv: