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
|
|
|
|
working-directory: plugins/woocommerce
|
2021-02-09 10:39:56 +00:00
|
|
|
jobs:
|
|
|
|
test:
|
|
|
|
name: Code sniff (PHP 7.4, WP Latest)
|
|
|
|
timeout-minutes: 15
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-03-29 03:53:58 +00:00
|
|
|
- name: Cancel Previous Runs
|
|
|
|
uses: styfle/cancel-workflow-action@0.7.0
|
|
|
|
with:
|
|
|
|
access_token: ${{ github.token }}
|
|
|
|
|
2021-02-09 10:39:56 +00:00
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
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
|
|
|
|
|
|
|
|
- name: Get cached composer directories
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
./packages
|
|
|
|
./vendor
|
|
|
|
key: ${{ runner.os }}-${{ hashFiles('./composer.lock') }}
|
|
|
|
|
2021-11-17 03:06:22 +00:00
|
|
|
- name: Install PNPM and install dependencies
|
|
|
|
run: |
|
|
|
|
npm install -g pnpm
|
|
|
|
pnpm install
|
|
|
|
|
2021-02-09 10:39:56 +00:00
|
|
|
- name: Setup and install composer
|
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
|
|
|
|
run: ./tests/bin/phpcs.sh "${{ github.event.pull_request.base.sha }}" "${{ github.event.after }}"
|
|
|
|
|
|
|
|
- name: Show PHPCS results in PR
|
|
|
|
run: cs2pr ./phpcs-report.xml
|