Gate Cypress workflow on 'run e2e tests' label to match pro #18710
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| on: | |
| # Trigger the workflow on push or pull request, | |
| # but only for the main branch | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| types: [ opened, labeled, synchronize ] | |
| name: Inspections | |
| # Cancel superseded runs for the same branch. The group is named explicitly | |
| # rather than derived from github.workflow: several files share the workflow | |
| # name `Inspections` and would otherwise cancel each other. | |
| concurrency: | |
| group: formidable-phpcs-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| runPHPCSInspection: | |
| if: contains(github.event.pull_request.labels.*.name, 'run analysis') | |
| name: Run PHPCS inspection | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4.1.1 | |
| # Install only what this job runs, instead of every require-dev package. | |
| # phpcs.xml references WordPress, WordPressVIPMinimum and SlevomatCodingStandard; | |
| # wpcs also pulls phpcsextra/phpcsutils and the dealerdirect installer that | |
| # registers all three standards with phpcs. | |
| # The guard fails the job if a package is renamed or dropped from | |
| # composer.json, rather than silently narrowing to nothing. | |
| - name: Install PHPCS and its standards | |
| run: | | |
| NEED='squizlabs/php_codesniffer wp-coding-standards/wpcs automattic/vipwpcs slevomat/coding-standard' | |
| for pkg in $NEED; do | |
| jq -e --arg pkg "$pkg" '."require-dev" | has($pkg)' composer.json > /dev/null \ | |
| || { echo "::error::composer.json has no require-dev entry for $pkg"; exit 1; } | |
| done | |
| jq '{require, autoload, config, "require-dev": (."require-dev" | with_entries(select(.key as $k | $ARGS.positional | index($k))))}' \ | |
| composer.json --args $NEED > composer.ci.json | |
| COMPOSER=composer.ci.json composer install --prefer-dist --no-progress | |
| - name: Register custom PHPCS sniffs | |
| run: | | |
| CURRENT_PATHS=$(./vendor/bin/phpcs --config-show | grep 'installed_paths' | cut -d' ' -f2) | |
| ./vendor/bin/phpcs --config-set installed_paths "$CURRENT_PATHS,../../../phpcs-sniffs" | |
| - name: PHPCS check | |
| run: ./vendor/bin/phpcs --parallel=10 ./ |