Reorganize project structure #55
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: CI | |
on: | |
push: | |
pull_request: | |
jobs: | |
Build: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- php-version: '7.4' | |
- php-version: '8.0' | |
- php-version: '8.1' | |
job-description: with lint | |
lint: true | |
- php-version: '8.2' | |
- php-version: '8.3' | |
composer-flags: '--ignore-platform-req=php' | |
name: PHP ${{ matrix.php-version }} ${{ matrix.job-description }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-version }} | |
extensions: ctype, mbstring | |
tools: cs2pr | |
- name: Get Composer's cache directory | |
id: composer-cache-path | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache Composer dependencies | |
uses: actions/cache@v3 | |
id: composer-cache | |
with: | |
path: ${{ steps.composer-cache-path.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}-${{ matrix.composer-flags }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Install dependencies | |
env: | |
COMPOSER_ROOT_VERSION: "1.99.99" | |
run: composer install ${{ matrix.composer-flags }} | |
- name: Normalize composer.json | |
if: matrix.lint | |
run: composer normalize --dry-run | |
- name: PHP-CS-Fixer | |
if: matrix.lint | |
run: vendor/bin/php-cs-fixer fix --dry-run --format=checkstyle | cs2pr | |
- name: PHPStan | |
if: matrix.lint | |
run: vendor/bin/phpstan analyse | |
# https://github.com/marketplace/actions/setup-php-action#phpunit | |
- name: Setup problem matchers for PHPUnit | |
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" | |
- name: PHPUnit | |
run: vendor/bin/phpunit |