From b4b6d4674b49e2c81dd8a3407329dd81133e738d Mon Sep 17 00:00:00 2001 From: Dennis Riehle Date: Wed, 29 Dec 2021 11:36:05 +0100 Subject: [PATCH 1/3] set up CI pipeline on Alpine Linux Signed-off-by: Dennis Riehle --- .github/workflows/continuous-integration.yml | 32 ++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index fe5f1b44..a236daee 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -19,7 +19,7 @@ jobs: id: matrix uses: laminas/laminas-ci-matrix-action@v1 - qa: + qa-ubuntu: name: QA Checks needs: [matrix] runs-on: ${{ matrix.operatingSystem }} @@ -30,4 +30,32 @@ jobs: - name: ${{ matrix.name }} uses: laminas/laminas-continuous-integration-action@v1 with: - job: ${{ matrix.job }} \ No newline at end of file + job: ${{ matrix.job }} + + qa-alpine: + name: QA Checks (PHPUnit on PHP 8.1 with Alpine Linux) + runs-on: ubuntu-latest + container: + image: php:8.1-alpine + steps: + - name: Show Alpine and PHP versions + run: | + cat /etc/os-release + php -v + - name: Install packages and PHP extensions + run: | + apk add git oniguruma-dev libxml2-dev + docker-php-ext-install mbstring + docker-php-ext-install xml + - name: Checkout + uses: actions/checkout@v2 + - name: Install composer + run: | + php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" + php -r "if (hash_file('sha384', 'composer-setup.php') === '906a84df04cea2aa72f40b5f787e49f22d4c2f19492ac310e8cba5b96ac8b64115ac402c8cd292b8a03482574915d1a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" + php composer-setup.php + php -r "unlink('composer-setup.php');" + - name: Install latest dependencies + run: php composer.phar update --ignore-platform-req=php + - name: PHPUnit + run: ./vendor/bin/phpunit From d95f369fd73e3bb1a5a9afce552ad50a0f2ffeac Mon Sep 17 00:00:00 2001 From: Dennis Riehle Date: Wed, 29 Dec 2021 13:44:00 +0100 Subject: [PATCH 2/3] exclude IconvTest from running on Alpine Linux Signed-off-by: Dennis Riehle --- test/StringWrapper/IconvTest.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/StringWrapper/IconvTest.php b/test/StringWrapper/IconvTest.php index e9f78776..ccbd1b8e 100644 --- a/test/StringWrapper/IconvTest.php +++ b/test/StringWrapper/IconvTest.php @@ -10,6 +10,10 @@ use function array_shift; use function extension_loaded; +use function file_exists; +use function file_get_contents; +use function is_readable; +use function stripos; class IconvTest extends CommonStringWrapperTest { @@ -24,6 +28,19 @@ protected function setUp(): void } } + /** + * ext-iconv is not properly supported on Alpine Linux, hence, we skip the tests for now + * + * @see https://github.com/nunomaduro/phpinsights/issues/43 + * @see https://github.com/docker-library/php/issues/240#issuecomment-353678474 + */ + if (file_exists('/etc/os-release') && is_readable('/etc/os-release')) { + $osRelease = file_get_contents('/etc/os-release'); + if (stripos($osRelease, 'Alpine Linux') !== false) { + $this->markTestSkipped('iconv not properly supported on Alpine Linux'); + } + } + parent::setUp(); } From 54cb9f8e4e46bb9385fb363bbb1669103ce3c15b Mon Sep 17 00:00:00 2001 From: Dennis Riehle Date: Wed, 29 Dec 2021 13:57:48 +0100 Subject: [PATCH 3/3] fixed wrong negation introduced in #43 (solves #45) Signed-off-by: Dennis Riehle --- src/Glob.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Glob.php b/src/Glob.php index 5f7fc094..5b5be710 100644 --- a/src/Glob.php +++ b/src/Glob.php @@ -109,7 +109,7 @@ protected static function systemGlob($pattern, $flags) */ protected static function fallbackGlob($pattern, $flags) { - if (self::flagsIsEqualTo($flags, self::GLOB_BRACE)) { + if (! self::flagsIsEqualTo($flags, self::GLOB_BRACE)) { return static::systemGlob($pattern, $flags); }