Add GitHub workflows for CI, coding standards, and analysis #1
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: Coding Standards | |
on: | |
push: | |
paths-ignore: | |
- '**.md' | |
pull_request: | |
workflow_dispatch: | |
workflow_call: | |
inputs: | |
php_version: | |
required: false | |
type: string | |
default: '8.3' | |
jobs: | |
coding-standards: | |
name: Coding Standards | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ inputs.php_version }} | |
tools: cs2pr | |
coverage: none | |
- name: Get composer cache directory | |
id: composer-cache | |
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.lock') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Install dependencies | |
run: composer install --no-interaction --no-progress --prefer-dist | |
- name: Validate composer.json | |
run: composer validate --strict | |
- name: Run PHP_CodeSniffer | |
run: ./vendor/tools/vendor/bin/phpcs -q --no-colors --report=checkstyle src tests | cs2pr |