diff --git a/.github/workflows/run-tests-with-coverage.yml b/.github/workflows/run-tests-with-coverage.yml index c6a0a5b9..78c02367 100644 --- a/.github/workflows/run-tests-with-coverage.yml +++ b/.github/workflows/run-tests-with-coverage.yml @@ -1,37 +1,55 @@ name: Run tests with coverage on: - push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] jobs: - tests-with-coverage: - runs-on: ubuntu-latest - strategy: - matrix: - php-version: [ "8.2", "8.3", "8.4" ] - steps: - - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php-version }} - coverage: xdebug, pcov - tools: composer:v2 + tests-with-coverage: + runs-on: ubuntu-latest + strategy: + matrix: + php-version: [ "8.2", "8.3", "8.4" ] + steps: + - uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + coverage: xdebug, pcov + tools: composer:v2 + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Install Dependencies + run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist + - name: Execute unit tests via PHPUnit with coverage + run: vendor/bin/phpunit --coverage-clover build/logs/clover.xml + - name: Export coverage report + if: ${{ matrix.php-version == '8.4' }} + uses: actions/upload-artifact@v4 + with: + name: clover.xml + path: build/logs - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Install Dependencies - run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist - - - name: Execute unit tests via PHPUnit with coverage - run: vendor/bin/phpunit --coverage-clover build/logs/clover.xml - - - name: Upload coverage results to Coveralls - env: - COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - composer global require php-coveralls/php-coveralls - php-coveralls --coverage_clover=build/logs/clover.xml -v + upload-to-coveralls: + needs: tests-with-coverage + runs-on: ubuntu-latest + steps: + - uses: shivammathur/setup-php@v2 + with: + php-version: "8.4" + tools: composer:v2 + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: actions/download-artifact@v4 + with: + name: clover.xml + path: build/logs + - name: Upload coverage results to Coveralls + env: + COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + composer global require php-coveralls/php-coveralls + php-coveralls --coverage_clover=build/logs/clover.xml -v --json_path=coveralls-upload.json