@@ -191,3 +191,57 @@ jobs:
191191 run : |
192192 cd ~/drupal
193193 ./vendor/bin/phpstan analyze web/core/modules/dynamic_page_cache --debug
194+
195+ core_baseline :
196+ needs :
197+ - lint
198+ - tests
199+ continue-on-error : true
200+ runs-on : " ubuntu-latest"
201+ name : " Drupal core HEAD baseline check"
202+ steps :
203+ - name : " Checkout"
204+ uses : " actions/checkout@v4"
205+ - name : " set the version alias for self"
206+ run : |
207+ if [ "${{ github.event_name }}" == 'pull_request' ]; then
208+ echo "VERSION_ALIAS=dev-"${{ github.sha }}"" >> $GITHUB_OUTPUT
209+ else
210+ echo "VERSION_ALIAS=dev-main" >> $GITHUB_OUTPUT
211+ fi
212+ id : branch_alias
213+ - name : determine phpstan cache directory
214+ run : echo PHPSTAN_TMP_DIR=$(php -r "print sys_get_temp_dir() . '/phpstan';") >> $GITHUB_OUTPUT
215+ id : phpstan_tmp_dir
216+ - name : cache phpstan
217+ uses : actions/cache@v4
218+ with :
219+ path : ${{ steps.phpstan_tmp_dir.outputs.PHPSTAN_TMP_DIR }}
220+ key : ${{ runner.os }}-phpstan-core-baseline
221+ restore-keys : ${{ runner.os }}-phpstan-core-baseline
222+ - name : " Install PHP"
223+ uses : " shivammathur/setup-php@v2"
224+ with :
225+ coverage : " none"
226+ php-version : " 8.3"
227+ tools : composer:v2
228+ extensions : dom, curl, libxml, mbstring, zip, pdo, mysql, pdo_mysql, gd, apcu
229+ - name : " Checkout Drupal core"
230+ run : |
231+ cd ${{ runner.temp }}
232+ git clone https://git.drupalcode.org/project/drupal.git
233+ cd drupal
234+ composer config repositories.0 composer https://packages.drupal.org/8
235+ composer config repositories.1 path $GITHUB_WORKSPACE
236+ - name : " Install Drupal core dependencies"
237+ uses : " ramsey/composer-install@v3"
238+ with :
239+ working-directory : " ${{ runner.temp }}/drupal"
240+ - name : " require phpstan-drupal"
241+ run : |
242+ cd ${{ runner.temp }}/drupal
243+ 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
244+ - name : " Check baseline"
245+ run : |
246+ cd ${{ runner.temp }}/drupal
247+ ./vendor/bin/phpstan analyze --configuration=core/phpstan.neon.dist
0 commit comments