|
| 1 | +name: Quicktest |
| 2 | + |
| 3 | +on: |
| 4 | + # Run on pushes, including merges, to all branches except `master`. |
| 5 | + push: |
| 6 | + branches-ignore: |
| 7 | + - master |
| 8 | + paths-ignore: |
| 9 | + - '**.md' |
| 10 | + # Allow manually triggering the workflow. |
| 11 | + workflow_dispatch: |
| 12 | + |
| 13 | +jobs: |
| 14 | + #### QUICK TEST STAGE #### |
| 15 | + # This is a much quicker test which only runs the unit tests and linting against the low/high |
| 16 | + # supported PHP/PHPCS combinations. |
| 17 | + quicktest: |
| 18 | + runs-on: ubuntu-latest |
| 19 | + |
| 20 | + strategy: |
| 21 | + matrix: |
| 22 | + include: |
| 23 | + - php: '5.4' |
| 24 | + phpcs_version: 'dev-master' |
| 25 | + wpcs_version: '2.3.*' |
| 26 | + - php: '5.4' |
| 27 | + phpcs_version: '3.5.5' |
| 28 | + wpcs_version: '2.3.*' |
| 29 | + |
| 30 | + - php: 'latest' |
| 31 | + phpcs_version: 'dev-master' |
| 32 | + wpcs_version: '2.3.*' |
| 33 | + - php: 'latest' |
| 34 | + # PHPCS 3.5.7 is the lowest version of PHPCS which supports PHP 8.0. |
| 35 | + phpcs_version: '3.5.7' |
| 36 | + wpcs_version: '2.3.*' |
| 37 | + |
| 38 | + name: "QTest${{ matrix.phpcs_version == 'dev-master' && ' + Lint' || '' }}: PHP ${{ matrix.php }} - PHPCS ${{ matrix.phpcs_version }}" |
| 39 | + |
| 40 | + |
| 41 | + steps: |
| 42 | + - name: Checkout code |
| 43 | + uses: actions/checkout@v2 |
| 44 | + |
| 45 | + # On stable PHPCS versions, allow for PHP deprecation notices. |
| 46 | + # Unit tests don't need to fail on those for stable releases where those issues won't get fixed anymore. |
| 47 | + - name: Setup ini config |
| 48 | + id: set_ini |
| 49 | + run: | |
| 50 | + if [[ "${{ matrix.phpcs_version }}" != "dev-master" ]]; then |
| 51 | + echo '::set-output name=PHP_INI::error_reporting=E_ALL & ~E_DEPRECATED' |
| 52 | + else |
| 53 | + echo '::set-output name=PHP_INI::error_reporting=E_ALL' |
| 54 | + fi |
| 55 | +
|
| 56 | + - name: Install PHP |
| 57 | + uses: shivammathur/setup-php@v2 |
| 58 | + with: |
| 59 | + php-version: ${{ matrix.php }} |
| 60 | + ini-values: ${{ steps.set_ini.outputs.PHP_INI }} |
| 61 | + coverage: none |
| 62 | + |
| 63 | + - name: 'Composer: set PHPCS and WPCS versions for tests' |
| 64 | + run: | |
| 65 | + composer require --no-update --no-scripts squizlabs/php_codesniffer:"${{ matrix.phpcs_version }}" |
| 66 | + composer require --no-update --no-scripts wp-coding-standards/wpcs:"${{ matrix.wpcs_version }}" |
| 67 | +
|
| 68 | + # Install dependencies and handle caching in one go. |
| 69 | + # @link https://github.com/marketplace/actions/install-composer-dependencies |
| 70 | + - name: Install Composer dependencies - normal |
| 71 | + if: ${{ startsWith( matrix.php, '8' ) == false && matrix.php != 'latest' }} |
| 72 | + uses: "ramsey/composer-install@v1" |
| 73 | + |
| 74 | + # PHPUnit 7.x does not allow for installation on PHP 8, so ignore platform |
| 75 | + # requirements to get PHPUnit 7.x to install on nightly. |
| 76 | + - name: Install Composer dependencies - with ignore platform |
| 77 | + if: ${{ startsWith( matrix.php, '8' ) || matrix.php == 'latest' }} |
| 78 | + uses: "ramsey/composer-install@v1" |
| 79 | + with: |
| 80 | + composer-options: --ignore-platform-reqs |
| 81 | + |
| 82 | + - name: Lint against parse errors |
| 83 | + if: matrix.phpcs_version == 'dev-master' |
| 84 | + run: ./bin/php-lint |
| 85 | + |
| 86 | + - name: Run the unit tests |
| 87 | + run: ./bin/unit-tests |
| 88 | + |
| 89 | + - name: Run the ruleset tests |
| 90 | + run: ./bin/ruleset-tests |
0 commit comments