From e4a15c44632bba498735a1563f91c0b134077e6b Mon Sep 17 00:00:00 2001 From: joelbladt Date: Sun, 24 Nov 2024 13:26:59 +0100 Subject: [PATCH 1/5] Configure PHPUnit coverage reporting and add Coveralls badge to README --- README.md | 1 + phpunit.xml.dist | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/README.md b/README.md index a6fb7790a95a..033b3e754d0d 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@

Build Status +Coverage Status Total Downloads Latest Stable Version License diff --git a/phpunit.xml.dist b/phpunit.xml.dist index d2d991c6c564..f561440192ac 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -7,11 +7,21 @@ stopOnFailure="false" cacheDirectory=".phpunit.cache" backupStaticProperties="false"> + + + + + ./tests + + + src + + From 5e40c28dafebcd71ea1dfda0597c0b37ab66ca6a Mon Sep 17 00:00:00 2001 From: joelbladt Date: Sun, 24 Nov 2024 13:29:42 +0100 Subject: [PATCH 2/5] Add Coveralls CI workflow for automated test coverage reporting --- .github/workflows/coveralls.yml | 68 +++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 .github/workflows/coveralls.yml diff --git a/.github/workflows/coveralls.yml b/.github/workflows/coveralls.yml new file mode 100644 index 000000000000..50fc3d036029 --- /dev/null +++ b/.github/workflows/coveralls.yml @@ -0,0 +1,68 @@ +name: coveralls + +on: + push: + branches: + - master + - '*.x' + pull_request: + +jobs: + types: + runs-on: ubuntu-24.04 + + strategy: + fail-fast: true + matrix: + php: [ 8.2, 8.3, 8.4 ] + phpunit: [ '10.5.12', '11.3.2' ] + + name: PHP ${{ matrix.php }} - PHPUnit ${{ matrix.phpunit }} + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 8.2 + extensions: mbstring, xml, xdebug + tools: composer:v2 + coverage: xdebug + + - name: Set Framework version + run: composer config version "11.x-dev" + + - name: Set Minimum PHP 8.4 Versions + uses: nick-fields/retry@v3 + with: + timeout_minutes: 5 + max_attempts: 5 + command: composer require nesbot/carbon:^3.4 --no-interaction --no-update + shell: bash + if: matrix.php >= 8.4 + + - name: Set PHPUnit + uses: nick-fields/retry@v3 + with: + timeout_minutes: 5 + max_attempts: 5 + command: composer require phpunit/phpunit:^${{ matrix.phpunit }} --dev --no-interaction --no-update + + - name: Install dependencies + uses: nick-fields/retry@v3 + with: + timeout_minutes: 5 + max_attempts: 5 + command: composer update --prefer-stable --prefer-dist --no-interaction --no-progress + + - name: Execute tests with coverage + run: vendor/bin/phpunit --configuration="phpunit.xml.dist" --coverage-clover="build/logs/clover.xml" + + - name: Store coverage results to Coveralls + env: + COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + composer global require php-coveralls/php-coveralls --prefer-stable --prefer-dist --no-interaction --no-progress + php-coveralls --coverage_clover="build/logs/clover.xml" -v From a5fbece4b963b3e9b07bafadac154216a3bc7d26 Mon Sep 17 00:00:00 2001 From: joelbladt Date: Sun, 24 Nov 2024 16:30:59 +0100 Subject: [PATCH 3/5] Update README.md; Add branch to coveralls badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 033b3e754d0d..b66abfcd30ee 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@

Build Status -Coverage Status +Coveralls Total Downloads Latest Stable Version License From 5a6cfdf09b559ced7bb174e4d9232a03eb6d57f7 Mon Sep 17 00:00:00 2001 From: joelbladt Date: Sun, 24 Nov 2024 17:06:31 +0100 Subject: [PATCH 4/5] fix tests.yml - add code coverage driver --- .github/workflows/tests.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f0020fd25d72..c47439df0f7c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -53,10 +53,10 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} - extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, gd, redis, igbinary, msgpack, memcached, gmp, :php-psr + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, gd, redis, igbinary, msgpack, memcached, gmp, xml, xdebug, :php-psr ini-values: error_reporting=E_ALL tools: composer:v2 - coverage: none + coverage: xdebug env: REDIS_CONFIGURE_OPTS: --enable-redis --enable-redis-igbinary --enable-redis-msgpack --enable-redis-lzf --with-liblzf --enable-redis-zstd --with-libzstd --enable-redis-lz4 --with-liblz4 REDIS_LIBS: liblz4-dev, liblzf-dev, libzstd-dev @@ -133,9 +133,9 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} - extensions: dom, curl, libxml, mbstring, zip, pdo, sqlite, pdo_sqlite, gd, pdo_mysql, fileinfo, ftp, redis, memcached, gmp, intl, :php-psr + extensions: dom, curl, libxml, mbstring, zip, pdo, sqlite, pdo_sqlite, gd, pdo_mysql, fileinfo, ftp, redis, memcached, gmp, intl, xml, xdebug, :php-psr tools: composer:v2 - coverage: none + coverage: xdebug - name: Set Framework version run: composer config version "11.x-dev" From 67d3ed3902198be5c65c08909e6e805d758d25b4 Mon Sep 17 00:00:00 2001 From: joelbladt Date: Sun, 24 Nov 2024 17:25:25 +0100 Subject: [PATCH 5/5] fix databases and queues workflow; add code coverage driver --- .github/workflows/databases-nightly.yml | 8 +++---- .github/workflows/databases.yml | 32 ++++++++++++------------- .github/workflows/queues.yml | 16 ++++++------- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/.github/workflows/databases-nightly.yml b/.github/workflows/databases-nightly.yml index 0c08e2dd8f03..3884e00d3f2d 100644 --- a/.github/workflows/databases-nightly.yml +++ b/.github/workflows/databases-nightly.yml @@ -31,9 +31,9 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: 8.3 - extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, pdo_mysql, :php-psr + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, pdo_mysql, xml, xdebug, :php-psr tools: composer:v2 - coverage: none + coverage: xdebug - name: Set Framework version run: composer config version "11.x-dev" @@ -77,9 +77,9 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: 8.3 - extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, pdo_mysql, :php-psr + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, pdo_mysql, xml, xdebug, :php-psr tools: composer:v2 - coverage: none + coverage: xdebug - name: Set Framework version run: composer config version "11.x-dev" diff --git a/.github/workflows/databases.yml b/.github/workflows/databases.yml index 834166049942..30c11190d3b5 100644 --- a/.github/workflows/databases.yml +++ b/.github/workflows/databases.yml @@ -35,9 +35,9 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: 8.3 - extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, pdo_mysql, :php-psr + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, pdo_mysql, xml, xdebug, :php-psr tools: composer:v2 - coverage: none + coverage: xdebug - name: Set Framework version run: composer config version "11.x-dev" @@ -82,9 +82,9 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: 8.3 - extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, pdo_mysql, :php-psr + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, pdo_mysql, xml, xdebug, :php-psr tools: composer:v2 - coverage: none + coverage: xdebug - name: Set Framework version run: composer config version "11.x-dev" @@ -128,9 +128,9 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: 8.3 - extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, pdo_mysql, :php-psr + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, pdo_mysql, xml, xdebug, :php-psr tools: composer:v2 - coverage: none + coverage: xdebug - name: Set Framework version run: composer config version "11.x-dev" @@ -175,9 +175,9 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: 8.3 - extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, pdo_pgsql, :php-psr + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, pdo_pgsql, xml, xdebug, :php-psr tools: composer:v2 - coverage: none + coverage: xdebug - name: Set Framework version run: composer config version "11.x-dev" @@ -224,9 +224,9 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: 8.3 - extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, pdo_pgsql, :php-psr + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, pdo_pgsql, xml, xdebug, :php-psr tools: composer:v2 - coverage: none + coverage: xdebug - name: Set Framework version run: composer config version "11.x-dev" @@ -271,9 +271,9 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: 8.3 - extensions: dom, curl, libxml, mbstring, zip, pcntl, sqlsrv, pdo, pdo_sqlsrv, odbc, pdo_odbc, :php-psr + extensions: dom, curl, libxml, mbstring, zip, pcntl, sqlsrv, pdo, pdo_sqlsrv, odbc, pdo_odbc, xml, xdebug, :php-psr tools: composer:v2 - coverage: none + coverage: xdebug - name: Set Framework version run: composer config version "11.x-dev" @@ -319,9 +319,9 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: 8.3 - extensions: dom, curl, libxml, mbstring, zip, pcntl, sqlsrv, pdo, pdo_sqlsrv, odbc, pdo_odbc, :php-psr + extensions: dom, curl, libxml, mbstring, zip, pcntl, sqlsrv, pdo, pdo_sqlsrv, odbc, pdo_odbc, xml, xdebug, :php-psr tools: composer:v2 - coverage: none + coverage: xdebug - name: Set Framework version run: composer config version "11.x-dev" @@ -358,9 +358,9 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: 8.3 - extensions: dom, curl, libxml, mbstring, zip, pcntl, sqlsrv, pdo, pdo_sqlsrv, odbc, pdo_odbc, :php-psr + extensions: dom, curl, libxml, mbstring, zip, pcntl, sqlsrv, pdo, pdo_sqlsrv, odbc, pdo_odbc, xml, xdebug, :php-psr tools: composer:v2 - coverage: none + coverage: xdebug - name: Set Framework version run: composer config version "11.x-dev" diff --git a/.github/workflows/queues.yml b/.github/workflows/queues.yml index 2748eb3a1216..06f3485b0158 100644 --- a/.github/workflows/queues.yml +++ b/.github/workflows/queues.yml @@ -24,9 +24,9 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: 8.2 - extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, pdo_mysql, :php-psr + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, pdo_mysql, xml, xdebug, :php-psr tools: composer:v2 - coverage: none + coverage: xdebug - name: Set Framework version run: composer config version "11.x-dev" @@ -59,9 +59,9 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: 8.2 - extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, pdo_mysql, :php-psr + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, pdo_mysql, xml, xdebug, :php-psr tools: composer:v2 - coverage: none + coverage: xdebug - name: Set Framework version run: composer config version "11.x-dev" @@ -107,9 +107,9 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: 8.2 - extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, pdo_mysql, :php-psr + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, pdo_mysql, xml, xdebug, :php-psr tools: composer:v2 - coverage: none + coverage: xdebug - name: Set Framework version run: composer config version "11.x-dev" @@ -147,9 +147,9 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: 8.2 - extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, pdo_mysql, :php-psr + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, pdo_mysql, xml, xdebug, :php-psr tools: composer:v2 - coverage: none + coverage: xdebug - name: Set Framework version run: composer config version "11.x-dev"