Skip to content

Commit 4e66e95

Browse files
authored
Add Drupal core baseline check (#554)
1 parent d8a70ac commit 4e66e95

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

.github/workflows/php.yml

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

0 commit comments

Comments
 (0)