From 6e96044496a31ef4ef426068056027a8cb981f63 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Thu, 9 Sep 2021 21:39:05 +0100 Subject: [PATCH 01/10] Review workflow --- .github/workflows/build-and-deploy.yml | 43 ++++++++++++-------------- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index 492de49..9240aac 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -18,23 +18,31 @@ jobs: "debian/stretch", "debian/buster", "el/7" ] - php: [7.3, 7.4] - branch: ["v4.1.2"] - packagecloud_repo: ["stable-41"] + php: [7.3, 7.4, 8.0] + branch: ["v4.1.2", "v5.0.0alpha5"] + packagecloud_repo: ["stable-41", "nightly-50"] exclude: - os_dist: "ubuntu/trusty" php: 7.4 + - os_dist: "ubuntu/trusty" + php: 8.0 + + - branch: "v4.1.2" + php: 8.0 + packagecloud_repo: "nightly-50" + + - branch: "v5.0.0alpha5" + php: 7.3 + packagecloud_repo: "stable-41" + runs-on: ubuntu-18.04 # continue-on-error: ${{ matrix.experimental }} name: ${{ matrix.os_dist }} - PHP${{ matrix.php }} with ${{ matrix.branch }} env: -# OS: ${{ matrix.os }} -# DIST: ${{ matrix.dist }} -# PACKAGE: ${{ matrix.package }} CLONE_BRANCH: ${{ matrix.branch }} PHP_VERSION: ${{ matrix.php }} PACKAGECLOUD_REPO: ${{ matrix.packagecloud_repo }} @@ -76,22 +84,6 @@ jobs: with: fetch-depth: 1 - # Setup PHP -# - name: Setup cache environment -# id: extcache -# uses: shivammathur/cache-extensions@v1 -# with: -# php-version: ${{ matrix.php }} -# extensions: ${{ env.PHP_EXTENSIONS }} -# key: "phalcon-packagecloud-v1" - -# - name: Cache extensions -# uses: actions/cache@v2 -# with: -# path: ${{ steps.extcache.outputs.dir }} -# key: ${{ steps.extcache.outputs.key }} -# restore-keys: ${{ steps.extcache.outputs.key }} - - name: Setup PHP uses: shivammathur/setup-php@v2 with: @@ -128,7 +120,6 @@ jobs: - name: Clone cphalcon uses: actions/checkout@v2 with: - fetch-depth: 1 repository: phalcon/cphalcon ref: ${{ env.CLONE_BRANCH }} path: cphalcon @@ -145,6 +136,12 @@ jobs: - run: ls -la build/ + - name: Upload Artifact + uses: actions/upload-artifact@v2 + with: + name: ${{ OS }}-${{ DIST }}-php-${{ matrix.php }}-${{ matrix.branch }}.zip + path: build/ + - name: Push package to phalcon/${{ matrix.packagecloud_repo }}/${{ matrix.os_dist }} if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') run: | From a2cd49555a93126d3007fef7cb6cbf84727217a2 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Thu, 9 Sep 2021 21:45:49 +0100 Subject: [PATCH 02/10] Review workflow --- .github/workflows/build-and-deploy.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index 9240aac..bbb75bc 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -21,6 +21,8 @@ jobs: php: [7.3, 7.4, 8.0] branch: ["v4.1.2", "v5.0.0alpha5"] packagecloud_repo: ["stable-41", "nightly-50"] + zephir_parser_version: ["v1.3.8"] + zephir_version: ["0.12.21", "0.14.0-beta.3"] exclude: - os_dist: "ubuntu/trusty" @@ -32,10 +34,12 @@ jobs: - branch: "v4.1.2" php: 8.0 packagecloud_repo: "nightly-50" + zephir_version: "0.14.0-beta.3" - branch: "v5.0.0alpha5" php: 7.3 packagecloud_repo: "stable-41" + zephir_version: "0.12.21" runs-on: ubuntu-18.04 # continue-on-error: ${{ matrix.experimental }} @@ -63,8 +67,8 @@ jobs: # To build 4.x branch use # ZEPHIR_VERSION >= 0.11.0 (for example 0.12.15) # ZEPHIR_PARSER_VERSION >= v1.2.x (for example v1.3.3) - ZEPHIR_VERSION: "0.12.21" - ZEPHIR_PARSER_VERSION: "v1.3.6" +# ZEPHIR_VERSION: "0.12.21" +# ZEPHIR_PARSER_VERSION: "v1.3.6" ZEND_BACKEND: "--backend=ZendEngine3" STABLE_BUILD_VERSION: "1" @@ -96,6 +100,9 @@ jobs: echo "OS=${os_dist[0]}" >> $GITHUB_ENV echo "DIST=${os_dist[1]}" >> $GITHUB_ENV + echo "ZEPHIR_VERSION=${{ matrix.zephir_version }}" >> $GITHUB_ENV + echo "ZEPHIR_PARSER_VERSION=${{ matrix.zephir_parser_version }}" >> $GITHUB_ENV + echo "MAINLINE_BUILD_VERSION=${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV echo "NIGHTLY_BUILD_VERSION=${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV echo "SOURCEDIR=${GITHUB_WORKSPACE}/cphalcon" >> $GITHUB_ENV @@ -139,7 +146,7 @@ jobs: - name: Upload Artifact uses: actions/upload-artifact@v2 with: - name: ${{ OS }}-${{ DIST }}-php-${{ matrix.php }}-${{ matrix.branch }}.zip + name: ${OS}-${DIST}-php-${{ matrix.php }}-${{ matrix.branch }}.zip path: build/ - name: Push package to phalcon/${{ matrix.packagecloud_repo }}/${{ matrix.os_dist }} From 569cf5fe95d03ea6363910852d57cc9d0437d2aa Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Thu, 9 Sep 2021 21:48:49 +0100 Subject: [PATCH 03/10] Update matrix --- .github/workflows/build-and-deploy.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index bbb75bc..2734e89 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -33,12 +33,20 @@ jobs: - branch: "v4.1.2" php: 8.0 + + - branch: "v5.0.0alpha5" + php: 7.3 + + - branch: "v4.1.2" packagecloud_repo: "nightly-50" + + - branch: "v4.1.2" zephir_version: "0.14.0-beta.3" - branch: "v5.0.0alpha5" - php: 7.3 packagecloud_repo: "stable-41" + + - branch: "v5.0.0alpha5" zephir_version: "0.12.21" runs-on: ubuntu-18.04 From cc6b3ccbcf6b65bfd415bb205abfadf512855610 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Thu, 9 Sep 2021 21:54:15 +0100 Subject: [PATCH 04/10] Add support for "8.0" --- ci/prepare-debian.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/prepare-debian.sh b/ci/prepare-debian.sh index 5c0db06..ec6a020 100755 --- a/ci/prepare-debian.sh +++ b/ci/prepare-debian.sh @@ -30,7 +30,7 @@ case "$PHP_VERSION" in cp debian/postinsts/legacy debian/php5-phalcon.postinst cp debian/preinsts/legacy debian/php5-phalcon.preinst ;; -"7.0" | "7.1"| "7.2" | "7.3" | "7.4") +"7.0" | "7.1"| "7.2" | "7.3" | "7.4" | "8.0") cp "debian/controls/php-${PHP_VERSION}" debian/control cp "debian/postinsts/php-${PHP_VERSION}" "debian/php${PHP_VERSION}-phalcon.postinst" cp "debian/preinsts/php-${PHP_VERSION}" "debian/php${PHP_VERSION}-phalcon.preinst" From cf98df9f5cd2b341417db4fcdbc1517213cf7813 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Thu, 9 Sep 2021 21:57:29 +0100 Subject: [PATCH 05/10] Add php-8.0 in debian/ folder --- debian/controls/php-8.0 | 35 +++++++++++++++++++++++++++++++++++ debian/postinsts/php-8.0 | 33 +++++++++++++++++++++++++++++++++ debian/preinsts/php-8.0 | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 106 insertions(+) create mode 100644 debian/controls/php-8.0 create mode 100644 debian/postinsts/php-8.0 create mode 100644 debian/preinsts/php-8.0 diff --git a/debian/controls/php-8.0 b/debian/controls/php-8.0 new file mode 100644 index 0000000..71d5de2 --- /dev/null +++ b/debian/controls/php-8.0 @@ -0,0 +1,35 @@ +Source: php-phalcon +Section: php +Priority: optional +Maintainer: Serghei Iakovlev +Build-Depends: debhelper (>= 9), dpkg-dev (>= 1.16.1~), build-essential, re2c, php8.0-dev, php8.0-json, libpcre3-dev +Standards-Version: 3.9.7 +Vcs-Git: git://github.com/phalcon/cphalcon.git +Vcs-Browser: https://github.com/phalcon/cphalcon + +Package: php8.0-phalcon +Architecture: any +Priority: optional +Pre-Depends: dpkg (>= 1.15.7.2) +Depends: ucf, ${shlibs:Depends}, ${php:Depends}, ${misc:Depends}, php8.0-psr +Suggests: php8.0-mysql, php8.0-sqlite3, php8.0-pgsql, php8.0-memcached +Description: High performance PHP framework + Phalcon is an open source web framework delivered as a C extension for + the PHP language providing high performance and lower resource consumption. + . + This package provides the Phalcon PHP extension. + +Package: php8.0-phalcon-dbgsym +Depends: ucf, ${misc:Depends}, php8.0-phalcon (= ${binary:Version}) +Recommends: gdb +Replaces: php8.0-phalcon-dbg (<< 3.1.0) +Suggests: php8.0-common-dbgsym +Section: debug +Priority: extra +Architecture: any +Description: Debug symbols for php8.0-phalcon + Phalcon is an open source web framework delivered as a C extension for + the PHP language providing high performance and lower resource consumption. + . + This package provides the debug symbols for Phalcon PHP extension + needed for properly debugging errors with gdb. diff --git a/debian/postinsts/php-8.0 b/debian/postinsts/php-8.0 new file mode 100644 index 0000000..ec93466 --- /dev/null +++ b/debian/postinsts/php-8.0 @@ -0,0 +1,33 @@ +#!/bin/bash + +set -e + +#EXTRA# + +if [ "$1" = "configure" ]; then + # Install the new versioned configuration + inidir=/etc/php/8.0/mods-available + + if [ -e /usr/lib/php/php-maintscript-helper ] ; then + . /usr/lib/php/php-maintscript-helper + + # Register new conffile with UCF + ucf /usr/share/php8.0-phalcon/phalcon/phalcon.ini ${inidir}/phalcon.ini + ucfr --force php8.0-phalcon ${inidir}/phalcon.ini + + if [ -f "${inidir}/phalcon.ini.dpkg-new" ]; then + md5sum="$(md5sum ${inidir}/phalcon.ini.dpkg-new | sed -e 's/ .*//')" + old_md5sum="$(md5sum ${inidir}/phalcon.ini | sed -e 's/ .*//')" + + if [ "$md5sum" = "$old_md5sum" ]; then + mv "${inidir}/phalcon.ini.dpkg-new" "${inidir}/phalcon.ini" + fi + fi + + php_invoke enmod 8.0 ALL phalcon + fi +fi + +#DEBHELPER# + +exit 0 diff --git a/debian/preinsts/php-8.0 b/debian/preinsts/php-8.0 new file mode 100644 index 0000000..a716b2d --- /dev/null +++ b/debian/preinsts/php-8.0 @@ -0,0 +1,38 @@ +#!/bin/bash + +set -e + +#EXTRA# + +if [ "$1" = "upgrade" ]; then + inidir=/etc/php/8.0/mods-available + + # First purge the old unversioned configuration + if [ -e ${inidir}/phalcon.ini ]; then + for ext in '~' '%' .bak .ucf-new .ucf-old .ucf-dist; do + rm -f ${inidir}/phalcon.ini${ext} + done + + rm -f ${inidir}/phalcon.ini + + if which ucf >/dev/null; then + ucf --purge ${inidir}/phalcon.ini >/dev/null || true + fi + + if which ucfr >/dev/null; then + ucfr --force --purge php8.0-phalcon ${inidir}/phalcon.ini >/dev/null || true + fi + fi + + # Cleanup of the old symlinks (including broken symlinks) + find /etc/php/8.0/ -type l | + while read symlink; do + if [ "$(readlink $symlink)" = "${inidir}/phalcon.ini" ]; then + rm -f "${symlink}" + fi + done +fi + +#DEBHELPER# + +exit 0 From b9d3a23c2ba8a271780aa2b99c594ab7feedbf15 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Thu, 9 Sep 2021 22:04:02 +0100 Subject: [PATCH 06/10] Change from float to string --- .github/workflows/build-and-deploy.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index 2734e89..3161e9b 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -18,7 +18,7 @@ jobs: "debian/stretch", "debian/buster", "el/7" ] - php: [7.3, 7.4, 8.0] + php: ["7.3", "7.4", "8.0"] branch: ["v4.1.2", "v5.0.0alpha5"] packagecloud_repo: ["stable-41", "nightly-50"] zephir_parser_version: ["v1.3.8"] @@ -26,16 +26,16 @@ jobs: exclude: - os_dist: "ubuntu/trusty" - php: 7.4 + php: "7.4" - os_dist: "ubuntu/trusty" - php: 8.0 + php: "8.0" - branch: "v4.1.2" - php: 8.0 + php: "8.0" - branch: "v5.0.0alpha5" - php: 7.3 + php: "7.3" - branch: "v4.1.2" packagecloud_repo: "nightly-50" From 0f86d079af9dfeceb8a24dae60b65f90bf84fdc6 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Thu, 9 Sep 2021 22:17:15 +0100 Subject: [PATCH 07/10] Update rules for Phalcon v5 --- debian/rules | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/debian/rules b/debian/rules index a5f550a..ecd655e 100755 --- a/debian/rules +++ b/debian/rules @@ -50,16 +50,30 @@ PHP_API_VERSION=$(shell php-config --phpapi) endif PHALCON_SUBSTVARS=$(PACKAGE).substvars + +ifeq ($(PHP_MAJOR_VERSION),$(filter $(PHP_MAJOR_VERSION),8)) +SOURCEDIR=build/phalcon +else SOURCEDIR=build/php$(PHP_MAJOR_VERSION)/safe +endif + DEB_HOST_ARCH?=$(shell dpkg-architecture -qDEB_HOST_ARCH) ifeq ($(DEB_HOST_ARCH),$(filter $(DEB_HOST_ARCH),i386)) +ifeq ($(PHP_MAJOR_VERSION),$(filter $(PHP_MAJOR_VERSION),8)) +SOURCEDIR=build/phalcon +else SOURCEDIR=build/php$(PHP_MAJOR_VERSION)/32bits endif +endif ifeq ($(DEB_HOST_ARCH),$(filter $(DEB_HOST_ARCH),amd64)) +ifeq ($(PHP_MAJOR_VERSION),$(filter $(PHP_MAJOR_VERSION),8)) +SOURCEDIR=build/phalcon +else SOURCEDIR=build/php$(PHP_MAJOR_VERSION)/64bits endif +endif CFLAGS+=-g3 -fvisibility=hidden -DPHALCON_RELEASE LDFLAGS+=-Wl,--as-needed -Wl,-Bsymbolic-functions From 0e82ab671714a8fe4256650053d6a33f0341008a Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Thu, 9 Sep 2021 22:36:31 +0100 Subject: [PATCH 08/10] Update rules for Phalcon v5 --- debian/rules | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/debian/rules b/debian/rules index ecd655e..915928c 100755 --- a/debian/rules +++ b/debian/rules @@ -51,7 +51,7 @@ endif PHALCON_SUBSTVARS=$(PACKAGE).substvars -ifeq ($(PHP_MAJOR_VERSION),$(filter $(PHP_MAJOR_VERSION),8)) +ifeq ($(VERSION),$(filter $(VERSION),5)) SOURCEDIR=build/phalcon else SOURCEDIR=build/php$(PHP_MAJOR_VERSION)/safe @@ -60,7 +60,7 @@ endif DEB_HOST_ARCH?=$(shell dpkg-architecture -qDEB_HOST_ARCH) ifeq ($(DEB_HOST_ARCH),$(filter $(DEB_HOST_ARCH),i386)) -ifeq ($(PHP_MAJOR_VERSION),$(filter $(PHP_MAJOR_VERSION),8)) +ifeq ($(VERSION),$(filter $(VERSION),5)) SOURCEDIR=build/phalcon else SOURCEDIR=build/php$(PHP_MAJOR_VERSION)/32bits @@ -68,7 +68,7 @@ endif endif ifeq ($(DEB_HOST_ARCH),$(filter $(DEB_HOST_ARCH),amd64)) -ifeq ($(PHP_MAJOR_VERSION),$(filter $(PHP_MAJOR_VERSION),8)) +ifeq ($(VERSION),$(filter $(VERSION),5)) SOURCEDIR=build/phalcon else SOURCEDIR=build/php$(PHP_MAJOR_VERSION)/64bits From 6493944d7b86dee27ee3702b58c95c6082ef6af2 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Thu, 9 Sep 2021 23:50:21 +0100 Subject: [PATCH 09/10] Change build/ directory detection for v5 --- debian/rules | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/debian/rules b/debian/rules index 915928c..ab53876 100755 --- a/debian/rules +++ b/debian/rules @@ -51,29 +51,18 @@ endif PHALCON_SUBSTVARS=$(PACKAGE).substvars -ifeq ($(VERSION),$(filter $(VERSION),5)) -SOURCEDIR=build/phalcon -else SOURCEDIR=build/php$(PHP_MAJOR_VERSION)/safe -endif +SOURCEDIR_V5=build/phalcon DEB_HOST_ARCH?=$(shell dpkg-architecture -qDEB_HOST_ARCH) ifeq ($(DEB_HOST_ARCH),$(filter $(DEB_HOST_ARCH),i386)) -ifeq ($(VERSION),$(filter $(VERSION),5)) -SOURCEDIR=build/phalcon -else SOURCEDIR=build/php$(PHP_MAJOR_VERSION)/32bits endif -endif ifeq ($(DEB_HOST_ARCH),$(filter $(DEB_HOST_ARCH),amd64)) -ifeq ($(VERSION),$(filter $(VERSION),5)) -SOURCEDIR=build/phalcon -else SOURCEDIR=build/php$(PHP_MAJOR_VERSION)/64bits endif -endif CFLAGS+=-g3 -fvisibility=hidden -DPHALCON_RELEASE LDFLAGS+=-Wl,--as-needed -Wl,-Bsymbolic-functions @@ -94,17 +83,17 @@ prepare-files-stamp: touch prepare-files-stamp override_dh_auto_configure: - cd $(SOURCEDIR); \ + [ -d "$(SOURCEDIR_V5)" ] && cd $(SOURCEDIR_V5) || cd $(SOURCEDIR); \ phpize; \ ./configure --enable-phalcon=shared override_dh_auto_build: - $(MAKE) -C $(SOURCEDIR) + [ -d "$(SOURCEDIR_V5)" ] && $(MAKE) -C $(SOURCEDIR_V5) || $(MAKE) -C $(SOURCEDIR) override_dh_auto_clean: dh_auto_clean ( \ - cd $(SOURCEDIR); \ + [ -d "$(SOURCEDIR_V5)" ] && cd $(SOURCEDIR_V5) || cd $(SOURCEDIR); \ [ -f Makefile ] && $(MAKE) distclean; \ phpize --clean; \ rm -f tmp-php.ini; \ @@ -114,7 +103,7 @@ override_dh_installdirs: prepare-files-stamp dh_installdirs override_dh_auto_install: - INSTALL_ROOT=$(BUILD) $(MAKE) -C $(SOURCEDIR) install + [ -d "$(SOURCEDIR_V5)" ] && INSTALL_ROOT=$(BUILD) $(MAKE) -C $(SOURCEDIR_V5) install || INSTALL_ROOT=$(BUILD) $(MAKE) -C $(SOURCEDIR) install override_dh_strip: dh_strip -s --dbg-package=$(PACKAGE)-dbgsym From 49363d09bd29a25642bbb7d4801b20af0a15c6e8 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev Date: Fri, 10 Sep 2021 00:00:43 +0100 Subject: [PATCH 10/10] Fix artifact name --- .github/workflows/build-and-deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index 3161e9b..61674cb 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -154,7 +154,7 @@ jobs: - name: Upload Artifact uses: actions/upload-artifact@v2 with: - name: ${OS}-${DIST}-php-${{ matrix.php }}-${{ matrix.branch }}.zip + name: ${{ env.OS }}-${{ env.DIST }}-php-${{ matrix.php }}-${{ matrix.branch }}.zip path: build/ - name: Push package to phalcon/${{ matrix.packagecloud_repo }}/${{ matrix.os_dist }}