|
| 1 | + |
| 2 | +name: "Continuous Integration" |
| 3 | + |
| 4 | +on: |
| 5 | + pull_request: |
| 6 | + branches: |
| 7 | + - "*.x" |
| 8 | + - "master" |
| 9 | + push: |
| 10 | + branches: |
| 11 | + - "*.x" |
| 12 | + - "master" |
| 13 | + |
| 14 | +env: |
| 15 | + fail-fast: true |
| 16 | + |
| 17 | +jobs: |
| 18 | + phpunit: |
| 19 | + name: "PHPUnit" |
| 20 | + runs-on: "ubuntu-20.04" |
| 21 | + |
| 22 | + strategy: |
| 23 | + matrix: |
| 24 | + php-version: |
| 25 | + - "7.1" |
| 26 | + - "7.2" |
| 27 | + - "7.3" |
| 28 | + - "7.4" |
| 29 | + deps: |
| 30 | + - "normal" |
| 31 | + include: |
| 32 | + - deps: "low" |
| 33 | + php-version: "7.1" |
| 34 | + |
| 35 | + steps: |
| 36 | + - name: "Checkout" |
| 37 | + uses: "actions/checkout@v2" |
| 38 | + with: |
| 39 | + fetch-depth: 2 |
| 40 | + |
| 41 | + - name: "Install PHP with PCOV" |
| 42 | + uses: "shivammathur/setup-php@v2" |
| 43 | + if: "${{ matrix.php-version != '7.1' }}" |
| 44 | + with: |
| 45 | + php-version: "${{ matrix.php-version }}" |
| 46 | + coverage: "pcov" |
| 47 | + ini-values: "zend.assertions=1" |
| 48 | + |
| 49 | + - name: "Install PHP with XDebug" |
| 50 | + uses: "shivammathur/setup-php@v2" |
| 51 | + if: "${{ matrix.php-version == '7.1' }}" |
| 52 | + with: |
| 53 | + php-version: "${{ matrix.php-version }}" |
| 54 | + coverage: "xdebug" |
| 55 | + ini-values: "zend.assertions=1" |
| 56 | + |
| 57 | + - name: "Cache dependencies installed with composer" |
| 58 | + uses: "actions/cache@v2" |
| 59 | + with: |
| 60 | + path: "~/.composer/cache" |
| 61 | + key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}" |
| 62 | + restore-keys: "php-${{ matrix.php-version }}-composer-locked-" |
| 63 | + |
| 64 | + - name: "Install dependencies with composer" |
| 65 | + run: "composer update --no-interaction --prefer-dist" |
| 66 | + if: "${{ matrix.deps == 'normal' }}" |
| 67 | + |
| 68 | + - name: "Install lowest possible dependencies with composer" |
| 69 | + run: "composer update --no-interaction --prefer-dist --prefer-lowest" |
| 70 | + if: "${{ matrix.deps == 'low' }}" |
| 71 | + |
| 72 | + - name: "Run PHPUnit" |
| 73 | + run: "vendor/bin/phpunit --coverage-clover=coverage.xml" |
| 74 | + |
| 75 | + - name: "Upload coverage file" |
| 76 | + uses: "actions/upload-artifact@v2" |
| 77 | + with: |
| 78 | + name: "phpunit-${{ matrix.deps }}-${{ matrix.php-version }}.coverage" |
| 79 | + path: "coverage.xml" |
| 80 | + |
| 81 | + upload_coverage: |
| 82 | + name: "Upload coverage to Codecov" |
| 83 | + runs-on: "ubuntu-20.04" |
| 84 | + needs: |
| 85 | + - "phpunit" |
| 86 | + |
| 87 | + steps: |
| 88 | + - name: "Checkout" |
| 89 | + uses: "actions/checkout@v2" |
| 90 | + with: |
| 91 | + fetch-depth: 2 |
| 92 | + |
| 93 | + - name: "Download coverage files" |
| 94 | + uses: "actions/download-artifact@v2" |
| 95 | + with: |
| 96 | + path: "reports" |
| 97 | + |
| 98 | + - name: "Upload to Codecov" |
| 99 | + uses: "codecov/codecov-action@v1" |
| 100 | + with: |
| 101 | + directory: reports |
0 commit comments