Skip to content

Commit

Permalink
Test PHAR with code coverage on PHP versions where PHPUnit 8.5 suppor…
Browse files Browse the repository at this point in the history
…ts code coverage
  • Loading branch information
sebastianbergmann committed Mar 16, 2022
1 parent 0dc9e43 commit 995d322
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 3 deletions.
54 changes: 51 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,6 @@ jobs:
- "7.2"
- "7.3"
- "7.4"
- "8.0"
- "8.1"
- "8.2"

coverage:
- pcov
Expand Down Expand Up @@ -322,3 +319,54 @@ jobs:

- name: Run PHAR-specific tests
run: ant run-phar-specific-tests

test-phar-without-code-coverage:
name: Test PHAR without code coverage

needs:
- build-phar

runs-on: ubuntu-latest

env:
PHP_EXTENSIONS: none, curl, dom, json, fileinfo, iconv, libxml, mbstring, pdo_sqlite, phar, soap, tokenizer, xml, xmlwriter
PHP_INI_VALUES: assert.exception=1, phar.readonly=0, zend.assertions=1

strategy:
fail-fast: false
matrix:
php-version:
- "8.0"
- "8.1"
- "8.2"

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: ${{ matrix.coverage }}
extensions: ${{ env.PHP_EXTENSIONS }}
ini-values: ${{ env.PHP_INI_VALUES }}
tools: none

- name: Install java
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 11

- name: Download PHAR
uses: actions/download-artifact@v3
with:
name: phpunit-snapshot-phar
path: ./build/artifacts/

- name: Make PHAR executable
run: chmod +x ./build/artifacts/phpunit-snapshot.phar

- name: Run PHAR-specific tests
run: ant run-phar-specific-tests-without-code-coverage
14 changes: 14 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,20 @@
</exec>
</target>

<target name="build-phar-and-run-phar-specific-tests-without-code-coverage" depends="clean,phar-snapshot" description="Build PHAR and run the PHAR-specific tests with it without code coverage">
<delete dir="${basedir}/vendor"/>
<delete file="${basedir}/composer.lock"/>

<antcall target="run-phar-specific-tests-without-code-coverage"/>
</target>

<target name="run-phar-specific-tests-without-code-coverage" description="Run the PHAR-specific tests with it (expects build/artifacts/phpunit-snapshot.phar to exist) without code coverage">
<exec executable="${basedir}/build/artifacts/phpunit-snapshot.phar" taskname="phpunit" failonerror="true">
<arg value="--configuration" />
<arg value="tests/phar/phpunit.xml" />
</exec>
</target>

<target name="generate-project-documentation" depends="-phploc,-checkstyle,-phpunit">
<exec executable="${basedir}/tools/phpdox" dir="${basedir}/build/config" taskname="phpdox"/>
</target>
Expand Down

0 comments on commit 995d322

Please sign in to comment.