From 2dc7c7ca2093bf8c95ea5f7e0b8be7fe80ac4f2f Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sun, 10 Oct 2021 23:25:50 +0200 Subject: [PATCH 1/2] Upgrade to Box 3 for Phar generation Box 2 is no longer maintained and will not be made compatible with more recent PHP versions. Refs: * https://github.com/box-project/box/blob/master/UPGRADE.md#from-27-to-30 * https://github.com/box-project/box/blob/master/doc/configuration.md --- .github/workflows/release.yml | 22 +++++++++++----------- .github/workflows/test.yml | 22 +++++++++++----------- box.json | 18 +++++++----------- 3 files changed, 29 insertions(+), 33 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e1e1cd8..d1a7d22 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,27 +19,27 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: 5.4 + php-version: 7.3 extensions: exif, phar, openssl coverage: none ini-values: phar.readonly=Off - - name: Install Box from GitHub - run: | - curl -LSs https://box-project.github.io/box2/installer.php | php - test -f ./box.phar - test -d ~/bin || mkdir ~/bin - mv ./box.phar ~/bin/box - ~/bin/box -V - echo "$HOME/bin" >> $GITHUB_PATH - - name: Install Composer dependencies uses: ramsey/composer-install@v1 with: composer-options: "--no-dev" + - name: Install Box + run: wget https://github.com/humbug/box/releases/latest/download/box.phar -O box.phar && chmod 0755 box.phar && pwd + + - name: Validate configuration + run: php box.phar validate -i box.json + - name: Building binary... - run: box build -v + run: php box.phar compile -v --config=box.json + + - name: Show info about the build phar with humbug/box + run: php box.phar info -l parallel-lint.phar - uses: actions/upload-artifact@v2 with: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index af42559..2d24701 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -45,27 +45,27 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: 5.4 + php-version: 7.3 extensions: exif, phar, openssl coverage: none ini-values: phar.readonly=Off, error_reporting=E_ALL, display_errors=On - - name: Install Box from GitHub - run: | - curl -LSs https://box-project.github.io/box2/installer.php | php - test -f ./box.phar - test -d ~/bin || mkdir ~/bin - mv ./box.phar ~/bin/box - ~/bin/box -V - echo "$HOME/bin" >> $GITHUB_PATH - - name: Install Composer dependencies uses: ramsey/composer-install@v1 with: composer-options: "--no-dev" + - name: Install Box + run: wget https://github.com/humbug/box/releases/latest/download/box.phar -O box.phar && chmod 0755 box.phar && pwd + + - name: Validate configuration + run: php box.phar validate -i box.json + - name: Building binary... - run: box build -v + run: php box.phar compile -v --config=box.json + + - name: Show info about the build phar with humbug/box + run: php box.phar info -l parallel-lint.phar - uses: actions/upload-artifact@v2 with: diff --git a/box.json b/box.json index 8c6fc81..0e853cb 100644 --- a/box.json +++ b/box.json @@ -1,11 +1,15 @@ { + "base-path": null, "output": "parallel-lint.phar", "chmod": "0755", "compactors": [ - "Herrera\\Box\\Compactor\\Php" + "KevinGH\\Box\\Compactor\\Php" ], - "extract": false, "main": "parallel-lint", + "directories": [ + "bin", + "src" + ], "files": [ "LICENSE" ], @@ -14,15 +18,7 @@ "name": ["*.php"], "exclude": ["Tests", "tests"], "in": "vendor" - }, - { - "exclude": ["Tests"], - "in": "src" - }, - { - "in": "bin" } ], - "stub": true, - "web": false + "stub": true } From daf0dfaabe8e86298313bed802fa5dba327acef6 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Mon, 11 Oct 2021 01:20:21 +0200 Subject: [PATCH 2/2] PHP 8.1: fix Phar building For the time being, until box-project/box#567 has been fixed: 1. Disable the addition of the requirement checker from Box as the version included in the last release of Box is not compatible with PHP 8.1. 2. Change the PHP version used to generate the Phar to PHP 8.0 to get round the problem the PHP compactor has with attributes. Note: the generated Phar file should still be compatible with all supported PHP versions. --- .github/workflows/release.yml | 2 +- .github/workflows/test.yml | 2 +- box.json | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d1a7d22..4fbe2f6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,7 +19,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: 7.3 + php-version: 8.0 extensions: exif, phar, openssl coverage: none ini-values: phar.readonly=Off diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2d24701..697a4e3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -45,7 +45,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: 7.3 + php-version: 8.0 extensions: exif, phar, openssl coverage: none ini-values: phar.readonly=Off, error_reporting=E_ALL, display_errors=On diff --git a/box.json b/box.json index 0e853cb..0bb609c 100644 --- a/box.json +++ b/box.json @@ -2,6 +2,7 @@ "base-path": null, "output": "parallel-lint.phar", "chmod": "0755", + "check-requirements": false, "compactors": [ "KevinGH\\Box\\Compactor\\Php" ],