support for github workflow steps
[m6w6/pecl-ci] / Makefile
index e0e3a6b836f7e20b9a5d9fa07c74e5eb4b618f99..e417b5201909e901a6251fbb56d8c27389153bb1 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,26 +1,27 @@
 export
 
-PHP ?= 7.3
+<<<<<<< HEAD
+PHP ?= 7.4
+=======
+PHP ?= 8.0
+>>>>>>> 3cab5c6 (support for github workflow steps)
 JOBS ?= 2
 PHP_MIRROR ?= https://php.net/distributions/
 TMPDIR ?= /tmp
 
-makdir := $(dir $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)))
+mkfile := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
+makdir := $(dir $(mkfile))
 
-ifdef TRAVIS
-prefix ?= $(HOME)/cache/php-$(PHP)-$(shell env |grep -E '^with_|^enable_' | tr -c '[a-zA-Z_]' -)
-else
-prefix ?= $(TMPDIR)/php-$(PHP)-$(shell env |grep -E '^with_|^enable_' | tr -c '[a-zA-Z_]' -)
+ifeq (,$(findstring printenv,$(MAKECMDGOALS)))
+mkargs := $(shell $(MAKE) -f $(mkfile) printenv | sed -n -e 's,with_,,gp' -e 's,enable_,,gp' | tr -c '[a-zA-Z_]' -)
 endif
+
+prefix ?= $(TMPDIR)/php-$(PHP)-$(mkargs)
 exec_prefix ?= $(prefix)
 bindir = $(exec_prefix)/bin
-srcdir := $(prefix)/src
-ifdef TRAVIS_BUILD_DIR
-curdir ?= $(TRAVIS_BUILD_DIR)
-else
+srcdir = $(prefix)/src
 # CURDIR is a make builtin
 curdir ?= $(CURDIR)
-endif
 
 enable_maintainer_zts ?= no
 enable_debug ?= no
@@ -56,12 +57,19 @@ CPPCHECK_ARGS ?= -v -j $(JOBS) --std=$(CPPCHECK_STD) --enable=$(CPPCHECK_ENABLE)
 .PHONY: all
 all: php
 
+.PHONY: printenv
+printenv:
+       @env | grep -E 'prefix=|dir=' | grep -v config_file_scan_dir | sort
+       @env | grep -E '^PHP|^PECL' | sort
+       @env | grep -E '^with_|^enable_' | grep -Ev 'php_config|config_file_scan_dir' | sort
+
 .PHONY: versions
 versions: $(PHP_RELEASES)
        grep "^$(PHP)" $< | cut -f1-2
 
 $(PHP_RELEASES): $(makdir)/php-version-url-dist.php $(makdir)/php-version-url-qa.php | $(srcdir)
        cd $(makdir) && printf "master\tmaster\t%s/fetch-master.sh\n" $$(pwd) >$@
+       curl -sSL "https://php.net/releases/index.php?json&version=8&max=-1" | $(makdir)/php-version-url-dist.php >>$@
        curl -sSL "https://php.net/releases/index.php?json&version=7&max=-1" | $(makdir)/php-version-url-dist.php >>$@
        curl -sSL "https://php.net/releases/index.php?json&version=5&max=-1" | $(makdir)/php-version-url-dist.php >>$@
        curl -sSL "https://qa.php.net/api.php?type=qa-releases&format=json"  | $(makdir)/php-version-url-qa.php   >>$@
@@ -111,7 +119,7 @@ $(srcdir) $(extdir) $(with_config_file_scan_dir):
 .PHONY: pecl-check
 pecl-check:
        @if test -z "$(PECL)"; then echo "No pecl extension specified, e.g. PECL=pecl_http:http"; exit 1; fi
-       if test -d $(PECL_DIR)/.git; then cd $(PECL_DIR)/; git pull; fi
+       if test -d $(PECL_DIR)/.git; then cd $(PECL_DIR)/; git pull || test -z "$$CI"; fi
 
 .PHONY: pecl-clean
 pecl-clean:
@@ -130,8 +138,7 @@ $(PECL_DIR)/config.m4:
                        cd $(PECL_DIR); \
                        git pull; \
                else \
-                       git clone -b $(PECL_VERSION) \
-                               $$(dirname $$(git remote get-url $$(git remote)))/$(PECL_EXTENSION) $(PECL_DIR); \
+                       git clone https://github.com/$(PECL_EXTENSION) $(PECL_DIR); \
                fi; \
        else \
                mkdir -p $(PECL_DIR); \
@@ -166,9 +173,14 @@ ext: pecl-check pecl
        $(makdir)/check-packagexml.php package.xml
 
 .PHONY: test
+test: TESTS ?= tests
 test: php
-       REPORT_EXIT_STATUS=1 $(bindir)/php run-tests.php -q -p $(bindir)/php --set-timeout 300 --show-diff tests
-
+       REPORT_EXIT_STATUS=1 $(bindir)/php run-tests.php -q -p $(bindir)/php --set-timeout 300 --show-diff $(TESTS)
+.PHONY: pecl-test
+pecl-test: TESTS ?= $(PECL_DIR)/tests
+pecl-test: php
+       REPORT_EXIT_STATUS=1 $(bindir)/php $(prefix)/lib/php/build/run-tests.php -q -p $(bindir)/php --set-timeout 300 --show-diff $(TESTS)
+       
 pharext/%: $(PECL_INI) php | $(srcdir)/../%.ext.phar
        for phar in $|; do $(bindir)/php $$phar --prefix=$(prefix) --ini=$(PECL_INI); done