Skip to content

uupdate

uupdate #297

Workflow file for this run

name: CI
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
permissions:
contents: read
jobs:
test:
name: PHP ${{ matrix.php }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
php: ['8.1', '8.2', '8.3', '8.4']
os: [ubuntu-latest]
include:
- php: '8.3'
os: ubuntu-latest
primary: true
steps:
- uses: actions/checkout@v6
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: hash, mbstring
coverage: ${{ matrix.primary && 'pcov' || 'none' }}
tools: composer:v2
- name: Validate composer.json
run: composer validate --strict
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache composer dependencies
uses: actions/cache@v5
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-php-${{ matrix.php }}-
- name: Install dependencies
run: composer install --no-interaction --no-progress --prefer-dist
- name: Run test suite
if: ${{ ! matrix.primary }}
run: vendor/bin/phpunit
- name: Run test suite with coverage
if: ${{ matrix.primary }}
run: vendor/bin/phpunit --coverage-clover coverage.xml --coverage-text
- name: Smoke-test CLI on fixtures
run: bin/phpdup analyze tests/Fixtures --min-impact 5 --limit 3
- name: Upload coverage to Codecov
if: ${{ matrix.primary }}
uses: codecov/codecov-action@v6
with:
files: ./coverage.xml
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
continue-on-error: true
- name: Upload coverage artifact
if: ${{ matrix.primary }}
uses: actions/upload-artifact@v7
with:
name: coverage-${{ matrix.php }}
path: coverage.xml
static-analysis:
name: Static analysis
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
extensions: hash, mbstring
coverage: none
tools: composer:v2
- run: composer install --no-interaction --no-progress --prefer-dist
- name: Lint PHP files
run: |
find src tests -name "*.php" -print0 | xargs -0 -n1 -P4 php -l > /dev/null
- name: PHPStan (level 6)
run: vendor/bin/phpstan analyse --memory-limit=1G --no-progress
- name: Psalm
run: vendor/bin/psalm --no-progress --no-cache