All documentation examples are tested #102
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PHP CI | |
on: | |
push: | |
pull_request: | |
branches: | |
- main | |
- dev | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
continue-on-error: ${{ matrix.lexer-version == '3.1.x-dev' }} | |
strategy: | |
matrix: | |
php-version: [ '8.1', '8.2', '8.3' ] | |
lexer-version: [ '^2.1', '~3.0.0', '3.1.x-dev' ] | |
# exclude: | |
# - php-version: '8.1' | |
# lexer-version: '^3.1' | |
name: Doctrine Lexer ${{ matrix.lexer-version }} - PHP ${{ matrix.php-version }} | |
env: | |
HAS_CC_SECRET: ${{secrets.CC_TEST_REPORTER_ID != '' }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Validate composer.json | |
run: composer validate --strict | |
- name: Cache Composer packages | |
id: composer-cache | |
uses: actions/cache@v4 | |
with: | |
path: vendor | |
key: ${{ runner.os }}-php-${{ matrix.lexer-version }}${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-php-${{ matrix.lexer-version }} | |
- name: Set up PHP ${{ matrix.php-version }} | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-version }} | |
coverage: pcov | |
tools: composer:v2 | |
- name: Install dependencies | |
run: composer --prefer-source require doctrine/lexer:${{ matrix.lexer-version }} | |
- name: Run test with coverage | |
uses: paambaati/[email protected] | |
if: env.HAS_CC_SECRET == 'true' | |
env: | |
CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}} | |
with: | |
coverageCommand: vendor/bin/phpunit --coverage-clover=.phpunit.cache/clover-${{ matrix.php-version }}.xml | |
coverageLocations: ${{github.workspace}}/.phpunit.cache/clover*.xml:clover | |
- name: Run tests for forks | |
if: env.HAS_CC_SECRET != 'true' | |
run: vendor/bin/phpunit | |
## Quality checks | |
## PHP-CS-Fixer | |
- name: Cache Composer PHP-CS-FIXER packages | |
if: ${{ matrix.lexer-version == '~3.0.0' }} | |
id: composer-phpcsfixer-cache | |
uses: actions/cache@v4 | |
with: | |
path: quality/php-cs-fixer/vendor/ | |
key: ${{ runner.os }}-phpcsfixer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-phpcsfixer- | |
- name: Install PHP-CS-Fixer | |
if: ${{ matrix.lexer-version == '~3.0.0' }} | |
run: composer update --working-dir=quality/php-cs-fixer | |
- name: Run PHP-CS-Fixer | |
if: ${{ matrix.lexer-version == '~3.0.0' }} | |
run: ./quality/php-cs-fixer/vendor/bin/php-cs-fixer fix --config=quality/php-cs-fixer/.php-cs-fixer.php --dry-run --allow-risky=yes | |
## PHP-MESS-DETECTOR | |
- name: Cache Composer PHP-MESS-DETECTOR packages | |
if: ${{ matrix.lexer-version == '~3.0.0' }} | |
id: composer-phpmd-cache | |
uses: actions/cache@v4 | |
with: | |
path: quality/php-cs-fixer/vendor/ | |
key: ${{ runner.os }}-phpmd-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-phpmd- | |
- name: Install PHP-MESS-DETECTOR | |
if: ${{ matrix.lexer-version == '~3.0.0' }} | |
run: composer update --working-dir=quality/php-mess-detector | |
- name: Run PHP-MESS-DETECTOR on lib directory | |
if: ${{ matrix.lexer-version == '~3.0.0' }} | |
run: ./quality/php-mess-detector/vendor/bin/phpmd lib text quality/php-mess-detector/ruleset.xml | |
- name: Run PHP-MESS-DETECTOR on tests directory | |
if: ${{ matrix.lexer-version == '~3.0.0' }} | |
run: ./quality/php-mess-detector/vendor/bin/phpmd tests text quality/php-mess-detector/test-ruleset.xml | |
## PHP-STAN | |
- name: Cache Composer PHP-STAN packages | |
if: ${{ matrix.lexer-version == '~3.0.0' }} | |
id: composer-php-stan-cache | |
uses: actions/cache@v4 | |
with: | |
path: quality/php-cs-fixer/vendor/ | |
key: ${{ runner.os }}-php-stan-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-php-stan- | |
- name: Install PHP-STAN | |
if: ${{ matrix.lexer-version == '~3.0.0' }} | |
run: composer update --working-dir=quality/php-stan | |
- name: Run PHP-STAN | |
if: ${{ matrix.lexer-version == '~3.0.0' }} | |
run: ./quality/php-stan/vendor/bin/phpstan analyse --configuration=quality/php-stan/php-stan.neon lib tests --error-format=table --no-progress --no-interaction --no-ansi --level=9 --memory-limit=256M -v |