Skip to content

string generator library #1

string generator library

string generator library #1

Workflow file for this run

name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
permissions:
contents: read
env:
PHP_PRIMARY: '8.5'
jobs:
validate:
name: Validate composer.json
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.PHP_PRIMARY }}
tools: composer:v2
- run: composer validate --strict
tests:
name: Tests / PHP ${{ matrix.php }}
runs-on: ubuntu-latest
needs: validate
strategy:
fail-fast: false
matrix:
php: ['8.2', '8.3', '8.4', '8.5', '8.6']
steps:
- uses: actions/checkout@v6
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: ${{ matrix.php == env.PHP_PRIMARY && 'xdebug' || 'none' }}
tools: composer:v2
- name: Cache Composer packages
uses: actions/cache@v4
with:
path: vendor
key: php-${{ matrix.php }}-${{ hashFiles('composer.json') }}
restore-keys: php-${{ matrix.php }}-
- run: composer install --no-interaction --no-progress --prefer-dist
- name: Run tests
if: matrix.php != env.PHP_PRIMARY
run: vendor/bin/phpunit --colors=always
- name: Run tests with coverage
if: matrix.php == env.PHP_PRIMARY
run: vendor/bin/phpunit --colors=always --coverage-text
env:
XDEBUG_MODE: coverage
phpstan:
name: PHPStan
runs-on: ubuntu-latest
needs: validate
steps:
- uses: actions/checkout@v6
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.PHP_PRIMARY }}
tools: composer:v2
- name: Cache Composer packages
uses: actions/cache@v4
with:
path: vendor
key: php-${{ env.PHP_PRIMARY }}-${{ hashFiles('composer.json') }}
restore-keys: php-${{ env.PHP_PRIMARY }}-
- run: composer install --no-interaction --no-progress --prefer-dist
- run: vendor/bin/phpstan analyse --no-progress --error-format=github
benchmark:
name: Benchmark
runs-on: ubuntu-latest
needs: tests
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.PHP_PRIMARY }}
coverage: none
extensions: curl, dom, mbstring, tokenizer, xml
ini-values: opcache.enable_cli=1, opcache.jit=1255, opcache.jit_buffer_size=128M
tools: composer:v2
- name: Cache Composer packages
uses: actions/cache@v4
with:
path: vendor
key: php-${{ env.PHP_PRIMARY }}-bench-${{ hashFiles('composer.json') }}
restore-keys: php-${{ env.PHP_PRIMARY }}-bench-
- run: composer install --no-interaction --no-progress --prefer-dist
- name: Benchmark baseline (master)
if: github.event_name == 'pull_request'
run: |
git checkout ${{ github.event.pull_request.base.sha }}
if [ ! -f phpbench.json ]; then
echo "No phpbench.json on base — skipping baseline"
git checkout ${{ github.event.pull_request.head.sha }}
exit 0
fi
composer install --no-interaction --no-progress --prefer-dist --quiet
vendor/bin/phpbench run --tag=baseline --progress=plain
git checkout ${{ github.event.pull_request.head.sha }}
composer install --no-interaction --no-progress --prefer-dist --quiet
- name: Benchmark (compare with baseline)
if: github.event_name == 'pull_request'
run: |
if vendor/bin/phpbench report --ref=baseline > /dev/null 2>&1; then
vendor/bin/phpbench run --ref=baseline --report=default --progress=plain
else
echo "No baseline available — running without comparison"
vendor/bin/phpbench run --report=default --progress=plain
fi
- name: Benchmark
if: github.event_name == 'push'
run: vendor/bin/phpbench run --report=default --progress=plain