Skip to content

Merge pull request #903 from westonruter/dependabot/npm_and_yarn/word… #930

Merge pull request #903 from westonruter/dependabot/npm_and_yarn/word…

Merge pull request #903 from westonruter/dependabot/npm_and_yarn/word… #930

Workflow file for this run

name: Continuous Integration
on:
pull_request:
push:
branches:
- develop
- "*.*"
# Cancel previous workflow run groups that have not completed.
concurrency:
# Group workflow runs by workflow name, along with the head branch ref of the pull request
# or otherwise the branch or tag ref.
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
lint-css:
name: 'Lint and Analyze'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/[email protected]
with:
node-version-file: '.nvmrc'
cache: npm
- name: Install Node dependencies
run: npm ci
env:
CI: true
- name: Validate package.json
run: npm run lint:pkg-json
- name: Check @wordpress/block-library checksum
run: npm run md5sum:check
- name: Detect coding standard violations (stylelint)
run: npm run lint:css
- name: Detect ESLint coding standard violations
if: >
github.event.pull_request.head.repo.fork == true ||
github.event.pull_request.user.login == 'dependabot[bot]'
run: npm run lint:js
- name: Generate ESLint coding standard violations report
# Prevent generating the ESLint report if PR is from a fork or authored by Dependabot.
if: >
! ( github.event.pull_request.head.repo.fork == true ||
github.event.pull_request.user.login == 'dependabot[bot]' )
run: npm run lint:js:report
continue-on-error: true
- name: Annotate code linting results
# The action cannot annotate the PR when run from a PR fork or was authored by Dependabot.
if: >
! ( github.event.pull_request.head.repo.fork == true ||
github.event.pull_request.user.login == 'dependabot[bot]' )
uses: ataylorme/[email protected]
with:
repo-token: '${{ secrets.GITHUB_TOKEN }}'
report-json: 'lint-js-report.json'
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
extensions: dom, iconv, json, libxml, zip
coverage: none
tools: phpstan, cs2pr
- name: Get Composer Cache Directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Configure Composer cache
uses: actions/[email protected]
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install Composer dependencies
run: composer install --prefer-dist --optimize-autoloader --no-progress --no-interaction
- name: Validate composer.json
run: composer --no-interaction validate --no-check-all
- name: Detect coding standard violations (PHPCS)
run: vendor/bin/phpcs -q --report=checkstyle --runtime-set ignore_errors_on_exit 1 --runtime-set ignore_warnings_on_exit 1 | cs2pr --graceful-warnings
- name: Normalize composer.json
run: composer --no-interaction normalize --dry-run
- name: Static Analysis (PHPStan)
run: |
phpstan --version
phpstan analyse