@@ -203,3 +203,58 @@ jobs:
203203 run : |
204204 cd ~/drupal
205205 ./vendor/bin/phpstan analyze web/core/modules/dynamic_page_cache --debug
206+
207+ core_baseline :
208+ needs :
209+ - lint
210+ - tests
211+ continue-on-error : true
212+ runs-on : " ubuntu-latest"
213+ name : " Drupal core HEAD baseline check"
214+ steps :
215+ - name : " Checkout"
216+ uses : " actions/checkout@v4"
217+ - name : " set the version alias for self"
218+ run : |
219+ if [ "${{ github.event_name }}" == 'pull_request' ]; then
220+ echo "VERSION_ALIAS=dev-"${{ github.sha }}"" >> $GITHUB_OUTPUT
221+ else
222+ echo "VERSION_ALIAS=dev-main" >> $GITHUB_OUTPUT
223+ fi
224+ id : branch_alias
225+ - name : determine phpstan cache directory
226+ run : echo PHPSTAN_TMP_DIR=$(php -r "print sys_get_temp_dir() . '/phpstan';") >> $GITHUB_OUTPUT
227+ id : phpstan_tmp_dir
228+ - name : cache phpstan
229+ uses : actions/cache@v4
230+ with :
231+ path : ${{ steps.phpstan_tmp_dir.outputs.PHPSTAN_TMP_DIR }}
232+ key : ${{ runner.os }}-phpstan-core-baseline
233+ restore-keys : ${{ runner.os }}-phpstan-core-baseline
234+ - name : " Install PHP"
235+ uses : " shivammathur/setup-php@v2"
236+ with :
237+ coverage : " none"
238+ php-version : " 8.3"
239+ tools : composer:v2
240+ extensions : dom, curl, libxml, mbstring, zip, pdo, mysql, pdo_mysql, gd, apcu
241+ - name : " Checkout Drupal core"
242+ run : |
243+ cd ${{ runner.temp }}
244+ git clone https://git.drupalcode.org/project/drupal.git
245+ cd drupal
246+ composer config repositories.0 composer https://packages.drupal.org/8
247+ composer config repositories.1 path $GITHUB_WORKSPACE
248+
249+ - name : " Install Drupal core dependencies"
250+ uses : " ramsey/composer-install@v3"
251+ with :
252+ working-directory : " ${{ runner.temp }}/drupal"
253+ - name : " require phpstan-drupal"
254+ run : |
255+ cd ${{ runner.temp }}/drupal
256+ composer require drupal/core-dev "phpstan/phpstan:^2.0" "phpstan/phpstan-phpunit:^2.0" mglaman/phpstan-drupal "${{ steps.branch_alias.outputs.VERSION_ALIAS }} as 2.99.99" phpstan/extension-installer --with-all-dependencies
257+ - name : " Check baseline"
258+ run : |
259+ cd ${{ runner.temp }}/drupal
260+ ./vendor/bin/phpstan analyze --configuration=core/phpstan.neon.dist
0 commit comments