More trial and error #13
Workflow file for this run
This file contains 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
name: Basic QA checks | |
on: | |
push: | |
pull_request: | |
# Allow manually triggering the workflow. | |
workflow_dispatch: | |
# Cancels all previous workflow runs for the same branch that have not yet completed. | |
concurrency: | |
# The concurrency group contains the workflow name and the branch name. | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
# Makes sure the rulesets don't throw unexpected errors or warnings. | |
# This workflow needs to be run against a high PHP version to prevent triggering the syntax error check. | |
# It also needs to be run against all PHPCS versions WPCS is tested against. | |
ruleset-tests: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php: [ 'latest' ] | |
phpcs_version: [ 'dev-master' ] | |
name: "Ruleset test: PHP ${{ matrix.php }} on PHPCS ${{ matrix.phpcs_version }}" | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
# Allow for PHP deprecation notices. | |
ini-values: error_reporting = E_ALL & ~E_DEPRECATED | |
coverage: none | |
- name: "Set PHPCS version (master)" | |
if: ${{ matrix.phpcs_version != 'lowest' }} | |
run: composer require squizlabs/php_codesniffer:"${{ matrix.phpcs_version }}" --no-update --no-scripts --no-interaction | |
- name: Install Composer dependencies | |
uses: ramsey/composer-install@v2 | |
with: | |
composer-options: --no-dev | |
# Bust the cache at least once a month - output format: YYYY-MM. | |
custom-cache-suffix: $(date -u "+%Y-%m") | |
# Test for fixer conflicts by running the auto-fixers of the complete WPCS over the test case files. | |
# This is not an exhaustive test, but should give an early indication for typical fixer conflicts. | |
# If only fixable errors are found, the exit code will be 1, which can be interpreted as success. | |
- name: Test for fixer conflicts (fixes expected) | |
if: ${{ matrix.phpcs_version == 'dev-master' }} | |
id: phpcbf | |
continue-on-error: true | |
run: | | |
set +e | |
$(pwd)/vendor/bin/phpcbf -pq ./WordPress/Tests/ --standard=WordPress --extensions=inc --exclude=Generic.PHP.Syntax --report=summary | |
exitcode="$?" | |
echo 'EXITCODE=$exitcode' >> $GITHUB_OUTPUT | |
echo 'Reached this point!' | |
exit "$exitcode" | |
- name: "DEBUG: Show grabbed exitcode" | |
run: echo ${{ steps.phpcbf.outputs.EXITCODE }} | |
- name: Fail the build on fixer conflicts | |
if: ${{ steps.phpcbf.outputs.EXITCODE != 0 && steps.phpcbf.outputs.EXITCODE != 1 }} | |
run: | | |
echo "Exit code of fixer conflict check was: ${{ steps.phpcbf.outputs.EXITCODE }}" | |
exit 1 |