|
| 1 | +name: Coverage |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ '**' ] |
| 6 | + pull_request: |
| 7 | + branches: [ '**' ] |
| 8 | + |
| 9 | +jobs: |
| 10 | + test: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + |
| 13 | + strategy: |
| 14 | + fail-fast: false |
| 15 | + matrix: |
| 16 | + php: ['8.2'] |
| 17 | + setup: ['stable'] |
| 18 | + |
| 19 | + name: PHP |
| 20 | + |
| 21 | + steps: |
| 22 | + - uses: actions/checkout@v2 |
| 23 | + |
| 24 | + - name: Setup PHP |
| 25 | + uses: shivammathur/setup-php@v2 |
| 26 | + with: |
| 27 | + php-version: ${{ matrix.php }} |
| 28 | + tools: composer:v2 |
| 29 | + coverage: xdebug |
| 30 | + |
| 31 | + - name: Cache Composer packages |
| 32 | + id: composer-cache |
| 33 | + uses: actions/cache@v2 |
| 34 | + with: |
| 35 | + path: vendor |
| 36 | + key: coverage-${{ runner.os }}-${{ matrix.setup }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} |
| 37 | + restore-keys: | |
| 38 | + coverage-${{ runner.os }}-${{ matrix.setup }}-php-${{ matrix.php }}- |
| 39 | +
|
| 40 | + - name: Code Climate Test Reporter Preparation |
| 41 | + run: | |
| 42 | + curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter |
| 43 | + chmod +x ./cc-test-reporter |
| 44 | + ./cc-test-reporter before-build |
| 45 | + env: |
| 46 | + CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} |
| 47 | + |
| 48 | + - name: Install dependencies |
| 49 | + if: steps.composer-cache.outputs.cache-hit != 'true' |
| 50 | + run: | |
| 51 | + composer config version 1.9.0 |
| 52 | + composer update --prefer-dist ${{ matrix.setup != 'next' && format('--prefer-{0}', matrix.setup) || '' }} --no-progress ${{ matrix.php >= 8.1 && '--ignore-platform-req=php' || '' }} |
| 53 | +
|
| 54 | + - name: Prepare git config |
| 55 | + run: | |
| 56 | + git config --global init.defaultBranch main |
| 57 | + git config --global user.name tester |
| 58 | + git config --global user.email tester@phug-lang.com |
| 59 | +
|
| 60 | + - name: Run test suite |
| 61 | + run: vendor/bin/phpunit --coverage-text --coverage-clover=coverage.xml |
| 62 | + |
| 63 | + - name: Code Climate Test Reporter |
| 64 | + if: ${{ env.CC_TEST_REPORTER_ID != '' }} |
| 65 | + run: | |
| 66 | + cp coverage.xml clover.xml |
| 67 | + bash <(curl -s https://codecov.io/bash) |
| 68 | + ./cc-test-reporter after-build --coverage-input-type clover --exit-code 0 |
| 69 | + composer config version 1.9.0 |
| 70 | + env: |
| 71 | + CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} |
0 commit comments