From 4f5e69cd91522ac5ab5af0114672c95091042862 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Fri, 6 Aug 2021 14:15:17 +0200 Subject: [PATCH 1/2] GH Actions: add a QA workflow for a typical PHPCS workflow This workflow will: * Validate the Composer dependencies and installation. * Verify the XML ruleset against the PHPCS schema. * Verify the XML ruleset for code style. --- .github/workflows/qa.yml | 51 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/qa.yml diff --git a/.github/workflows/qa.yml b/.github/workflows/qa.yml new file mode 100644 index 0000000..780d647 --- /dev/null +++ b/.github/workflows/qa.yml @@ -0,0 +1,51 @@ +on: + push: + branches: + - latest + pull_request: + # Allow manually triggering the workflow. + workflow_dispatch: + +name: qa +jobs: + xmllint: + name: 'Check install and XML' + runs-on: ubuntu-latest + + env: + XMLLINT_INDENT: ' ' + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Install PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '7.4' + coverage: none + + # 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 + + # Install dependencies to make sure the PHPCS XSD file is available. + - name: Install dependencies + run: composer install --prefer-dist --no-interaction --no-progress + + - name: Setup xmllint + run: sudo apt-get install --no-install-recommends -y libxml2-utils + + # Show violations inline in the file diff. + # @link https://github.com/marketplace/actions/xmllint-problem-matcher + - uses: korelstar/xmllint-problem-matcher@v1 + + # Validate the xml file. + # @link http://xmlsoft.org/xmllint.html + - name: Validate against schema + run: xmllint --noout --schema vendor/squizlabs/php_codesniffer/phpcs.xsd lib/phpDocumentor/ruleset.xml + + # Check the code-style consistency of the xml file. + - name: Check code style + run: diff -B ./lib/phpDocumentor/ruleset.xml <(xmllint --format "./lib/phpDocumentor/ruleset.xml") From e8f3422d74e30d0f2df789b0f294f65c3559b848 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sun, 8 Aug 2021 15:11:36 +0200 Subject: [PATCH 2/2] Ruleset: tidy up code style of XML ruleset --- lib/phpDocumentor/ruleset.xml | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/lib/phpDocumentor/ruleset.xml b/lib/phpDocumentor/ruleset.xml index 58bb44d..57de6e7 100644 --- a/lib/phpDocumentor/ruleset.xml +++ b/lib/phpDocumentor/ruleset.xml @@ -1,25 +1,21 @@ - + The phpDocumentor coding standard. - - - + + + - - + + - +