Skip to content

Test Rulesets

Test Rulesets #94

Workflow file for this run

name: Test Rulesets
on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
# Run weekly on Mondays at 00:00 UTC
- cron: "0 0 * * 1"
workflow_dispatch: # Allow manual triggering
# 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:
test-rulesets:
name: Test rulesets
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: [8.5, 8.4, 8.3, 8.2, 8.1, 8.0, 7.4]
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
persist-credentials: false
- name: Setup PHP
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2.37.2
with:
php-version: ${{ matrix.php }}
extensions: mbstring, xml, zip
tools: composer:v2
# Allow for PHP deprecation notices.
ini-values: error_reporting = E_ALL & ~E_DEPRECATED
coverage: none
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Validate composer.json file
run: composer validate --no-check-all --strict
- name: Install Composer dependencies
uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # v4.0.0
with:
# Bust the cache at least once a month - output format: YYYY-MM.
custom-cache-suffix: $(date -u "+%Y-%m")
- name: Download latest WPGraphQL
run: |
mkdir -p temp/wp-graphql
curl -fL -o temp/wp-graphql/wp-graphql.zip https://downloads.wordpress.org/plugin/wp-graphql.latest-stable.zip
# Unzip the downloaded file
unzip -q temp/wp-graphql/wp-graphql.zip -d temp/wp-graphql
# List files to verify extraction
ls -la temp/wp-graphql/wp-graphql
# Validate the Ruleset XML files.
- name: Validate the WordPress rulesets
uses: phpcsstandards/xmllint-validate@5189514594c8d5f4cf21b7e5af50f54d697973d7 # v2.0.0
with:
pattern: "./*/ruleset.xml"
xsd-file: "vendor/squizlabs/php_codesniffer/phpcs.xsd"
- name: Lint WPGraphQL Core
run: |
# Run the PHP CodeSniffer tests against the WPGraphQL Core ruleset.
vendor/bin/phpcs --standard=./WPGraphQL-Core/ruleset.xml --basepath=temp/wp-graphql/wp-graphql --runtime-set ignore_warnings_on_exit 1 -s temp/wp-graphql/wp-graphql/src --report-full --report-width=120