|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: |
| 6 | + - "*.*" |
| 7 | + - master |
| 8 | + push: |
| 9 | + branches: |
| 10 | + - "*.*" |
| 11 | + - master |
| 12 | + |
| 13 | +env: |
| 14 | + COMPOSER_ROOT_VERSION: "1.4" |
| 15 | + |
| 16 | +jobs: |
| 17 | + build: |
| 18 | + runs-on: ubuntu-16.04 |
| 19 | + strategy: |
| 20 | + fail-fast: false |
| 21 | + matrix: |
| 22 | + include: |
| 23 | + - php-version: 5.6 |
| 24 | + graphql-version: "^0.11.2" |
| 25 | + composer-flags: "--prefer-lowest" |
| 26 | + symfony-deprecation-helper: "disabled" |
| 27 | + |
| 28 | + - php-version: 5.6 |
| 29 | + graphql-version: "0.12" |
| 30 | + symfony-version: "3.1.*" |
| 31 | + symfony-deprecation-helper: "disabled" |
| 32 | + |
| 33 | + - php-version: 7.0 |
| 34 | + symfony-version: "3.2.*" |
| 35 | + phpunit-version: "^5.7.26" |
| 36 | + |
| 37 | + - php-version: 7.1 |
| 38 | + |
| 39 | + - php-version: 7.2 |
| 40 | + symfony-version: "3.4.*" |
| 41 | + |
| 42 | + - php-version: 7.3 |
| 43 | + symfony-version: "4.1.*" |
| 44 | + |
| 45 | + - php-version: 7.4 |
| 46 | + symfony-version: "4.3.*" |
| 47 | + |
| 48 | + - php-version: 7.3 |
| 49 | + symfony-version: "4.4.*" |
| 50 | + symfony-deprecation-helper: "max[total]=0" |
| 51 | + |
| 52 | + - php-version: 7.3 |
| 53 | + symfony-version: "5.0.*" |
| 54 | + symfony-deprecation-helper: "max[total]=0" |
| 55 | + |
| 56 | + - php-version: 7.4 |
| 57 | + symfony-version: "5.1.*" |
| 58 | + |
| 59 | + - php-version: 7.4 |
| 60 | + symfony-version: "5.2.*" |
| 61 | + |
| 62 | + name: "PHP ${{ matrix.php-version }} / Symfony ${{ matrix.symfony-version }} Test" |
| 63 | + |
| 64 | + steps: |
| 65 | + - name: "Checkout" |
| 66 | + uses: "actions/checkout@v2" |
| 67 | + with: |
| 68 | + fetch-depth: 50 |
| 69 | + |
| 70 | + - name: "Install PHP without coverage" |
| 71 | + uses: "shivammathur/setup-php@v2" |
| 72 | + with: |
| 73 | + php-version: "${{ matrix.php-version }}" |
| 74 | + coverage: "none" |
| 75 | + |
| 76 | + - name: "Cache dependencies installed with composer" |
| 77 | + uses: "actions/cache@v2" |
| 78 | + with: |
| 79 | + path: "~/.composer/cache" |
| 80 | + key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}" |
| 81 | + restore-keys: "php-${{ matrix.php-version }}-composer-locked-" |
| 82 | + |
| 83 | + - name: "Change stability" |
| 84 | + if: matrix.stability != '' |
| 85 | + run: perl -pi -e 's/^}$/,"minimum-stability":"'"${{ matrix.minimum-stability }}"'"}/' composer.json |
| 86 | + |
| 87 | + - name: "Symfony version" |
| 88 | + if: matrix.symfony-version != '' |
| 89 | + run: perl -pi -e 's#"(symfony/.*)":\s*".*"#"$1":"'"${{ matrix.symfony-version }}"'"#' composer.json |
| 90 | + |
| 91 | + - name: "PhpUnit version" |
| 92 | + if: matrix.phpunit-version != '' |
| 93 | + run: composer req "phpunit/phpunit:${{ matrix.phpunit-version }}" --dev --no-update |
| 94 | + |
| 95 | + - name: "Webonyx GraphQL version" |
| 96 | + if: matrix.graphql-version != '' |
| 97 | + run: composer req "webonyx/graphql-php:${{ matrix.graphql-version }}" --dev --no-update |
| 98 | + |
| 99 | + - name: "Install dependencies" |
| 100 | + run: composer update --no-interaction --no-interaction --no-progress ${{ matrix.composer-flags }} |
| 101 | + |
| 102 | + - name: "Set SYMFONY_DEPRECATIONS_HELPER if needed" |
| 103 | + if: matrix.symfony-deprecation-helper != '' |
| 104 | + run: export SYMFONY_DEPRECATIONS_HELPER=${{ matrix.symfony-deprecation-helper }} |
| 105 | + |
| 106 | + - name: "Run tests" |
| 107 | + run: composer test |
| 108 | + |
| 109 | + coding-standard: |
| 110 | + runs-on: ubuntu-16.04 |
| 111 | + name: Coding Standard |
| 112 | + steps: |
| 113 | + - name: "Checkout" |
| 114 | + uses: "actions/checkout@v2" |
| 115 | + with: |
| 116 | + fetch-depth: 50 |
| 117 | + |
| 118 | + - name: "Install PHP without coverage" |
| 119 | + uses: "shivammathur/setup-php@v2" |
| 120 | + with: |
| 121 | + php-version: "7.2" |
| 122 | + coverage: "none" |
| 123 | + |
| 124 | + - name: "Cache dependencies installed with composer" |
| 125 | + uses: "actions/cache@v2" |
| 126 | + with: |
| 127 | + path: "~/.composer/cache" |
| 128 | + key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}" |
| 129 | + restore-keys: "php-${{ matrix.php-version }}-composer-locked-" |
| 130 | + |
| 131 | + - name: "Install dependencies" |
| 132 | + run: composer update --no-interaction --no-interaction --no-progress |
| 133 | + |
| 134 | + - name: "Check coding standard" |
| 135 | + run: composer check-cs |
| 136 | + |
| 137 | + benchmark: |
| 138 | + runs-on: ubuntu-16.04 |
| 139 | + name: Benchmark |
| 140 | + steps: |
| 141 | + - name: "Checkout" |
| 142 | + uses: "actions/checkout@v2" |
| 143 | + with: |
| 144 | + fetch-depth: 50 |
| 145 | + |
| 146 | + - name: "Install PHP without coverage" |
| 147 | + uses: "shivammathur/setup-php@v2" |
| 148 | + with: |
| 149 | + php-version: "7.2" |
| 150 | + coverage: "none" |
| 151 | + |
| 152 | + - name: "Cache dependencies installed with composer" |
| 153 | + uses: "actions/cache@v2" |
| 154 | + with: |
| 155 | + path: "~/.composer/cache" |
| 156 | + key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}" |
| 157 | + restore-keys: "php-${{ matrix.php-version }}-composer-locked-" |
| 158 | + |
| 159 | + - name: "Install dependencies" |
| 160 | + run: composer update --no-interaction --no-interaction --no-progress |
| 161 | + |
| 162 | + - name: "Run benchmark" |
| 163 | + run: composer bench |
| 164 | + |
| 165 | + static-analysis: |
| 166 | + runs-on: ubuntu-16.04 |
| 167 | + name: "Static analysis" |
| 168 | + steps: |
| 169 | + - name: "Checkout" |
| 170 | + uses: "actions/checkout@v2" |
| 171 | + with: |
| 172 | + fetch-depth: 50 |
| 173 | + |
| 174 | + - name: "Install PHP with coverage" |
| 175 | + uses: "shivammathur/setup-php@v2" |
| 176 | + with: |
| 177 | + php-version: "7.2" |
| 178 | + coverage: "none" |
| 179 | + |
| 180 | + - name: "Cache dependencies installed with composer" |
| 181 | + uses: "actions/cache@v2" |
| 182 | + with: |
| 183 | + path: "~/.composer/cache" |
| 184 | + key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}" |
| 185 | + restore-keys: "php-${{ matrix.php-version }}-composer-locked-" |
| 186 | + |
| 187 | + - name: "Install dependencies" |
| 188 | + run: composer update --no-interaction --no-interaction --no-progress |
| 189 | + |
| 190 | + - name: "Run static-analysis" |
| 191 | + run: composer static-analysis |
| 192 | + |
| 193 | + coverage: |
| 194 | + runs-on: ubuntu-16.04 |
| 195 | + name: "Coverage" |
| 196 | + steps: |
| 197 | + - name: "Checkout" |
| 198 | + uses: "actions/checkout@v2" |
| 199 | + with: |
| 200 | + ref: ${{ github.ref }} |
| 201 | + |
| 202 | + - name: "Install PHP with coverage" |
| 203 | + uses: "shivammathur/setup-php@v2" |
| 204 | + with: |
| 205 | + php-version: "7.2" |
| 206 | + ini-values: pcov.directory=. |
| 207 | + coverage: "pcov" |
| 208 | + |
| 209 | + - name: "Cache dependencies installed with composer" |
| 210 | + uses: "actions/cache@v2" |
| 211 | + with: |
| 212 | + path: "~/.composer/cache" |
| 213 | + key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}" |
| 214 | + restore-keys: "php-${{ matrix.php-version }}-composer-locked-" |
| 215 | + |
| 216 | + - name: "Symfony 4.4 version" |
| 217 | + run: perl -pi -e 's#"(symfony/.*)":\s*".*"#"$1":"'"4.4.*"'"#' composer.json |
| 218 | + |
| 219 | + - name: "Install dependencies" |
| 220 | + run: composer update --no-interaction --no-interaction --no-progress |
| 221 | + |
| 222 | + - name: "Setup PCOV for PHPUnit < 8" |
| 223 | + run: | |
| 224 | + composer require pcov/clobber |
| 225 | + bin/pcov clobber |
| 226 | +
|
| 227 | + - name: "Run tests with coverage" |
| 228 | + run: bin/phpunit --color=always -v --debug --coverage-clover=build/logs/clover.xml |
| 229 | + |
| 230 | + - name: "Upload coverage results to Scrutinizer" |
| 231 | + run: | |
| 232 | + wget https://scrutinizer-ci.com/ocular.phar |
| 233 | + php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml |
| 234 | +
|
| 235 | + - name: "Upload coverage results to Coveralls" |
| 236 | + env: |
| 237 | + COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} |
| 238 | + COVERALLS_RUN_LOCALLY: 1 |
| 239 | + run: | |
| 240 | + composer global require php-coveralls/php-coveralls |
| 241 | + php-coveralls --coverage_clover=build/logs/clover.xml -v |
0 commit comments