Skip to content

Merge pull request #12 from GatherPress/main #7

Merge pull request #12 from GatherPress/main

Merge pull request #12 from GatherPress/main #7

name: Coding Standards
on:
push:
branches:
- main
pull_request:
jobs:
phpcs:
name: PHP Coding Standards
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Get Composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Set up Composer caching
uses: actions/cache@v2
env:
cache-name: cache-composer-dependencies
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
coverage: none
tools: composer, cs2pr
- name: Install Composer dependencies
run: |
composer install --prefer-dist --no-suggest --no-progress --no-ansi --no-interaction
echo "vendor/bin" >> $GITHUB_PATH
- name: Log PHPCS debug information
run: phpcs -i
- name: Run PHPCS on all Core files
run: vendor/bin/phpcs --standard=phpcs.ruleset.xml --extensions=php --colors -s -p -v .
- name: Check test suite files for warnings
run: vendor/bin/phpcs test --standard=phpcs.ruleset.xml --extensions=php --colors -s -p -v .
jshint:
name: JavaScript Coding Standards
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Log debug information
run: |
npm --version
node --version
git --version
php --version
composer --version
- name: Install NodeJS
uses: actions/setup-node@v2
with:
node-version-file: '.nvmrc'
- name: NPM install
run: npm ci --legacy-peer-deps
- name: Run JSHint
run: npm run lint:js
if: ${{ success() || failure() }}