2021-02-09 10:39:56 +00:00
|
|
|
name: Run code sniff on PR
|
|
|
|
on:
|
|
|
|
pull_request
|
2021-10-13 03:38:36 +00:00
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
shell: bash
|
2022-04-21 16:45:12 +00:00
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
|
|
cancel-in-progress: true
|
2021-02-09 10:39:56 +00:00
|
|
|
jobs:
|
|
|
|
test:
|
|
|
|
name: Code sniff (PHP 7.4, WP Latest)
|
|
|
|
timeout-minutes: 15
|
2022-04-27 01:28:56 +00:00
|
|
|
runs-on: ubuntu-20.04
|
2021-02-09 10:39:56 +00:00
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
2022-04-21 16:45:12 +00:00
|
|
|
uses: actions/checkout@v3
|
2021-03-14 00:01:21 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 100
|
2021-02-09 10:39:56 +00:00
|
|
|
|
|
|
|
- name: Setup PHP
|
|
|
|
uses: shivammathur/setup-php@v2
|
|
|
|
with:
|
|
|
|
php-version: 7.4
|
2021-03-14 00:01:21 +00:00
|
|
|
tools: composer, cs2pr
|
2021-02-09 10:39:56 +00:00
|
|
|
|
|
|
|
- name: Tool versions
|
|
|
|
run: |
|
|
|
|
php --version
|
|
|
|
composer --version
|
|
|
|
|
2022-04-21 16:45:12 +00:00
|
|
|
- name: Get cached composer and pnpm directories
|
|
|
|
uses: actions/cache@v3
|
|
|
|
id: cache-deps
|
2021-02-09 10:39:56 +00:00
|
|
|
with:
|
|
|
|
path: |
|
2022-04-21 16:45:12 +00:00
|
|
|
~/.pnpm-store
|
|
|
|
plugins/woocommerce/packages
|
2022-04-26 14:07:15 +00:00
|
|
|
plugins/woocommerce/**/vendor
|
2022-05-04 22:20:31 +00:00
|
|
|
key: ${{ runner.os }}-npm-composer-version-${{ secrets.WORKFLOW_CACHE }}-${{ hashFiles('**/composer.lock', '**/pnpm-lock.yaml') }}
|
2021-02-09 10:39:56 +00:00
|
|
|
|
2022-04-21 16:45:12 +00:00
|
|
|
- name: Install PNPM
|
2022-05-02 17:08:52 +00:00
|
|
|
run: npm install -g pnpm@^6.24.2
|
2022-04-21 16:45:12 +00:00
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
run: pnpm install
|
2021-11-17 03:06:22 +00:00
|
|
|
|
2022-04-21 16:45:12 +00:00
|
|
|
- name: Install Composer dependencies
|
|
|
|
if: steps.cache-deps.outputs.cache-hit != 'true'
|
2021-11-17 03:06:22 +00:00
|
|
|
run: pnpm nx composer-install woocommerce
|
2021-02-09 10:39:56 +00:00
|
|
|
|
|
|
|
- name: Run code sniff
|
2021-03-14 00:01:21 +00:00
|
|
|
continue-on-error: true
|
2022-04-21 16:45:12 +00:00
|
|
|
working-directory: plugins/woocommerce
|
2021-03-14 00:01:21 +00:00
|
|
|
run: ./tests/bin/phpcs.sh "${{ github.event.pull_request.base.sha }}" "${{ github.event.after }}"
|
|
|
|
|
|
|
|
- name: Show PHPCS results in PR
|
2022-04-21 16:45:12 +00:00
|
|
|
working-directory: plugins/woocommerce
|
2021-03-14 00:01:21 +00:00
|
|
|
run: cs2pr ./phpcs-report.xml
|