Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

coverage file not be generated if phpunit command without xdebug param #21

Closed
wants to merge 1 commit into from

Conversation

maxsky
Copy link

@maxsky maxsky commented May 30, 2023

No description provided.

@codecov
Copy link

codecov bot commented Aug 1, 2023

Codecov Report

Merging #21 (280e41e) into main (8c29f9a) will not change coverage.
The diff coverage is n/a.

@@            Coverage Diff            @@
##               main      #21   +/-   ##
=========================================
  Coverage     90.00%   90.00%           
  Complexity        5        5           
=========================================
  Files             1        1           
  Lines            10       10           
=========================================
  Hits              9        9           
  Misses            1        1           

@thomasrockhu-codecov
Copy link
Contributor

Hi @maxsky, why is this necessary? We were able to get coverage reports previously on this repo. Just curious, I'm not a php developer by any means.

@maxsky
Copy link
Author

maxsky commented Aug 1, 2023

Hi @maxsky, why is this necessary? We were able to get coverage reports previously on this repo. Just curious, I'm not a php developer by any means.

As title describe, but I'm not did more test. In PHP 8.1 with phpunit 9.x, if missed xdebug.mode=coverage in php.ini configure file, coverage file will not be generated. So, if generate command exists php -d xdebug.mode=coverage it will be run normal.

@maxsky
Copy link
Author

maxsky commented Aug 1, 2023

As this image, if Warning displayed, the coverage.xml file will not be generated.

snapshot

Maybe my codecov.yml was wrong? I'm not sure, can you help me check it? THXXX a lot!

name: PHP Composer

on:
  push:
    branches: [ "master" ]
  pull_request:
    branches: [ "master" ]

permissions:
  contents: read

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v3

      - name: Validate composer.json and composer.lock
        run: composer validate --strict

      - name: Cache Composer packages
        id: composer-cache
        uses: actions/cache@v3
        with:
          path: vendor
          key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
          restore-keys: |
            ${{ runner.os }}-php-

      - name: Install dependencies
        run: composer install --prefer-dist --no-progress

      - name: Run tests and collect coverage
        run: php -d xdebug.mode=coverage vendor/bin/phpunit --coverage-clover coverage.xml

      - name: Upload coverage reports to Codecov
        uses: codecov/codecov-action@v3
        with:
          token: ${{ secrets.CODECOV_TOKEN }}

@thomasrockhu-codecov
Copy link
Contributor

@maxsky, I don't think this is a general enough use case to put here.

  1. xdebug is not the only way to generate coverage files in php. link
  2. xdebug can be configured in the php.ini file instead of inline as so. link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants