woocommerce/.github/workflows/pr-code-sniff.yml

60 lines
1.6 KiB
YAML

name: Run code sniff on PR
on:
pull_request
defaults:
run:
shell: bash
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: Code sniff (PHP 7.4, WP Latest)
timeout-minutes: 15
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 100
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
tools: composer, cs2pr
- name: Tool versions
run: |
php --version
composer --version
- name: Get cached composer and pnpm directories
uses: actions/cache@v3
id: cache-deps
with:
path: |
~/.pnpm-store
plugins/woocommerce/packages
plugins/woocommerce/**/vendor
key: ${{ runner.os }}-npm-composer-version-${{ secrets.WORKFLOW_CACHE }}-${{ hashFiles('**/composer.lock', '**/pnpm-lock.yaml') }}
- name: Install PNPM
run: npm install -g pnpm@^6.24.2
- name: Install dependencies
run: pnpm install
- name: Install Composer dependencies
if: steps.cache-deps.outputs.cache-hit != 'true'
run: pnpm nx composer-install woocommerce
- name: Run code sniff
continue-on-error: true
working-directory: plugins/woocommerce
run: ./tests/bin/phpcs.sh "${{ github.event.pull_request.base.sha }}" "${{ github.event.after }}"
- name: Show PHPCS results in PR
working-directory: plugins/woocommerce
run: cs2pr ./phpcs-report.xml