Skip to content

GH Actions: use the xmllint-validate action runner #35

GH Actions: use the xmllint-validate action runner

GH Actions: use the xmllint-validate action runner #35

Workflow file for this run

name: QA
on:
pull_request:
push:
branches:
- develop
- master
# 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:
check:
name: 'Basic QA checks'
runs-on: ubuntu-latest
env:
XMLLINT_INDENT: ' '
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: 'latest'
coverage: none
tools: cs2pr
# Validate the composer.json file.
# @link https://getcomposer.org/doc/03-cli.md#validate
- name: Validate Composer installation
run: composer validate --no-check-all --strict
# Verify the package can be installed succesfully.
# @link https://github.com/marketplace/actions/install-php-dependencies-with-composer
- name: Install Composer dependencies
uses: ramsey/composer-install@v3
with:
# Bust the cache at least once a month - output format: YYYY-MM.
custom-cache-suffix: $(date -u "+%Y-%m")
# Validate the xml file.
- name: Validate against schema
uses: phpcsstandards/xmllint-validate@v1
with:
pattern: "PHPParallelLint/ruleset.xml"
xsd-file: "vendor/squizlabs/php_codesniffer/phpcs.xsd"
# Check the code-style consistency of the XML ruleset file.
# Note: this needs xmllint, but that will be installed via the phpcsstandards/xmllint-validate action runner in the previous step.
- name: Check XML ruleset code style
run: diff -B --tabsize=4 ./PHPParallelLint/ruleset.xml <(xmllint --format "./PHPParallelLint/ruleset.xml")