Skip to content

Switch to Plugin Infrastructure #198

Switch to Plugin Infrastructure

Switch to Plugin Infrastructure #198

# yaml-language-server: $schema=https://json.schemastore.org/github-workflow
name: Coding Standards
on:
push:
branches:
- 'develop'
- 'trunk'
- 'master'
pull_request:
branches:
- '**'
jobs:
build:
name: PHP Coding Standards
runs-on: ubuntu-latest
permissions:
contents: read
timeout-minutes: 10
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Get Composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Composer cache
uses: actions/cache@v3
env:
cache-name: cache-composer-dependencies
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: 8.0-${{ env.cache-name }}-${{ hashFiles('composer.json') }}
- name: PHPCS and PHPStan cache
uses: actions/cache@v3
env:
cache-name: phpcs
with:
path: tests/cache
# This uses the hash of wp-crontrol.php in its cache key because Actions doesn't support
# always pulling in a cache file and simultaneously always updating it, unlike Travis.
# This way we always pull in a cache file and refresh it with each new version of the plugin.
key: 8.0-${{ env.cache-name }}-${{ hashFiles('wp-crontrol.php') }}
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
tools: composer:2.2
coverage: none
ini-file: development
env:
fail-fast: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Debugging
run: |
php --version
composer --version
- name: Composer validate
run: composer validate --strict
- name: Install dependencies
run: |
composer install --prefer-dist
- name: Run code sniffer
run: |
composer require staabm/annotate-pull-request-from-checkstyle="^1.4"
composer test:cs2pr
composer test:analyze