Skip to content

Add Composer Dependency Analyser #258

Add Composer Dependency Analyser

Add Composer Dependency Analyser #258

Workflow file for this run

name: static analysis
on:
pull_request:
paths: &paths
- 'src/**'
- 'config/**'
- '.github/workflows/static.yml'
- 'psalm*.xml'
- 'composer.json'
push:
branches: ['master']
paths: *paths
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
mutation:
name: PHP ${{ matrix.php }}-${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- windows-latest
php:
- 7.4
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install PHP
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2
with:
php-version: ${{ matrix.php }}
tools: composer:v2, cs2pr
coverage: none
- name: Determine composer cache directory
run: echo "COMPOSER_CACHE_DIR=~\AppData\Local\Composer" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Cache dependencies installed with composer
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ${{ env.COMPOSER_CACHE_DIR }}
key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: |
php${{ matrix.php }}-composer-
- name: Update composer
run: composer self-update
- name: Choco install 7zip
uses: crazy-max/ghaction-chocolatey@dfdcf5bba9c0a16358a21c13a06ec5c89024b3ac # v4.1.0
with:
args: install 7zip
- uses: suisei-cn/actions-download-file@9f75b8c2dad5ccced7509c44a3b881c5613abde2 # v1.6.1
id: wincache
name: Download WinCache
with:
url: "https://downloads.sourceforge.net/project/wincache/development/wincache-2.0.0.8-dev-7.4-nts-vc15-x64.exe"
target: C:\tools\php\ext
- name: Install WinCache
run: |
cd C:\tools\php\ext
7z e -y wincache-2.0.0.8-dev-7.4-nts-vc15-x64.exe
- name: Update php.ini
run: |
cd C:\tools\php
echo extension=php_wincache.dll >> php.ini
echo wincache.enablecli=1 >> php.ini
- name: Install dependencies with composer
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
- name: Static analysis
run: vendor/bin/psalm --shepherd --stats --output-format=checkstyle | cs2pr --graceful-warnings --colorize
shell: bash