|
| 1 | +name: BasicQA |
| 2 | + |
| 3 | +on: |
| 4 | + # Run on all pushes and on all pull requests. |
| 5 | + # Prevent the "push" build from running when there are only irrelevant changes. |
| 6 | + push: |
| 7 | + paths-ignore: |
| 8 | + - '**.md' |
| 9 | + pull_request: |
| 10 | + # Allow manually triggering the workflow. |
| 11 | + workflow_dispatch: |
| 12 | + |
| 13 | +jobs: |
| 14 | + checkcs: |
| 15 | + name: 'Basic CS and QA checks' |
| 16 | + runs-on: ubuntu-latest |
| 17 | + |
| 18 | + steps: |
| 19 | + - name: Checkout code |
| 20 | + uses: actions/checkout@v2 |
| 21 | + |
| 22 | + - name: Install PHP |
| 23 | + uses: shivammathur/setup-php@v2 |
| 24 | + with: |
| 25 | + php-version: '7.4' |
| 26 | + coverage: none |
| 27 | + tools: cs2pr |
| 28 | + |
| 29 | + - name: 'Lint PHP against parse errors' |
| 30 | + run: ./bin/php-lint |
| 31 | + |
| 32 | + - name: Install xmllint |
| 33 | + run: sudo apt-get install --no-install-recommends -y libxml2-utils |
| 34 | + |
| 35 | + # Show XML violations inline in the file diff. |
| 36 | + # @link https://github.com/marketplace/actions/xmllint-problem-matcher |
| 37 | + - uses: korelstar/xmllint-problem-matcher@v1 |
| 38 | + |
| 39 | + # Validate the composer.json file. |
| 40 | + # @link https://getcomposer.org/doc/03-cli.md#validate |
| 41 | + - name: Validate Composer installation |
| 42 | + run: composer validate --no-check-all --strict |
| 43 | + |
| 44 | + - name: 'Composer: adjust dependencies' |
| 45 | + # Using PHPCS `master` as an early detection system for bugs upstream. |
| 46 | + run: composer require --no-update --no-scripts squizlabs/php_codesniffer:"dev-master" |
| 47 | + |
| 48 | + # Install dependencies and handle caching in one go. |
| 49 | + # @link https://github.com/marketplace/actions/install-composer-dependencies |
| 50 | + - name: Install Composer dependencies |
| 51 | + uses: "ramsey/composer-install@v1" |
| 52 | + |
| 53 | + - name: 'Validate XML against schema and check code style' |
| 54 | + run: ./bin/xml-lint |
| 55 | + |
| 56 | + # Check the code-style consistency of the PHP files. |
| 57 | + - name: Check PHP code style |
| 58 | + continue-on-error: true |
| 59 | + run: vendor/bin/phpcs --report-full --report-checkstyle=./phpcs-report.xml |
| 60 | + |
| 61 | + - name: Show PHPCS results in PR |
| 62 | + run: cs2pr ./phpcs-report.xml |
0 commit comments