Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions .github/workflows/phan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Phan

permissions:
contents: read

on:
push:
branches:
- "*"
pull_request:
branches: [ 'master', 'main' ]
pull_request_target:
types:
- closed

jobs:
run:
name: Run Phan
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Setup PHP
uses: shivammathur/setup-php@0f7f1d08e3e32076e51cae65eb0b0c871405b16e # v2.34.1
with:
php-version: '8.4'
tools: phan:5.5.0
coverage: none

- name: Restore cached baseline for Phan
id: cache-baseline-restore
uses: actions/cache/restore@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2
with:
path: |
test/phan-baseline.php
key: phan-baseline-${{ github.run_id }}"
restore-keys: |
phan-baseline-

- name: Run Phan
continue-on-error: true
run: |
if [ -f ~/test/phan-baseline.php ]; then
echo "Cached baseline for Phan is found. Running Phan with baseline."
phan -d ./ -k .phan/config.php --load-baseline ~/test/phan-baseline.php --no-progress-bar
else
echo "Cached baseline for Phan is not found. Running Phan without baseline."
phan -d ./ -k .phan/config.php --no-progress-bar
exit 0
fi

- name: Generate the baseline for Phan
continue-on-error: true
if: github.event.pull_request.merged == true
run: |
phan -d ./ -k .phan/config.php --save-baseline ~/test/phan-baseline.php --no-progress-bar
exit 0

- name: Save the baseline for Phan
id: save-the-baseline-for-phan
if: github.event.pull_request.merged == true
uses: actions/cache/save@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2
with:
path: |
test/phan-baseline.php
key: phan-baseline-${{ github.run_id }}"
14 changes: 14 additions & 0 deletions .phan/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php
declare(strict_types=1);

return [
'target_php_version' => '8.4',

'directory_list' => [
'src',
],

'exclude_analysis_directory_list' => [
'vendor/'
],
];
Loading