Skip to content

Merge pull request #9 from longitude-one/map-feature #44

Merge pull request #9 from longitude-one/map-feature

Merge pull request #9 from longitude-one/map-feature #44

Workflow file for this run

name: PHP CI
on:
push:
pull_request:
branches:
- main
- dev
permissions:
contents: read
jobs:
build:
name: "PHP Tests"
runs-on: ubuntu-latest
strategy:
matrix:
php-version: [ '8.1', '8.2', '8.3' ]
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-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Set up PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: none
tools: composer:v2
- name: Install dependencies
run: composer --prefer-source install
- name: Run tests
run: ./vendor/bin/phpunit
## Quality checks
## PHP-CS-Fixer
- name: Cache Composer PHP-CS-FIXER packages
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
run: composer update --working-dir=quality/php-cs-fixer
- name: Run PHP-CS-Fixer
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
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
run: composer update --working-dir=quality/php-mess-detector
- name: Run PHP-MESS-DETECTOR on lib directory
run: ./quality/php-mess-detector/vendor/bin/phpmd lib text quality/php-mess-detector/ruleset.xml
- name: Run PHP-MESS-DETECTOR on tests directory
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
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
run: composer update --working-dir=quality/php-stan
- name: Run PHP-STAN
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