diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7ac1902a..88ba1dc4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,10 +42,6 @@ jobs: fail-fast: false matrix: php-version: [ '7.2', '7.3' ] - coverage: [ 'none' ] - include: - - php-version: '7.4' - coverage: xdebug steps: - name: Checkout @@ -57,7 +53,7 @@ jobs: php-version: ${{ matrix.php-version }} ini-values: error_reporting=E_ALL tools: composer:v2 - coverage: "${{ matrix.coverage }}" + coverage: none - name: Show the Composer configuration run: composer config --global --list @@ -76,14 +72,7 @@ jobs: composer show; - name: Run Tests - run: ./vendor/bin/phpunit --coverage-clover build/coverage/xml - - - name: Upload coverage results to Codacy - env: - CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }} - if: "${{ matrix.coverage != 'none' && env.CODACY_PROJECT_TOKEN != '' }}" - run: | - ./vendor/bin/codacycoverage clover build/coverage/xml + run: ./vendor/bin/phpunit static-analysis: name: Static Analysis diff --git a/.github/workflows/codecoverage.yml b/.github/workflows/codecoverage.yml new file mode 100644 index 00000000..76568630 --- /dev/null +++ b/.github/workflows/codecoverage.yml @@ -0,0 +1,57 @@ +# https://help.github.com/en/categories/automating-your-workflow-with-github-actions + +on: + push: + branches: + - master + pull_request: + +name: Code coverage + +jobs: + code-coverage: + name: Code coverage + + runs-on: ubuntu-22.04 + + strategy: + matrix: + php-version: [ '7.4' ] + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + ini-values: error_reporting=E_ALL + tools: composer:v2 + coverage: xdebug + + - name: Show the Composer configuration + run: composer config --global --list + + - name: Cache dependencies installed with composer + uses: actions/cache@v4 + with: + path: ~/.cache/composer + key: php${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: | + php${{ matrix.php-version }}-composer- + + - name: Install Composer dependencies + run: | + composer update --with-dependencies --no-progress; + composer show; + + - name: Run Tests + run: ./vendor/bin/phpunit --coverage-clover build/coverage/xml + + - name: Upload coverage results to Codacy + env: + CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }} + if: "${{ env.CODACY_PROJECT_TOKEN != '' }}" + run: | + ./vendor/bin/codacycoverage clover build/coverage/xml