|
| 1 | +name: tests |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - master |
| 8 | + |
| 9 | +jobs: |
| 10 | + phpstan: |
| 11 | + name: PHPStan |
| 12 | + runs-on: ubuntu-latest |
| 13 | + |
| 14 | + steps: |
| 15 | + - uses: actions/checkout@v2 |
| 16 | + |
| 17 | + - uses: php-actions/composer@v5 |
| 18 | + |
| 19 | + - name: PHPStan |
| 20 | + uses: chindit/actions-phpstan@master |
| 21 | + with: |
| 22 | + # Arguments to add to PHPStan |
| 23 | + arguments: 'src/' |
| 24 | + |
| 25 | + phpunit: |
| 26 | + name: PHPUnit |
| 27 | + runs-on: ubuntu-latest |
| 28 | + |
| 29 | + strategy: |
| 30 | + matrix: |
| 31 | + php-version: |
| 32 | + - 7.1 |
| 33 | + - 7.2 |
| 34 | + - 7.3 |
| 35 | + - 7.4 |
| 36 | +# - 8.0 |
| 37 | + dependencies: |
| 38 | + - highest |
| 39 | +# include: |
| 40 | +# - php-version: 7.1 |
| 41 | +# dependencies: lowest |
| 42 | + |
| 43 | + steps: |
| 44 | + - name: Checkout |
| 45 | + uses: actions/checkout@v2 |
| 46 | + |
| 47 | + - name: Install PHP |
| 48 | + uses: shivammathur/setup-php@v2 |
| 49 | + with: |
| 50 | + php-version: ${{ matrix.php-version }} |
| 51 | + coverage: xdebug |
| 52 | + ini-values: zend.assertions=1 |
| 53 | + |
| 54 | + - name: Install dependencies with Composer |
| 55 | + uses: ramsey/composer-install@v1 |
| 56 | + with: |
| 57 | + dependency-versions: ${{ matrix.dependencies }} |
| 58 | + |
| 59 | + - name: Install Codeclimate binary |
| 60 | + run: | |
| 61 | + curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > cc-test-reporter |
| 62 | + chmod +x ./cc-test-reporter |
| 63 | +
|
| 64 | + - name: Run Codeclimate before-build |
| 65 | + run: ./cc-test-reporter before-build |
| 66 | + |
| 67 | + - name: Run PHPUnit |
| 68 | + run: vendor/bin/phpunit --coverage-clover=clover.xml |
| 69 | + |
| 70 | + - name: Upload coverage file artifact |
| 71 | + uses: actions/upload-artifact@v2 |
| 72 | + with: |
| 73 | + name: ${{ matrix.php-version }}-${{ matrix.dependencies }} |
| 74 | + path: clover.xml |
| 75 | + |
| 76 | + - name: Run Codeclimate format-coverage |
| 77 | + run: ./cc-test-reporter format-coverage -o codeclimate.json |
| 78 | + |
| 79 | + - name: Upload coverage file artifact |
| 80 | + uses: actions/upload-artifact@v2 |
| 81 | + with: |
| 82 | + name: ${{ matrix.php-version }}-${{ matrix.dependencies }} |
| 83 | + path: codeclimate.json |
| 84 | + |
| 85 | + |
| 86 | + codeclimate-upload: |
| 87 | + name: Upload coverage to Codeclimate |
| 88 | + runs-on: ubuntu-latest |
| 89 | + needs: |
| 90 | + - phpunit |
| 91 | + env: |
| 92 | + CC_TEST_REPORTER_ID: e33b74ed1f59947df361652193b6575db0afc663dcbc73af89a0cf16f2443d24 |
| 93 | + steps: |
| 94 | + - name: Download coverage files |
| 95 | + uses: actions/download-artifact@v2 |
| 96 | + with: |
| 97 | + path: coverage |
| 98 | + - name: Install Codeclimate binary |
| 99 | + run: | |
| 100 | + curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > cc-test-reporter |
| 101 | + chmod +x ./cc-test-reporter |
| 102 | + - run: ./cc-test-reporter sum-coverage coverage/*/codeclimate.json |
| 103 | + - run: ./cc-test-reporter upload-coverage |
| 104 | + |
| 105 | + |
| 106 | + coveralls-upload: |
| 107 | + name: Upload coverage to Coveralls |
| 108 | + runs-on: ubuntu-latest |
| 109 | + needs: |
| 110 | + - phpunit |
| 111 | + steps: |
| 112 | + - name: Checkout |
| 113 | + uses: actions/checkout@v2 |
| 114 | + |
| 115 | + - name: Install PHP |
| 116 | + uses: shivammathur/setup-php@v2 |
| 117 | + with: |
| 118 | + php-version: 7.4 |
| 119 | + coverage: none |
| 120 | + |
| 121 | + - name: Download coverage files |
| 122 | + uses: actions/download-artifact@v2 |
| 123 | + with: |
| 124 | + path: build/logs |
| 125 | + |
| 126 | + - name: Install php-coveralls |
| 127 | + run: composer global require php-coveralls/php-coveralls |
| 128 | + |
| 129 | + - name: Upload coverage results to Coveralls |
| 130 | + env: |
| 131 | + COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 132 | + run: php-coveralls --coverage_clover=build/logs/*/clover.xml -v |
0 commit comments