Skip to content

Code Coverage and update phpstan #58

Code Coverage and update phpstan

Code Coverage and update phpstan #58

Workflow file for this run

name: PHP Composer
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
strategy:
matrix:
operating-system: [ubuntu-latest]
php-version: ['8.1', '8.2']
runs-on: ${{ matrix.operating-system }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: 'Get Previous tag'
id: previoustag
uses: "WyriHaximus/github-action-get-previous-tag@master"
- name: Setup PHP
id: php-setup
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
ini-values: post_max_size=256M, log_errors=1
coverage: xdebug
- name: Validate composer.json and composer.lock
run: composer validate
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer install --ignore-platform-reqs --prefer-dist --no-progress --no-suggest
- name: Scan with PHP CS Fixer
run: PHP_CS_FIXER_IGNORE_ENV=1 composer run-script fixer
- name: Scan with test PHP Code Sniffer
run: composer run-script cs
- name: Run static analysis
run: composer run-script analyze
- name: Run test suite
run: composer run-script test -- --coverage-clover=clover.xml --log-junit=junit.xml
- name: Estimate coverage
if: ${{ matrix.php-version == '7.4' }}
run: composer run-script infection
- name: Process clover file
if: ${{ matrix.php-version == '7.4' }}
run: sed 's~/home/runner/work/php-etl-google-analytics-extractor/php-etl-google-analytics-extractor/~~' clover.xml > coverage.xml
- name: SonarCloud Scan
if: ${{ matrix.php-version == '7.4' }}
uses: SonarSource/sonarcloud-github-action@master
with:
args: >
-Dsonar.projectVersion=${{ steps.previoustag.outputs.tag }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}