CodeIgniter4/.github/workflows/test-phpstan.yml

87 lines
2.1 KiB
YAML
Raw Normal View History

# When a PR is opened or a push is made, perform
# a static analysis check on the code using PHPStan.
2020-08-26 15:19:03 +00:00
name: PHPStan
on:
pull_request:
branches:
- 'develop'
2022-06-08 06:31:57 +09:00
- '4.*'
2020-08-26 15:19:03 +00:00
paths:
- 'app/**.php'
- 'system/**.php'
- 'utils/**.php'
2021-01-19 15:25:27 +00:00
- composer.json
2023-07-21 10:09:37 +09:00
- phpstan.neon.dist
- phpstan-baseline.php
- '.github/workflows/test-phpstan.yml'
push:
branches:
- 'develop'
2022-06-08 06:31:57 +09:00
- '4.*'
paths:
- 'app/**.php'
- 'system/**.php'
- 'utils/**.php'
2021-01-19 15:25:27 +00:00
- composer.json
2023-07-21 10:09:37 +09:00
- phpstan.neon.dist
- phpstan-baseline.php
- '.github/workflows/test-phpstan.yml'
2020-08-26 15:19:03 +00:00
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
2022-12-26 21:41:12 +07:00
permissions:
contents: read
2020-08-26 15:19:03 +00:00
jobs:
build:
2020-12-21 18:00:02 +00:00
name: PHP ${{ matrix.php-versions }} Static Analysis
2022-10-23 23:34:46 +08:00
runs-on: ubuntu-22.04
2020-12-21 18:00:02 +00:00
strategy:
fail-fast: false
2020-08-26 15:19:03 +00:00
steps:
- name: Checkout
uses: actions/checkout@v4
2020-08-26 15:19:03 +00:00
- name: Setup PHP
uses: shivammathur/setup-php@v2
2020-08-26 15:19:03 +00:00
with:
2022-10-13 08:53:58 +09:00
php-version: '8.1'
2020-08-26 15:19:03 +00:00
extensions: intl
coverage: none
2020-08-26 15:19:03 +00:00
- name: Use latest Composer
run: composer self-update
- name: Validate composer.json
run: composer validate --strict
- name: Get composer cache directory
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV
- name: Cache dependencies
uses: actions/cache@v4
with:
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
2020-08-26 15:19:03 +00:00
- name: Create PHPStan result cache directory
run: mkdir -p build/phpstan
- name: Cache PHPStan result cache directory
uses: actions/cache@v4
with:
path: build/phpstan
key: ${{ runner.os }}-phpstan-${{ github.sha }}
restore-keys: ${{ runner.os }}-phpstan-
- name: Install dependencies
2020-11-06 23:54:24 +08:00
run: composer update --ansi --no-interaction
2020-08-26 15:19:03 +00:00
- name: Run static analysis
run: vendor/bin/phpstan analyse