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
28 changes: 3 additions & 25 deletions .github/workflows/phan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,7 @@ permissions:

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

jobs:
run:
Expand All @@ -24,7 +18,7 @@ jobs:
uses: shivammathur/setup-php@0f7f1d08e3e32076e51cae65eb0b0c871405b16e # v2.34.1
with:
php-version: '8.4'
tools: phan:5.5.0
tools: phan
coverage: none

- name: Restore cached baseline for Phan
Expand All @@ -40,27 +34,11 @@ jobs:
- name: Run Phan
continue-on-error: true
run: |
if [ -f ~/test/phan-baseline.php ]; then
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
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 }}"
41 changes: 10 additions & 31 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
name: PHPStan

permissions:
contents: read

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

jobs:
run:
Expand All @@ -19,17 +16,16 @@ jobs:
level: [ 1, 2 ]
include:
- current-level: 1
- max-level: 2
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Setup PHP
uses: shivammathur/setup-php@9e72090525849c5e82e596468b86eb55e9cc5401 # v2.32.0
uses: shivammathur/setup-php@0f7f1d08e3e32076e51cae65eb0b0c871405b16e # v2.34.1
with:
php-version: '8.4'

- name: Remove phpDocumentor temporarily and Install PHPStan
run: composer remove --dev --no-update phpdocumentor/phpdocumentor; composer update
- name: Install PHPStan
run: composer install

- name: Restore cached baseline for PHPStan
id: cache-baseline-restore
Expand All @@ -42,30 +38,13 @@ jobs:
phpstan-baseline-

- name: Run PHPStan
if: matrix.level == matrix.current-level
continue-on-error: true
if: matrix.level < matrix.current-level || matrix.level == matrix.current-level
run: |
./vendor/bin/phpstan analyse --memory-limit 1G -c test/phpstan.neon src test -l "${{ matrix.level }}"
./vendor/bin/phpstan analyse --memory-limit 1G -c test/phpstan.neon src test -l "${{ matrix.level }}"

- name: Run PHPStan
if: matrix.level > matrix.current-level
continue-on-error: true
run: |
./vendor/bin/phpstan analyse --memory-limit 1G -c test/phpstan.neon src test -l "${{ matrix.level }}"
exit 0

- name: Generate the baseline for PHPStan
if: matrix.level == matrix.max-level && github.event.pull_request.merged == true
continue-on-error: true
run: |
./vendor/bin/phpstan analyse --memory-limit 1G -c test/phpstan.neon --generate-baseline test/phpstan-baseline.neon src test -vvv --debug -l "${{ matrix.level }}"
exit 0

- name: Save the baseline for PHPStan
id: cache-baseline-save
if: matrix.level == matrix.max-level && github.event.pull_request.merged == true
uses: actions/cache/save@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2
with:
path: |
test/phpstan-baseline.neon
key: phpstan-baseline-${{ github.run_id }}"
./vendor/bin/phpstan analyse --memory-limit 1G -c test/phpstan.neon src test -l "${{ matrix.level }}"
exit 0
54 changes: 54 additions & 0 deletions .github/workflows/save-baseline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Save Baseline for Phan and PHPStan

permissions:
contents: read

on:
pull_request:
types:
- closed

jobs:
run:
name: Save Baseline
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
coverage: none

- name: Install PHPStan
run: composer install

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

- name: Generate the baseline for PHPStan
continue-on-error: true
run: |
./vendor/bin/phpstan analyse --memory-limit 1G -c test/phpstan.neon --generate-baseline test/phpstan-baseline.neon src test -vvv --debug -l 2
exit 0

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

- name: Save the baseline for PHPStan
id: cache-baseline-save
uses: actions/cache/save@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2
with:
path: |
test/phpstan-baseline.neon
key: phpstan-baseline-${{ github.run_id }}"
Loading