build #166
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: build | |
on: | |
workflow_dispatch: | |
pull_request: | |
branches: [ "main" ] | |
push: | |
branches: [ "main" ] | |
schedule: | |
- cron: '0 16 * * 0' # sunday 16:00 | |
# Actions | |
# shivammathur/setup-php@v2 https://github.com/marketplace/actions/setup-php-action | |
jobs: | |
phpcs: | |
name: Code style (phpcs) | |
runs-on: "ubuntu-latest" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.2' | |
coverage: none | |
tools: cs2pr, phpcs | |
env: | |
fail-fast: true | |
- name: Code style (phpcs) | |
run: phpcs -q --report=checkstyle | cs2pr | |
php-cs-fixer: | |
name: Code style (php-cs-fixer) | |
runs-on: "ubuntu-latest" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.2' | |
coverage: none | |
tools: cs2pr, php-cs-fixer | |
env: | |
fail-fast: true | |
- name: Code style (php-cs-fixer) | |
run: php-cs-fixer fix --dry-run --format=checkstyle | cs2pr | |
phpstan: | |
name: Code analysis (phpstan) | |
runs-on: "ubuntu-latest" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.2' | |
coverage: none | |
tools: composer:v2, phpstan | |
env: | |
fail-fast: true | |
- name: Get composer cache directory | |
id: composer-cache | |
shell: bash | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Install project dependencies | |
run: composer upgrade --no-interaction --no-progress --prefer-dist | |
- name: PHPStan | |
run: phpstan analyse --no-progress --verbose | |
tests: | |
name: PHP ${{ matrix.php-versions }} on ${{ matrix.operating-systems }} | |
runs-on: ${{ matrix.operating-systems }} | |
strategy: | |
matrix: | |
operating-systems: ["windows-latest", "ubuntu-latest"] | |
php-versions: ['8.0', '8.1', '8.2'] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup PHP on Linux | |
if: matrix.operating-systems == 'ubuntu-latest' | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
coverage: none | |
tools: composer:v2 | |
env: | |
fail-fast: true | |
- name: Setup PHP on Windows | |
if: matrix.operating-systems == 'windows-latest' | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
coverage: none | |
tools: composer:v2 | |
env: | |
fail-fast: true | |
- name: Install poppler-utils | |
if: matrix.operating-systems == 'ubuntu-latest' | |
run: | | |
sudo apt-get update -y -qq | |
sudo apt-get install -y poppler-utils | |
- name: Get composer cache directory | |
id: composer-cache | |
shell: bash | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Install project dependencies | |
run: composer upgrade --no-interaction --no-progress --prefer-dist | |
- name: Tests (phpunit) | |
run: vendor/bin/phpunit --testdox --verbose |