|
| 1 | +name: MO4 Coding Standard CI |
| 2 | +on: |
| 3 | + pull_request: |
| 4 | + push: |
| 5 | + schedule: |
| 6 | + - cron: '30 5 1 * *' |
| 7 | +jobs: |
| 8 | + style-checks: |
| 9 | + env: |
| 10 | + XMLLINT_INDENT: " " |
| 11 | + runs-on: ubuntu-latest |
| 12 | + steps: |
| 13 | + - name: install dependencies |
| 14 | + run: sudo apt update -qq && sudo apt -y install libxml2-utils |
| 15 | + - name: Check out repository code |
| 16 | + uses: actions/checkout@v2 |
| 17 | + - name: Install PHP |
| 18 | + uses: shivammathur/setup-php@v2 |
| 19 | + with: |
| 20 | + php-version: '7.4' |
| 21 | + coverage: 'none' |
| 22 | + - name: Cache dependencies |
| 23 | + uses: actions/cache@v2 |
| 24 | + with: |
| 25 | + path: '~/.cache/composer' |
| 26 | + key: "cache-composer-${{ hashFiles('composer.json') }}" |
| 27 | + restore-keys: 'cache-composer-' |
| 28 | + - name: run composer |
| 29 | + run: composer update --prefer-lowest --prefer-dist --no-interaction --no-progress |
| 30 | + - run: xmllint --noout --schema vendor/squizlabs/php_codesniffer/phpcs.xsd MO4/ruleset.xml |
| 31 | + - run: xmllint --noout --schema vendor/squizlabs/php_codesniffer/phpcs.xsd phpcs.mo4.xml |
| 32 | + - run: xmllint --noout --schema vendor/squizlabs/php_codesniffer/phpcs.xsd phpcs.xml.dist |
| 33 | + - run: diff -B MO4/ruleset.xml <(xmllint --format MO4/ruleset.xml) |
| 34 | + - run: diff -B phpcs.mo4.xml <(xmllint --format phpcs.mo4.xml) |
| 35 | + - run: diff -B phpcs.xml.dist <(xmllint --format phpcs.xml.dist) |
| 36 | + - name: Stylecheck against MO4 itself |
| 37 | + run: vendor/bin/phpcs |
| 38 | + run-tests: |
| 39 | + strategy: |
| 40 | + matrix: |
| 41 | + os: [ubuntu-latest] |
| 42 | + php_version: |
| 43 | + - 7.2 |
| 44 | + - 7.3 |
| 45 | + - 7.4 |
| 46 | + - 8.0 |
| 47 | + dependencies_level: |
| 48 | + - --prefer-lowest |
| 49 | + - "" |
| 50 | + include: |
| 51 | + - os: windows-latest |
| 52 | + php_version: 8.0 |
| 53 | + dependencies_level: --prefer-lowest |
| 54 | + runs-on: ${{ matrix.os }} |
| 55 | + steps: |
| 56 | + - name: Set git to use LF on windows |
| 57 | + if: ${{ matrix.os == 'windows-latest' }} |
| 58 | + run: | |
| 59 | + git config --global core.autocrlf false |
| 60 | + git config --global core.eol lf |
| 61 | + - name: Check out repository code |
| 62 | + uses: actions/checkout@v2 |
| 63 | + - name: Install PHP |
| 64 | + uses: shivammathur/setup-php@v2 |
| 65 | + with: |
| 66 | + coverage: 'xdebug' |
| 67 | + php-version: ${{ matrix.php_version }} |
| 68 | + extensions: ast-1.0.14 |
| 69 | + - name: Cache dependencies |
| 70 | + uses: actions/cache@v2 |
| 71 | + with: |
| 72 | + path: '~/.cache/composer' |
| 73 | + key: "cache-composer-${{ hashFiles('composer.json') }}" |
| 74 | + restore-keys: 'cache-composer-' |
| 75 | + - name: Run composer |
| 76 | + if: ${{ matrix.php_version != '8.0' }} |
| 77 | + run: composer update ${{ matrix.dependencies_level }} --prefer-dist --no-interaction --no-progress |
| 78 | + - name: Run composer with workaround for PHP 8 and incompatible PHPUnit |
| 79 | + if: ${{ matrix.php_version == '8.0' }} |
| 80 | + run: composer update ${{ matrix.dependencies_level }} --ignore-platform-reqs --prefer-dist --no-interaction --no-progress |
| 81 | + - name: Run tests with coverage |
| 82 | + if: ${{ matrix.php_version != '8.0' }} |
| 83 | + run: php vendor/bin/phpunit --coverage-clover=coverage.xml |
| 84 | + - name: Run tests |
| 85 | + if: ${{ matrix.php_version == '8.0' }} |
| 86 | + run: vendor/bin/phpunit |
| 87 | + - name: Run integration tests |
| 88 | + run: vendor/bin/phpcs -s --standard=MO4 integrationtests/testfile.php |
| 89 | + - name: Run PHPStan |
| 90 | + run: vendor/bin/phpstan analyse --no-progress |
| 91 | + - name: Run psalm |
| 92 | + run: vendor/bin/psalm --show-info=true |
| 93 | + - name: Run phan |
| 94 | + run: vendor/bin/phan |
| 95 | + - name: Upload coverage to Codecov |
| 96 | + uses: codecov/codecov-action@v2 |
| 97 | + with: |
| 98 | + verbose: true |
| 99 | + |
0 commit comments