|
| 1 | +name: 'CI' |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + push: |
| 6 | + |
| 7 | +jobs: |
| 8 | + coding-standards: |
| 9 | + name: 'Coding Standards - PHP ${{ matrix.php-version }}' |
| 10 | + |
| 11 | + runs-on: 'ubuntu-latest' |
| 12 | + |
| 13 | + strategy: |
| 14 | + fail-fast: false |
| 15 | + matrix: |
| 16 | + php-version: |
| 17 | + - '7.4' |
| 18 | + |
| 19 | + steps: |
| 20 | + - name: 'Checkout code' |
| 21 | + uses: actions/checkout@v2 |
| 22 | + |
| 23 | + - name: 'Setup PHP' |
| 24 | + uses: shivammathur/setup-php@v2 |
| 25 | + with: |
| 26 | + coverage: 'none' |
| 27 | + extensions: 'json,dom' |
| 28 | + php-version: '${{ matrix.php-version }}' |
| 29 | + tools: php-cs-fixer |
| 30 | + |
| 31 | + - name: 'Display PHP versions' |
| 32 | + run: | |
| 33 | + php -r 'foreach (get_loaded_extensions() as $extension) echo $extension . " " . phpversion($extension) . PHP_EOL;' |
| 34 | + php -i |
| 35 | +
|
| 36 | + - name: 'Install Composer dependencies' |
| 37 | + uses: ramsey/composer-install@v1 |
| 38 | + with: |
| 39 | + composer-options: '--prefer-dist' |
| 40 | + |
| 41 | + - name: 'Display dependencies versions' |
| 42 | + run: composer show |
| 43 | + |
| 44 | + - name: "PHP Coding Standards Fixer" |
| 45 | + run: php-cs-fixer fix --dry-run --diff --using-cache=no |
| 46 | + |
| 47 | + - name: "PHP Code Style Sniffer" |
| 48 | + if: always() |
| 49 | + run: vendor/bin/phpcs --standard=php_cs.xml app src tests |
| 50 | + |
| 51 | + - name: "Psalm" |
| 52 | + if: always() |
| 53 | + run: vendor/bin/psalm |
| 54 | + |
| 55 | + tests: |
| 56 | + name: 'Tests - PHP ${{ matrix.php-version }}' |
| 57 | + |
| 58 | + runs-on: ubuntu-latest |
| 59 | + |
| 60 | + strategy: |
| 61 | + fail-fast: false |
| 62 | + matrix: |
| 63 | + include: |
| 64 | + - php-version: '7.1.3' |
| 65 | + dependency-versions: 'lowest' # Test lowest possible configuration |
| 66 | + - php-version: '7.4' |
| 67 | + - php-version: '8.0' |
| 68 | + |
| 69 | + steps: |
| 70 | + - name: 'Checkout code' |
| 71 | + uses: actions/checkout@v2 |
| 72 | + |
| 73 | + - name: 'Setup PHP' |
| 74 | + uses: shivammathur/setup-php@v2 |
| 75 | + with: |
| 76 | + coverage: 'none' |
| 77 | + extensions: 'json,dom' |
| 78 | + php-version: '${{ matrix.php-version }}' |
| 79 | + tools: php-cs-fixer |
| 80 | + |
| 81 | + - name: 'Display PHP versions' |
| 82 | + run: | |
| 83 | + php -r 'foreach (get_loaded_extensions() as $extension) echo $extension . " " . phpversion($extension) . PHP_EOL;' |
| 84 | + php -i |
| 85 | +
|
| 86 | + - name: 'Install Composer dependencies' |
| 87 | + uses: ramsey/composer-install@v1 |
| 88 | + with: |
| 89 | + composer-options: '--prefer-dist' |
| 90 | + dependency-versions: '${{ matrix.dependency-versions }}' |
| 91 | + |
| 92 | + - name: 'Display dependencies versions' |
| 93 | + run: composer show |
| 94 | + |
| 95 | + - name: 'Run tests' |
| 96 | + run: vendor/bin/phpunit |
| 97 | + |
| 98 | + code-coverage: |
| 99 | + name: 'Code Coverage - PHP ${{ matrix.php-version }}' |
| 100 | + |
| 101 | + runs-on: 'ubuntu-latest' |
| 102 | + |
| 103 | + strategy: |
| 104 | + fail-fast: false |
| 105 | + matrix: |
| 106 | + php-version: |
| 107 | + - '7.4' |
| 108 | + |
| 109 | + steps: |
| 110 | + - name: 'Checkout code' |
| 111 | + uses: actions/checkout@v2 |
| 112 | + |
| 113 | + - name: 'Setup PHP' |
| 114 | + uses: shivammathur/setup-php@v2 |
| 115 | + with: |
| 116 | + coverage: 'none' |
| 117 | + extensions: 'json,dom' |
| 118 | + php-version: '${{ matrix.php-version }}' |
| 119 | + tools: php-cs-fixer |
| 120 | + |
| 121 | + - name: 'Display PHP versions' |
| 122 | + run: | |
| 123 | + php -r 'foreach (get_loaded_extensions() as $extension) echo $extension . " " . phpversion($extension) . PHP_EOL;' |
| 124 | + php -i |
| 125 | +
|
| 126 | + - name: 'Install Composer dependencies' |
| 127 | + uses: ramsey/composer-install@v1 |
| 128 | + with: |
| 129 | + composer-options: '--prefer-dist' |
| 130 | + |
| 131 | + - name: 'Display dependencies versions' |
| 132 | + run: composer show |
| 133 | + |
| 134 | + - name: 'Run tests with coverage' |
| 135 | + run: phpdbg -qrr ./vendor/bin/phpunit --coverage-clover coverage/clover.xml |
| 136 | + |
| 137 | + - name: 'Send Coverage' |
| 138 | + continue-on-error: true |
| 139 | + timeout-minutes: 1 |
| 140 | + run: | |
| 141 | + wget https://scrutinizer-ci.com/ocular.phar |
| 142 | + php ocular.phar code-coverage:upload --format=php-clover coverage/clover.xml |
0 commit comments