From cb096372413123390999da44f808b31a68ec9919 Mon Sep 17 00:00:00 2001 From: Roel <10514742+rboonzaijer@users.noreply.github.com> Date: Sat, 11 Jun 2022 20:56:30 +0200 Subject: [PATCH 1/6] Try to have one artifact with coverages from all php versions --- .github/workflows/tests.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1db8ab7..5b1b50d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -28,14 +28,14 @@ jobs: - name: Run test suite run: | - mkdir ./coverage + mkdir -p ./coverage/php-${{ matrix.php-version }} php -v - php -v > ./coverage/version-php.txt - ./vendor/bin/phpunit --version > ./coverage/version-phpunit.txt - ./vendor/bin/phpunit --configuration ./phpunit-${{ matrix.php-version }}.xml --coverage-clover ./coverage/coverage.clover --coverage-html ./coverage/html/ + php -v > ./coverage/php-${{ matrix.php-version }}/php.txt + ./vendor/bin/phpunit --version > ./coverage/php-${{ matrix.php-version }}/phpunit.txt + ./vendor/bin/phpunit --configuration ./phpunit-${{ matrix.php-version }}.xml --coverage-clover ./coverage/php-${{ matrix.php-version }}/coverage.clover --coverage-html ./coverage/php-${{ matrix.php-version }}/html/ - name: Save coverage results uses: actions/upload-artifact@v3 with: - name: coverage-php${{ matrix.php-version }} - path: ./coverage/ + name: coverage + path: ./coverage From c80224e9d27aa295ca5319aa2fe2e8ccb2bae610 Mon Sep 17 00:00:00 2001 From: Roel <10514742+rboonzaijer@users.noreply.github.com> Date: Sat, 11 Jun 2022 21:26:02 +0200 Subject: [PATCH 2/6] test each week + use datetime in filename for coverage --- .github/workflows/tests.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5b1b50d..953430e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -3,6 +3,10 @@ name: Tests on: push: pull_request: + workflow_dispatch: + schedule: + # “At 17:45 on Friday.” + - cron: '45 17 * * 5' jobs: build: @@ -29,13 +33,14 @@ jobs: - name: Run test suite run: | mkdir -p ./coverage/php-${{ matrix.php-version }} - php -v - php -v > ./coverage/php-${{ matrix.php-version }}/php.txt - ./vendor/bin/phpunit --version > ./coverage/php-${{ matrix.php-version }}/phpunit.txt ./vendor/bin/phpunit --configuration ./phpunit-${{ matrix.php-version }}.xml --coverage-clover ./coverage/php-${{ matrix.php-version }}/coverage.clover --coverage-html ./coverage/php-${{ matrix.php-version }}/html/ + - name: Get current date/time + id: date + run: echo "::set-output name=date::$(date +'%Y%m%d-%H%M')" + - name: Save coverage results uses: actions/upload-artifact@v3 with: - name: coverage + name: coverage_php-array-to-xml_${{ steps.date.outputs.date }} path: ./coverage From db98a88c588ae2d18f6bff81814ccaf4a4a2ea0b Mon Sep 17 00:00:00 2001 From: Roel <10514742+rboonzaijer@users.noreply.github.com> Date: Sat, 11 Jun 2022 21:29:04 +0200 Subject: [PATCH 3/6] test php 8.2 --- .github/workflows/tests.yml | 2 +- phpunit-8.2.xml | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 phpunit-8.2.xml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 953430e..defe6e8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php-version: ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1'] + php-version: ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2'] steps: - uses: actions/checkout@v3 diff --git a/phpunit-8.2.xml b/phpunit-8.2.xml new file mode 100644 index 0000000..528ae91 --- /dev/null +++ b/phpunit-8.2.xml @@ -0,0 +1,30 @@ + + + + + + ./src + + + ./vendor + ./tests + + + + + ./tests/ + + + From 025f6de3b485dd2e32c56ffc629854761e5d6048 Mon Sep 17 00:00:00 2001 From: Roel <10514742+rboonzaijer@users.noreply.github.com> Date: Sat, 11 Jun 2022 21:36:52 +0200 Subject: [PATCH 4/6] remove test for php 8.2-nightly again (phpunit not ready) --- .github/workflows/tests.yml | 2 +- phpunit-8.2.xml | 30 ------------------------------ 2 files changed, 1 insertion(+), 31 deletions(-) delete mode 100644 phpunit-8.2.xml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index defe6e8..953430e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php-version: ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2'] + php-version: ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1'] steps: - uses: actions/checkout@v3 diff --git a/phpunit-8.2.xml b/phpunit-8.2.xml deleted file mode 100644 index 528ae91..0000000 --- a/phpunit-8.2.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - ./src - - - ./vendor - ./tests - - - - - ./tests/ - - - From d41f84ba7bdd4fcf5ae271fd8e64f26fbe83ebc3 Mon Sep 17 00:00:00 2001 From: Roel <10514742+rboonzaijer@users.noreply.github.com> Date: Sat, 11 Jun 2022 22:14:29 +0200 Subject: [PATCH 5/6] move phpunit files to clean up the root directory --- .github/workflows/tests.yml | 2 +- README.md | 12 ++++++++++ phpunit.xml | 30 ------------------------ phpunit-7.0.xml => tests/phpunit-7.0.xml | 13 ++++------ phpunit-7.1.xml => tests/phpunit-7.1.xml | 13 ++++------ phpunit-7.2.xml => tests/phpunit-7.2.xml | 13 ++++------ phpunit-7.3.xml => tests/phpunit-7.3.xml | 10 ++++---- phpunit-7.4.xml => tests/phpunit-7.4.xml | 10 ++++---- phpunit-8.0.xml => tests/phpunit-8.0.xml | 10 ++++---- phpunit-8.1.xml => tests/phpunit-8.1.xml | 10 ++++---- 10 files changed, 48 insertions(+), 75 deletions(-) delete mode 100644 phpunit.xml rename phpunit-7.0.xml => tests/phpunit-7.0.xml (75%) rename phpunit-7.1.xml => tests/phpunit-7.1.xml (74%) rename phpunit-7.2.xml => tests/phpunit-7.2.xml (74%) rename phpunit-7.3.xml => tests/phpunit-7.3.xml (78%) rename phpunit-7.4.xml => tests/phpunit-7.4.xml (78%) rename phpunit-8.0.xml => tests/phpunit-8.0.xml (78%) rename phpunit-8.1.xml => tests/phpunit-8.1.xml (78%) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 953430e..00b357d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -33,7 +33,7 @@ jobs: - name: Run test suite run: | mkdir -p ./coverage/php-${{ matrix.php-version }} - ./vendor/bin/phpunit --configuration ./phpunit-${{ matrix.php-version }}.xml --coverage-clover ./coverage/php-${{ matrix.php-version }}/coverage.clover --coverage-html ./coverage/php-${{ matrix.php-version }}/html/ + ./vendor/bin/phpunit --configuration ./tests/phpunit-${{ matrix.php-version }}.xml --coverage-clover ./coverage/php-${{ matrix.php-version }}/coverage.clover --coverage-html ./coverage/php-${{ matrix.php-version }}/html/ - name: Get current date/time id: date diff --git a/README.md b/README.md index 0a19679..02b9793 100644 --- a/README.md +++ b/README.md @@ -456,3 +456,15 @@ Result (prettified): __NULL__ ``` + +# PHPUnit Tests +Use a specific configuration file, depending on your php version: +``` +./vendor/bin/phpunit --configuration ./tests/phpunit-7.0.xml +./vendor/bin/phpunit --configuration ./tests/phpunit-7.1.xml +./vendor/bin/phpunit --configuration ./tests/phpunit-7.2.xml +./vendor/bin/phpunit --configuration ./tests/phpunit-7.3.xml +./vendor/bin/phpunit --configuration ./tests/phpunit-7.4.xml +./vendor/bin/phpunit --configuration ./tests/phpunit-8.0.xml +./vendor/bin/phpunit --configuration ./tests/phpunit-8.1.xml +``` diff --git a/phpunit.xml b/phpunit.xml deleted file mode 100644 index 528ae91..0000000 --- a/phpunit.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - ./src - - - ./vendor - ./tests - - - - - ./tests/ - - - diff --git a/phpunit-7.0.xml b/tests/phpunit-7.0.xml similarity index 75% rename from phpunit-7.0.xml rename to tests/phpunit-7.0.xml index 81cca98..1cfd691 100644 --- a/phpunit-7.0.xml +++ b/tests/phpunit-7.0.xml @@ -2,7 +2,7 @@ - - ./src + ./../src - ./vendor - ./tests + ./../vendor + ./../tests - - ./tests/ + ./../tests/ - \ No newline at end of file diff --git a/phpunit-7.1.xml b/tests/phpunit-7.1.xml similarity index 74% rename from phpunit-7.1.xml rename to tests/phpunit-7.1.xml index b775b6c..2f0f1a2 100644 --- a/phpunit-7.1.xml +++ b/tests/phpunit-7.1.xml @@ -2,28 +2,25 @@ - - ./src + ./../src - ./vendor - ./tests + ./../vendor + ./../tests - - ./tests/ + ./../tests/ - \ No newline at end of file diff --git a/phpunit-7.2.xml b/tests/phpunit-7.2.xml similarity index 74% rename from phpunit-7.2.xml rename to tests/phpunit-7.2.xml index 281b609..d42256d 100644 --- a/phpunit-7.2.xml +++ b/tests/phpunit-7.2.xml @@ -2,28 +2,25 @@ - - ./src + ./../src - ./vendor - ./tests + ./../vendor + ./../tests - - ./tests/ + ./../tests/ - \ No newline at end of file diff --git a/phpunit-7.3.xml b/tests/phpunit-7.3.xml similarity index 78% rename from phpunit-7.3.xml rename to tests/phpunit-7.3.xml index 528ae91..299ec13 100644 --- a/phpunit-7.3.xml +++ b/tests/phpunit-7.3.xml @@ -4,7 +4,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" backupStaticAttributes="false" - bootstrap="vendor/autoload.php" + bootstrap="./../vendor/autoload.php" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" @@ -15,16 +15,16 @@ xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"> - ./src + ./../src - ./vendor - ./tests + ./../vendor + ./../tests - ./tests/ + ./../tests/ diff --git a/phpunit-7.4.xml b/tests/phpunit-7.4.xml similarity index 78% rename from phpunit-7.4.xml rename to tests/phpunit-7.4.xml index 528ae91..299ec13 100644 --- a/phpunit-7.4.xml +++ b/tests/phpunit-7.4.xml @@ -4,7 +4,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" backupStaticAttributes="false" - bootstrap="vendor/autoload.php" + bootstrap="./../vendor/autoload.php" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" @@ -15,16 +15,16 @@ xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"> - ./src + ./../src - ./vendor - ./tests + ./../vendor + ./../tests - ./tests/ + ./../tests/ diff --git a/phpunit-8.0.xml b/tests/phpunit-8.0.xml similarity index 78% rename from phpunit-8.0.xml rename to tests/phpunit-8.0.xml index 528ae91..299ec13 100644 --- a/phpunit-8.0.xml +++ b/tests/phpunit-8.0.xml @@ -4,7 +4,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" backupStaticAttributes="false" - bootstrap="vendor/autoload.php" + bootstrap="./../vendor/autoload.php" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" @@ -15,16 +15,16 @@ xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"> - ./src + ./../src - ./vendor - ./tests + ./../vendor + ./../tests - ./tests/ + ./../tests/ diff --git a/phpunit-8.1.xml b/tests/phpunit-8.1.xml similarity index 78% rename from phpunit-8.1.xml rename to tests/phpunit-8.1.xml index 528ae91..299ec13 100644 --- a/phpunit-8.1.xml +++ b/tests/phpunit-8.1.xml @@ -4,7 +4,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" backupStaticAttributes="false" - bootstrap="vendor/autoload.php" + bootstrap="./../vendor/autoload.php" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" @@ -15,16 +15,16 @@ xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"> - ./src + ./../src - ./vendor - ./tests + ./../vendor + ./../tests - ./tests/ + ./../tests/ From 85e4782342a23b9ecced6d300f7390b2b9e6c861 Mon Sep 17 00:00:00 2001 From: Roel <10514742+rboonzaijer@users.noreply.github.com> Date: Sat, 11 Jun 2022 22:39:56 +0200 Subject: [PATCH 6/6] disable html coverage to save space, but gather the output in the artifact --- .github/workflows/tests.yml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 00b357d..ca6222b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -32,15 +32,13 @@ jobs: - name: Run test suite run: | - mkdir -p ./coverage/php-${{ matrix.php-version }} - ./vendor/bin/phpunit --configuration ./tests/phpunit-${{ matrix.php-version }}.xml --coverage-clover ./coverage/php-${{ matrix.php-version }}/coverage.clover --coverage-html ./coverage/php-${{ matrix.php-version }}/html/ - - - name: Get current date/time - id: date - run: echo "::set-output name=date::$(date +'%Y%m%d-%H%M')" + mkdir ./coverage + php -v > ./coverage/php${{ matrix.php-version }}_output.txt && echo '' >> ./coverage/php${{ matrix.php-version }}_output.txt + ./vendor/bin/phpunit --configuration ./tests/phpunit-${{ matrix.php-version }}.xml --coverage-clover ./coverage/php${{ matrix.php-version }}_coverage.clover >> ./coverage/php${{ matrix.php-version }}_output.txt + cat ./coverage/php${{ matrix.php-version }}_output.txt - name: Save coverage results uses: actions/upload-artifact@v3 with: - name: coverage_php-array-to-xml_${{ steps.date.outputs.date }} + name: coverage_clover_php-array-to-xml path: ./coverage