aboutsummaryrefslogtreecommitdiffstats
path: root/test/plugin_hex.mk
diff options
context:
space:
mode:
Diffstat (limited to 'test/plugin_hex.mk')
-rw-r--r--test/plugin_hex.mk48
1 files changed, 41 insertions, 7 deletions
diff --git a/test/plugin_hex.mk b/test/plugin_hex.mk
index 66bf6fc..27060b6 100644
--- a/test/plugin_hex.mk
+++ b/test/plugin_hex.mk
@@ -4,11 +4,11 @@
# be started and available on port 4000, and the HEX=1 variable
# must be set.
-HEX_TARGETS = $(call list_targets,hex)
+hex_TARGETS = $(call list_targets,hex)
-.PHONY: hex $(HEX_TARGETS)
+.PHONY: hex $(hex_TARGETS)
-hex: $(HEX_TARGETS)
+hex: $(hex_TARGETS)
ifeq ($(shell netcat -z localhost 4000 && echo ok),ok)
hex-user-create: init
@@ -140,7 +140,7 @@ hex-tarball-create-with-deps: init
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
$i "Add Cowlib to the list of dependencies"
- $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\ndep_cowlib_commit = 2.10.1\n"}' $(APP)/Makefile
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\ndep_cowlib_commit = 2.13.0\n"}' $(APP)/Makefile
ifdef LEGACY
$i "Add Cowlib to the applications key in the .app.src file"
@@ -159,7 +159,37 @@ endif
{_, [{<<\"cowlib\">>, Cowlib}]} = lists:keyfind(<<\"requirements\">>, 1, Metadata), \
{_, <<\"cowlib\">>} = lists:keyfind(<<\"app\">>, 1, Cowlib), \
{_, false} = lists:keyfind(<<\"optional\">>, 1, Cowlib), \
- {_, <<\"2.10.1\">>} = lists:keyfind(<<\"requirement\">>, 1, Cowlib), \
+ {_, <<\"2.13.0\">>} = lists:keyfind(<<\"requirement\">>, 1, Cowlib), \
+ halt(0)"
+
+hex-tarball-create-with-req: init
+
+ $i "Bootstrap a new OTP application named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
+
+ $i "Add Cowlib to the list of dependencies"
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\ndep_cowlib_commit = 2.13.0\nhex_req_cowlib = ~> 2.13\n"}' $(APP)/Makefile
+
+ifdef LEGACY
+ $i "Add Cowlib to the applications key in the .app.src file"
+ $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowlib,\n"}' $(APP)/src/$(APP).app.src
+endif
+
+ $i "Create a release tarball"
+ $t $(MAKE) -C $(APP) hex-tarball-create $v
+
+ $i "Confirm the tarball contents can be extracted"
+ $t cd $(APP)/.erlang.mk/ && tar xf $(APP).tar
+
+ $i "Confirm the tarball contains a metadata.config file that lists Cowlib as requirement"
+ $t $(ERL) -eval " \
+ {ok, Metadata} = file:consult(\"$(APP)/.erlang.mk/metadata.config\"), \
+ {_, [{<<\"cowlib\">>, Cowlib}]} = lists:keyfind(<<\"requirements\">>, 1, Metadata), \
+ {_, <<\"cowlib\">>} = lists:keyfind(<<\"app\">>, 1, Cowlib), \
+ {_, false} = lists:keyfind(<<\"optional\">>, 1, Cowlib), \
+ {_, <<\"~> 2.13\">>} = lists:keyfind(<<\"requirement\">>, 1, Cowlib), \
halt(0)"
hex-release-publish: init
@@ -187,6 +217,8 @@ hex-release-publish: init
$i "Check that the release exists"
$t curl -sf http://localhost:4000/api/packages/$(APP)/releases/0.1.0 >/dev/null
+# @todo There's a weird ci.erlang.mk related bug with CACHE_DEPS. Fix it.
+ifndef CACHE_DEPS
hex-release-publish-with-deps: init
$i "Bootstrap a new OTP application named $(APP)"
@@ -195,7 +227,7 @@ hex-release-publish-with-deps: init
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
$i "Add Cowlib to the list of dependencies"
- $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\ndep_cowlib_commit = 2.10.1\n"}' $(APP)/Makefile
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\ndep_cowlib_commit = 2.13.0\n"}' $(APP)/Makefile
ifdef LEGACY
$i "Add Cowlib to the applications key in the .app.src file"
@@ -221,13 +253,15 @@ endif
$t $(MAKE) -C $(APP) hex-key-add HEX_USERNAME=$(APP) HEX_PASSWORD="1234567" | grep ^Secret: | cut -f2 -d" " > $(APP)/hex.key
$i "Publish the Cowlib release"
- $t $(MAKE) -C $(APP)/deps/cowlib hex-release-publish HEX_SECRET=`cat $(APP)/hex.key` $v
+ $t cp ../erlang.mk $(APP)/deps/cowlib
+ $t $(MAKE) -C $(APP)/deps/cowlib hex-release-publish DEPS_DIR=$(APP)/deps ERLANG_MK_TMP=$(APP)/.erlang.mk HEX_SECRET=`cat $(APP)/hex.key` $v
$i "Publish the release"
$t $(MAKE) -C $(APP) hex-release-publish HEX_SECRET=`cat $(APP)/hex.key` $v
$i "Check that the release exists and includes Cowlib as requirement"
$t curl -sf http://localhost:4000/api/packages/$(APP)/releases/0.1.0 | grep -q cowlib
+endif
hex-release-replace: init