master
branch first. If no artifact exists on master Gitlab can't compare code quality
PHPStan
composer require --dev phpstan/phpstan
Add .gitlab-ci.yml
:
stages: - test php_stan: image: composer stage: test script: - composer install --no-ansi # Set output to 'gitlab' using '--error-format=gitlab', the artifact gets uploaded - ./vendor/bin/phpstan analyse --error-format=gitlab --no-progress Classes/ > gl-phpstan-report.json || exit 0 artifacts: reports: # Tell Gitlab about the custom generated reports JSON file codequality: gl-phpstan-report.json # Optional paths: [gl-phpstan-report.json]
./vendor/bin/phpstan analyse | –error-format=gitlab | –no-progress | Classes/ | > gl-code-quality-report.json | exit 0 |
---|---|---|---|---|---|
Run analyzer | Output Gitlab readable JSON format | Hide progress indicator | Folders to analyze | Write output to file | Optional: Make sure job always passes |