diff options
author | Loïc Hoguin <[email protected]> | 2015-05-08 22:38:54 +0300 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2015-05-08 22:38:54 +0300 |
commit | a4a03683e0c6f6196121ad285796702825089300 (patch) | |
tree | 635fa8f4234d8ce4ac955e7d60fc27864a2301ae | |
parent | ae91cfe710341b74403c55962eaa063d60ef2a25 (diff) | |
download | erlang.mk-a4a03683e0c6f6196121ad285796702825089300.tar.gz erlang.mk-a4a03683e0c6f6196121ad285796702825089300.tar.bz2 erlang.mk-a4a03683e0c6f6196121ad285796702825089300.zip |
Add ci plugin
The ci plugin allows testing your Erlang project across
any number of Erlang versions.
-rw-r--r-- | build.config | 1 | ||||
-rw-r--r-- | plugins/ci.mk | 65 |
2 files changed, 66 insertions, 0 deletions
diff --git a/build.config b/build.config index c49f40f..d4b22db 100644 --- a/build.config +++ b/build.config @@ -14,6 +14,7 @@ core/test plugins/asciidoc plugins/bootstrap plugins/c_src +plugins/ci plugins/ct plugins/dialyzer plugins/edoc diff --git a/plugins/ci.mk b/plugins/ci.mk new file mode 100644 index 0000000..e5df48e --- /dev/null +++ b/plugins/ci.mk @@ -0,0 +1,65 @@ +# Copyright (c) 2015, Loïc Hoguin <[email protected]> +# This file is part of erlang.mk and subject to the terms of the ISC License. + +.PHONY: ci ci-setup distclean-kerl + +KERL ?= $(CURDIR)/kerl +export KERL + +KERL_URL ?= https://raw.githubusercontent.com/yrashk/kerl/master/kerl + +OTP_GIT ?= https://github.com/erlang/otp + +CI_INSTALL_DIR ?= $(HOME)/erlang +CI_OTP ?= + +ifeq ($(strip $(CI_OTP)),) +ci:: +else +ci:: $(KERL) $(addprefix ci-,$(CI_OTP)) + +ci-setup:: + +ci_verbose_0 = @echo " CI " $(1); +ci_verbose = $(ci_verbose_$(V)) + +define ci_target +ci-$(1): $(CI_INSTALL_DIR)/$(1) + -$(ci_verbose) \ + PATH="$(CI_INSTALL_DIR)/$(1)/bin:$(PATH)" \ + CI_OTP_RELEASE="$(1)" \ + CT_OPTS="-label $(1)" \ + $(MAKE) clean ci-setup tests +endef + +$(foreach otp,$(CI_OTP),$(eval $(call ci_target,$(otp)))) + +define ci_otp_target +$(CI_INSTALL_DIR)/$(1): + $(KERL) build git $(OTP_GIT) $(1) $(1) + $(KERL) install $(1) $(CI_INSTALL_DIR)/$(1) +endef + +$(foreach otp,$(CI_OTP),$(eval $(call ci_otp_target,$(otp)))) + +define kerl_fetch + $(call core_http_get,$(KERL),$(KERL_URL)) + chmod +x $(KERL) +endef + +$(KERL): + @$(call kerl_fetch) + +help:: + @printf "%s\n" "" \ + "Continuous Integration targets:" \ + " ci Run 'make tests' on all configured Erlang versions." \ + "" \ + "The CI_OTP variable must be defined with the Erlang versions" \ + "that must be tested. For example: CI_OTP = OTP-17.3.4 OTP-17.5.3" + +distclean:: distclean-kerl + +distclean-kerl: + $(gen_verbose) rm -rf $(KERL) +endif |