|
| 1 | +name: PHP Static Analysis & Tests |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ develop, 'issue/592' ] |
| 6 | + pull_request: |
| 7 | + branches: [ develop ] |
| 8 | + |
| 9 | +jobs: |
| 10 | + static-analysis: |
| 11 | + name: Static Analysis PHP ${{ matrix.php-versions }} |
| 12 | + runs-on: ${{ matrix.operating-system }} |
| 13 | + strategy: |
| 14 | + matrix: |
| 15 | + operating-system: ['ubuntu-20.04'] |
| 16 | + php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1'] |
| 17 | + |
| 18 | + steps: |
| 19 | + - name: Setup PHP |
| 20 | + uses: shivammathur/setup-php@v2 |
| 21 | + with: |
| 22 | + php-version: ${{ matrix.php-versions }} |
| 23 | + coverage: none |
| 24 | + |
| 25 | + - uses: actions/checkout@v2 |
| 26 | + |
| 27 | + - name: Validate composer.json and composer.lock |
| 28 | + run: composer validate |
| 29 | + |
| 30 | + - name: Get Composer Cache Directory |
| 31 | + id: composer-cache |
| 32 | + run: | |
| 33 | + echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 34 | +
|
| 35 | + - name: Cache Files |
| 36 | + uses: actions/cache@v2 |
| 37 | + with: |
| 38 | + path: | |
| 39 | + ${{ steps.composer-cache.outputs.dir }} |
| 40 | + **/.php_cs.cache |
| 41 | + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} |
| 42 | + restore-keys: | |
| 43 | + ${{ runner.os }}-composer- |
| 44 | +
|
| 45 | + - name: Install dependencies |
| 46 | + if: steps.composer-cache.outputs.cache-hit != 'true' |
| 47 | + run: composer install --prefer-dist --no-progress --no-suggest |
| 48 | + |
| 49 | + - name: Run static analysis |
| 50 | + run: composer run static-analysis |
| 51 | + |
| 52 | + phpunit: |
| 53 | + name: PHP ${{ matrix.php-versions }} Unit Tests |
| 54 | + runs-on: ${{ matrix.operating-system }} |
| 55 | + strategy: |
| 56 | + matrix: |
| 57 | + operating-system: ['ubuntu-20.04'] |
| 58 | + php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1'] |
| 59 | + |
| 60 | + steps: |
| 61 | + - name: Setup PHP |
| 62 | + uses: shivammathur/setup-php@v2 |
| 63 | + with: |
| 64 | + php-version: ${{ matrix.php-versions }} |
| 65 | + coverage: none |
| 66 | + |
| 67 | + - uses: actions/checkout@v2 |
| 68 | + |
| 69 | + - name: Validate composer.json and composer.lock |
| 70 | + run: composer validate |
| 71 | + |
| 72 | + - name: Get Composer Cache Directory |
| 73 | + id: composer-cache |
| 74 | + run: | |
| 75 | + echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 76 | +
|
| 77 | + - name: Cache Files |
| 78 | + uses: actions/cache@v2 |
| 79 | + with: |
| 80 | + path: | |
| 81 | + ${{ steps.composer-cache.outputs.dir }} |
| 82 | + **/.php_cs.cache |
| 83 | + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} |
| 84 | + restore-keys: | |
| 85 | + ${{ runner.os }}-composer- |
| 86 | +
|
| 87 | + - name: Install dependencies |
| 88 | + if: steps.composer-cache.outputs.cache-hit != 'true' |
| 89 | + run: composer install --prefer-dist --no-progress --no-suggest |
| 90 | + |
| 91 | + - name: Run tests |
| 92 | + run: ./vendor/bin/phpunit --testdox --stop-on-failure |
| 93 | + |
| 94 | + coverage: |
| 95 | + name: Coverage |
| 96 | + runs-on: ${{ matrix.operating-system }} |
| 97 | + strategy: |
| 98 | + matrix: |
| 99 | + operating-system: ['ubuntu-20.04'] |
| 100 | + php-versions: ['8.0'] |
| 101 | + |
| 102 | + steps: |
| 103 | + - name: Setup PHP |
| 104 | + uses: shivammathur/setup-php@v2 |
| 105 | + with: |
| 106 | + php-version: ${{ matrix.php-versions }} |
| 107 | + coverage: xdebug |
| 108 | + |
| 109 | + - uses: actions/checkout@v2 |
| 110 | + |
| 111 | + - name: Validate composer.json and composer.lock |
| 112 | + run: composer validate |
| 113 | + |
| 114 | + - name: Get Composer Cache Directory |
| 115 | + id: composer-cache |
| 116 | + run: | |
| 117 | + echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 118 | +
|
| 119 | + - name: Cache Files |
| 120 | + uses: actions/cache@v2 |
| 121 | + with: |
| 122 | + path: | |
| 123 | + ${{ steps.composer-cache.outputs.dir }} |
| 124 | + **/.php_cs.cache |
| 125 | + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} |
| 126 | + restore-keys: | |
| 127 | + ${{ runner.os }}-composer- |
| 128 | + - name: Install dependencies |
| 129 | + if: steps.composer-cache.outputs.cache-hit != 'true' |
| 130 | + run: composer install --prefer-dist --no-progress --no-suggest |
| 131 | + |
| 132 | + - name: Run tests |
| 133 | + |
| 134 | + env: |
| 135 | + CC_TEST_REPORTER_ID: "945dfb58a832d233a3caeb84e3e6d3be212e8c7abcb48117fce63b9adcb43647" |
| 136 | + with: |
| 137 | + coverageCommand: ./vendor/bin/phpunit --testdox --stop-on-failure --coverage-clover=clover.xml |
0 commit comments