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

59 lines
1.5 KiB
YAML
Raw Normal View History

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
jobs:
test:
name: Code sniff (PHP 7.4, WP Latest)
timeout-minutes: 15
runs-on: ubuntu-20.04
steps:
- name: Checkout code
2022-04-21 16:45:12 +00:00
uses: actions/checkout@v3
with:
2022-05-17 15:40:39 +00:00
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
2022-05-13 20:43:33 +00:00
- name: Dependency caching
2022-04-21 16:45:12 +00:00
uses: actions/cache@v3
id: cache-deps
with:
path: |
2022-04-21 16:45:12 +00:00
~/.pnpm-store
2022-05-16 13:01:53 +00:00
~/.local/share/pnpm/store
2022-05-13 20:43:33 +00:00
~/.cache/composer/files
key: ${{ runner.os }}-pr-code-sniff-${{ secrets.WORKFLOW_CACHE }}-${{ hashFiles('**/composer.lock', '**/pnpm-lock.yaml') }}
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
2021-11-17 03:06:22 +00:00
run: pnpm nx composer-install woocommerce
- name: Run code sniff
continue-on-error: true
2022-04-21 16:45:12 +00:00
working-directory: plugins/woocommerce
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
run: cs2pr ./phpcs-report.xml