chore: various tweaks to support running tests in the CI

This commit is contained in:
Adam Cooke
2021-07-26 17:40:56 +00:00
parent 9288d642b9
commit c09ab62d0c
21 changed files with 334 additions and 103 deletions
+18
View File
@@ -96,3 +96,21 @@ ifneq ($(DOCKER_TAG_VERSION),)
"$(DOCKER_IMAGE):$(DOCKER_TAG_VERSION)" && \
docker push "$(DOCKER_IMAGE):$(DOCKER_TAG_VERSION)"
endif
# ==============================================================================
# Tests
# ==============================================================================
.PHONY: ci-test
ci-test: docker-ci-build
$(eval IMAGE := $(shell $(DOCKER_CI_BUILD_CMD) -q))
$(eval RAND := $(shell echo "$${RANDOM}$$(date +%s)"))
POSTAL_IMAGE=$(IMAGE) \
docker-compose -p "postal$(RAND)" run --rm postal sh -c 'bundle exec rspec'; \
EXIT_CODE=$$?; \
docker-compose -p "postal$(RAND)" down -v; \
exit $$EXIT_CODE
.PHONY: test
test:
bundle exec rspec