From 43ded023efe17872e5a98230efa83495a737ca35 Mon Sep 17 00:00:00 2001 From: Eric Stern Date: Wed, 20 Jan 2021 09:41:32 -0800 Subject: [PATCH 1/8] Only use GLOB_BRACE when defined --- src/Iterator/GlobIterator.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Iterator/GlobIterator.php b/src/Iterator/GlobIterator.php index e88bbeb..2ef80f8 100644 --- a/src/Iterator/GlobIterator.php +++ b/src/Iterator/GlobIterator.php @@ -52,7 +52,8 @@ public function __construct($glob, $flags = 0) // glob() does not support [^...] on Windows ('\\' !== DIRECTORY_SEPARATOR || false === strpos($glob, '[^')) ) { - $results = glob($glob, GLOB_BRACE); + // GLOB_BRACE is not available in some environments. + $results = glob($glob, defined('GLOB_BRACE') ? GLOB_BRACE : 0); // $results may be empty or false if $glob is invalid if (empty($results)) { From 2b35e3fcb560865c056d0508b513d71718a9ec04 Mon Sep 17 00:00:00 2001 From: Eric Stern Date: Wed, 20 Jan 2021 10:58:00 -0800 Subject: [PATCH 2/8] Set up alpine dockerfile --- .github/workflows/alpine.dockerfile | 2 ++ .github/workflows/phpunit.yml | 47 +++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 .github/workflows/alpine.dockerfile diff --git a/.github/workflows/alpine.dockerfile b/.github/workflows/alpine.dockerfile new file mode 100644 index 0000000..a5231f2 --- /dev/null +++ b/.github/workflows/alpine.dockerfile @@ -0,0 +1,2 @@ +FROM php:8-cli-alpine +COPY . . diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 4bc9a92..3eab3d4 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -60,3 +60,50 @@ jobs: - name: "Tests" run: "vendor/bin/phpunit" + + phpunit-alpine: + name: "PHPUnit tests under Alpine" + + runs-on: ubuntu-latest + + strategy: + matrix: + dependencies: + - "lowest" + - "highest" + - "locked" + php-version: + - "7.3" + - "7.4" + - "8.0" + + steps: + - name: "Checkout" + uses: "actions/checkout@v2" + + - name: "Cache dependencies" + uses: "actions/cache@v2" + with: + path: | + ~/.composer/cache + vendor + key: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}" + restore-keys: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}" + + - name: "Install lowest dependencies" + if: ${{ matrix.dependencies == 'lowest' }} + run: "composer update --prefer-lowest --no-interaction --no-progress --no-suggest" + + - name: "Install highest dependencies" + if: ${{ matrix.dependencies == 'highest' }} + run: "composer update --no-interaction --no-progress --no-suggest" + + - name: "Install locked dependencies" + if: ${{ matrix.dependencies == 'locked' }} + run: "composer install --no-interaction --no-progress --no-suggest" + + - name: "Build Alpine image" + run: docker build --file .github/workflows/alpine.dockerfile --tag testenv . + + - name: "Tests" + run: docker run testenv vendor/bin/phpunit From ff03cee2c42b21ae7f083c4a310a42e0bfde4d15 Mon Sep 17 00:00:00 2001 From: Eric Stern Date: Wed, 20 Jan 2021 11:03:50 -0800 Subject: [PATCH 3/8] Make sure it breaks under alpine --- src/Iterator/GlobIterator.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Iterator/GlobIterator.php b/src/Iterator/GlobIterator.php index 2ef80f8..43fd38f 100644 --- a/src/Iterator/GlobIterator.php +++ b/src/Iterator/GlobIterator.php @@ -53,7 +53,8 @@ public function __construct($glob, $flags = 0) ('\\' !== DIRECTORY_SEPARATOR || false === strpos($glob, '[^')) ) { // GLOB_BRACE is not available in some environments. - $results = glob($glob, defined('GLOB_BRACE') ? GLOB_BRACE : 0); + // $results = glob($glob, defined('GLOB_BRACE') ? GLOB_BRACE : 0); + $results = glob($glob, GLOB_BRACE); // $results may be empty or false if $glob is invalid if (empty($results)) { From 51b24e36ac94b277731e75887accf860e99c60d5 Mon Sep 17 00:00:00 2001 From: Eric Stern Date: Wed, 20 Jan 2021 11:07:10 -0800 Subject: [PATCH 4/8] Consolidate build --- .github/workflows/phpunit.yml | 46 +++-------------------------------- 1 file changed, 4 insertions(+), 42 deletions(-) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 3eab3d4..2133b27 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -61,49 +61,11 @@ jobs: - name: "Tests" run: "vendor/bin/phpunit" - phpunit-alpine: - name: "PHPUnit tests under Alpine" - - runs-on: ubuntu-latest - - strategy: - matrix: - dependencies: - - "lowest" - - "highest" - - "locked" - php-version: - - "7.3" - - "7.4" - - "8.0" - - steps: - - name: "Checkout" - uses: "actions/checkout@v2" - - - name: "Cache dependencies" - uses: "actions/cache@v2" - with: - path: | - ~/.composer/cache - vendor - key: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}" - restore-keys: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}" - - - name: "Install lowest dependencies" - if: ${{ matrix.dependencies == 'lowest' }} - run: "composer update --prefer-lowest --no-interaction --no-progress --no-suggest" - - - name: "Install highest dependencies" - if: ${{ matrix.dependencies == 'highest' }} - run: "composer update --no-interaction --no-progress --no-suggest" - - - name: "Install locked dependencies" - if: ${{ matrix.dependencies == 'locked' }} - run: "composer install --no-interaction --no-progress --no-suggest" - - name: "Build Alpine image" + if: ${{ matrix.operating-system == 'ubuntu-latest' }} + # todo: image per tag run: docker build --file .github/workflows/alpine.dockerfile --tag testenv . - - name: "Tests" + - name: "Test under Alpine" + if: ${{ matrix.operating-system == 'ubuntu-latest' }} run: docker run testenv vendor/bin/phpunit From 6e026f596aeb363e9b5bc99e6a1c06673a1d003d Mon Sep 17 00:00:00 2001 From: Eric Stern Date: Wed, 20 Jan 2021 11:12:01 -0800 Subject: [PATCH 5/8] Try using build arg for php version --- .github/workflows/alpine.dockerfile | 3 ++- .github/workflows/phpunit.yml | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/alpine.dockerfile b/.github/workflows/alpine.dockerfile index a5231f2..51626b5 100644 --- a/.github/workflows/alpine.dockerfile +++ b/.github/workflows/alpine.dockerfile @@ -1,2 +1,3 @@ -FROM php:8-cli-alpine +ARG PHP_VERSION +FROM php:{$PHP_VERSION}-cli-alpine COPY . . diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 2133b27..8f64635 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -63,8 +63,7 @@ jobs: - name: "Build Alpine image" if: ${{ matrix.operating-system == 'ubuntu-latest' }} - # todo: image per tag - run: docker build --file .github/workflows/alpine.dockerfile --tag testenv . + run: docker build --file .github/workflows/alpine.dockerfile --build-arg=${{ matrix.php-version }} --tag testenv . - name: "Test under Alpine" if: ${{ matrix.operating-system == 'ubuntu-latest' }} From ed9792f8fb03f35d3e31f3a395c8e3947f2d2a5e Mon Sep 17 00:00:00 2001 From: Eric Stern Date: Wed, 20 Jan 2021 11:14:49 -0800 Subject: [PATCH 6/8] Fix format --- .github/workflows/phpunit.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 8f64635..9b8252d 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -63,7 +63,11 @@ jobs: - name: "Build Alpine image" if: ${{ matrix.operating-system == 'ubuntu-latest' }} - run: docker build --file .github/workflows/alpine.dockerfile --build-arg=${{ matrix.php-version }} --tag testenv . + run: docker build + --file .github/workflows/alpine.dockerfile + --build-arg PHP_VERSION=${{ matrix.php-version }} + --tag testenv + . - name: "Test under Alpine" if: ${{ matrix.operating-system == 'ubuntu-latest' }} From 04e490f9ff70713e5a56d0abd8df52e5ec1aee2c Mon Sep 17 00:00:00 2001 From: Eric Stern Date: Wed, 20 Jan 2021 11:17:05 -0800 Subject: [PATCH 7/8] Fix brackets --- .github/workflows/alpine.dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/alpine.dockerfile b/.github/workflows/alpine.dockerfile index 51626b5..1c5cfc9 100644 --- a/.github/workflows/alpine.dockerfile +++ b/.github/workflows/alpine.dockerfile @@ -1,3 +1,3 @@ ARG PHP_VERSION -FROM php:{$PHP_VERSION}-cli-alpine +FROM php:${PHP_VERSION}-cli-alpine COPY . . From 651a84c84e6fd2c75d3aef19b552698fece5ed62 Mon Sep 17 00:00:00 2001 From: Eric Stern Date: Wed, 20 Jan 2021 11:19:28 -0800 Subject: [PATCH 8/8] Reapply fix --- src/Iterator/GlobIterator.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Iterator/GlobIterator.php b/src/Iterator/GlobIterator.php index 43fd38f..2ef80f8 100644 --- a/src/Iterator/GlobIterator.php +++ b/src/Iterator/GlobIterator.php @@ -53,8 +53,7 @@ public function __construct($glob, $flags = 0) ('\\' !== DIRECTORY_SEPARATOR || false === strpos($glob, '[^')) ) { // GLOB_BRACE is not available in some environments. - // $results = glob($glob, defined('GLOB_BRACE') ? GLOB_BRACE : 0); - $results = glob($glob, GLOB_BRACE); + $results = glob($glob, defined('GLOB_BRACE') ? GLOB_BRACE : 0); // $results may be empty or false if $glob is invalid if (empty($results)) {