|
| 1 | +name: Validate |
| 2 | + |
| 3 | +on: |
| 4 | + # Run on all pushes and on all pull requests. |
| 5 | + # Prevent the build from running when there are only irrelevant changes. |
| 6 | + push: |
| 7 | + paths-ignore: |
| 8 | + - '**.md' |
| 9 | + pull_request: |
| 10 | + paths-ignore: |
| 11 | + - '**.md' |
| 12 | + |
| 13 | +jobs: |
| 14 | + checkxml: |
| 15 | + name: Check XML files |
| 16 | + runs-on: ubuntu-latest |
| 17 | + |
| 18 | + env: |
| 19 | + XMLLINT_INDENT: ' ' |
| 20 | + |
| 21 | + steps: |
| 22 | + - name: Checkout code |
| 23 | + uses: actions/checkout@v2 |
| 24 | + |
| 25 | + - name: Install xmllint |
| 26 | + run: sudo apt-get install --no-install-recommends -y libxml2-utils |
| 27 | + |
| 28 | + - name: Retrieve XML Schema |
| 29 | + run: curl -O https://www.w3.org/2012/04/XMLSchema.xsd |
| 30 | + |
| 31 | + # Show XML violations inline in the file diff. |
| 32 | + # @link https://github.com/marketplace/actions/xmllint-problem-matcher |
| 33 | + - uses: korelstar/xmllint-problem-matcher@v1 |
| 34 | + |
| 35 | + # Validate the XML ruleset files. |
| 36 | + # @link http://xmlsoft.org/xmllint.html |
| 37 | + - name: Validate rulesets against schema |
| 38 | + run: xmllint --noout --schema phpcs.xsd ./src/Standards/*/ruleset.xml |
| 39 | + |
| 40 | + # Validate the XSD file. |
| 41 | + # @link http://xmlsoft.org/xmllint.html |
| 42 | + - name: Validate XSD against schema |
| 43 | + run: xmllint --noout --schema ./XMLSchema.xsd ./phpcs.xsd |
| 44 | + |
| 45 | + # Check the code-style consistency of the XML files. |
| 46 | + - name: Check XML code style |
| 47 | + run: | |
| 48 | + diff -B ./phpcs.xml.dist <(xmllint --format "./phpcs.xml.dist") |
| 49 | + diff -B ./src/Standards/Generic/ruleset.xml <(xmllint --format "./src/Standards/Generic/ruleset.xml") |
| 50 | + diff -B ./src/Standards/MySource/ruleset.xml <(xmllint --format "./src/Standards/MySource/ruleset.xml") |
| 51 | + diff -B ./src/Standards/PEAR/ruleset.xml <(xmllint --format "./src/Standards/PEAR/ruleset.xml") |
| 52 | + diff -B ./src/Standards/PSR1/ruleset.xml <(xmllint --format "./src/Standards/PSR1/ruleset.xml") |
| 53 | + diff -B ./src/Standards/PSR2/ruleset.xml <(xmllint --format "./src/Standards/PSR2/ruleset.xml") |
| 54 | + diff -B ./src/Standards/PSR12/ruleset.xml <(xmllint --format "./src/Standards/PSR12/ruleset.xml") |
| 55 | + diff -B ./src/Standards/Squiz/ruleset.xml <(xmllint --format "./src/Standards/Squiz/ruleset.xml") |
| 56 | + diff -B ./src/Standards/Zend/ruleset.xml <(xmllint --format "./src/Standards/Zend/ruleset.xml") |
| 57 | +
|
| 58 | + pear: |
| 59 | + name: "PHP: 7.4 | PEAR package validation" |
| 60 | + runs-on: ubuntu-latest |
| 61 | + |
| 62 | + steps: |
| 63 | + - name: Checkout code |
| 64 | + uses: actions/checkout@v2 |
| 65 | + |
| 66 | + - name: Install PHP |
| 67 | + uses: shivammathur/setup-php@v2 |
| 68 | + with: |
| 69 | + php-version: '7.4' |
| 70 | + coverage: none |
| 71 | + |
| 72 | + - name: Validate the PEAR package file contents |
| 73 | + run: php scripts/validate-pear-package.php |
0 commit comments