Skip to content
Snippets Groups Projects
Verified Commit 655596f2 authored by Dave Long's avatar Dave Long
Browse files

Issue #3484896 by mondrake, smustgrave, bbrala, longwave, alexpott: [CI]...

Issue #3484896 by mondrake, smustgrave, bbrala, longwave, alexpott: [CI] Generate full baseline upon PHPStan failure
parent 11909795
No related branches found
No related tags found
No related merge requests found
Pipeline #473792 passed with warnings
Pipeline: drupal

#473816

    Pipeline: drupal

    #473804

      Pipeline: drupal

      #473795

        ......@@ -375,13 +375,22 @@ default:
        # Output a copy in junit.
        - php vendor/bin/phpstan -vvv analyze --configuration=./core/phpstan.neon.dist --error-format=gitlab > $CI_PROJECT_DIR/phpstan-quality-report.json || EXIT_CODE=$?
        - php vendor/bin/phpstan -vvv analyze --configuration=./core/phpstan.neon.dist --no-progress --error-format=junit > $CI_PROJECT_DIR/phpstan-junit.xml || true
        # When the PHPStan scan fails, output a human readable copy of the errors,
        # and regenerate a full baseline.
        # In order to regenerate a baseline artifact that can be copied and pasted
        # to a MR branch, we first need to void the current baseline file, then
        # run PHPStan with the --generate-baseline option, and finally edit the
        # generated file to convert absolute paths into relative ones.
        - |
        if [ -n "$EXIT_CODE" ]; then
        # Output a copy in plain text for human logs.
        php vendor/bin/phpstan analyze --configuration=./core/phpstan.neon.dist --no-progress || true
        # Generate a new baseline.
        echo "Generating an PHPStan baseline file (available as job artifact)."
        cp $CI_PROJECT_DIR/.gitlab-ci/scripts/.empty-phpstan-baseline.php ./core/.phpstan-baseline.php
        php vendor/bin/phpstan analyze --configuration=./core/phpstan.neon.dist --no-progress --generate-baseline=$CI_PROJECT_DIR/core/.phpstan-baseline.php || true
        sed -i "s/ '\\/\\/build\\/core/ '/g" $CI_PROJECT_DIR/core/.phpstan-baseline.php
        sed -i "s/ '\\/\\/build/ '\\/../g" $CI_PROJECT_DIR/core/.phpstan-baseline.php
        exit $EXIT_CODE
        fi
        ......@@ -392,7 +401,7 @@ default:
        codequality: phpstan-quality-report.json
        junit: phpstan-junit.xml
        paths:
        - core/.phpstan-baseline.php
        - $CI_PROJECT_DIR/core/.phpstan-baseline.php
        '🧹 PHP Coding standards (PHPCS)':
        <<: [ *default-job-settings-lint ]
        ......
        <?php
        return [];
        0% Loading or .
        You are about to add 0 people to the discussion. Proceed with caution.
        Please register or to comment