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