|
| 1 | +on: |
| 2 | + push: |
| 3 | + branches: |
| 4 | + - master |
| 5 | + pull_request: |
| 6 | +name: Qa workflow |
| 7 | +jobs: |
| 8 | + setup: |
| 9 | + runs-on: ubuntu-latest |
| 10 | + steps: |
| 11 | + - uses: actions/checkout@master |
| 12 | + |
| 13 | + - name: Restore/cache tools folder |
| 14 | + uses: actions/cache@v1 |
| 15 | + with: |
| 16 | + path: tools |
| 17 | + key: all-tools-${{ github.sha }} |
| 18 | + restore-keys: | |
| 19 | + all-tools-${{ github.sha }}- |
| 20 | + all-tools- |
| 21 | +
|
| 22 | + - name: composer |
| 23 | + uses: docker://composer |
| 24 | + env: |
| 25 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 26 | + with: |
| 27 | + args: install --no-interaction --prefer-dist --optimize-autoloader |
| 28 | + |
| 29 | + - name: composer-require-checker |
| 30 | + uses: docker://phpga/composer-require-checker-ga |
| 31 | + env: |
| 32 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 33 | + with: |
| 34 | + args: check --config-file ./composer-require-config.json composer.json |
| 35 | + |
| 36 | + - name: Install phive |
| 37 | + run: make install-phive |
| 38 | + |
| 39 | + - name: Install PHAR dependencies |
| 40 | + run: tools/phive.phar --no-progress install --copy --trust-gpg-keys 4AA394086372C20A,8A03EA3B385DBAA1 --force-accept-unsigned |
| 41 | + |
| 42 | + phpunit-with-coverage: |
| 43 | + runs-on: ubuntu-latest |
| 44 | + name: Unit tests |
| 45 | + needs: setup |
| 46 | + steps: |
| 47 | + - uses: actions/checkout@master |
| 48 | + |
| 49 | + - name: Setup PHP |
| 50 | + uses: shivammathur/setup-php@v2 |
| 51 | + with: |
| 52 | + php-version: 7.2 |
| 53 | + ini-values: memory_limit=2G, display_errors=On, error_reporting=-1 |
| 54 | + coverage: pcov |
| 55 | + |
| 56 | + - name: Restore/cache tools folder |
| 57 | + uses: actions/cache@v1 |
| 58 | + with: |
| 59 | + path: tools |
| 60 | + key: all-tools-${{ github.sha }} |
| 61 | + restore-keys: | |
| 62 | + all-tools-${{ github.sha }}- |
| 63 | + all-tools- |
| 64 | +
|
| 65 | + - name: Get composer cache directory |
| 66 | + id: composer-cache |
| 67 | + run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 68 | + |
| 69 | + - name: Cache composer dependencies |
| 70 | + uses: actions/cache@v1 |
| 71 | + with: |
| 72 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 73 | + key: ubuntu-latest-composer-${{ hashFiles('**/composer.lock') }} |
| 74 | + restore-keys: ubuntu-latest-composer- |
| 75 | + |
| 76 | + - name: Install Composer dependencies |
| 77 | + run: | |
| 78 | + composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader |
| 79 | +
|
| 80 | + - name: Run PHPUnit |
| 81 | + run: php tools/phpunit |
| 82 | + |
| 83 | + phpunit: |
| 84 | + runs-on: ${{ matrix.operating-system }} |
| 85 | + strategy: |
| 86 | + matrix: |
| 87 | + operating-system: |
| 88 | + - ubuntu-latest |
| 89 | + - windows-latest |
| 90 | + - macOS-latest |
| 91 | + php-versions: ['7.2', '7.3', '7.4'] |
| 92 | + name: Unit tests for PHP version ${{ matrix.php-versions }} on ${{ matrix.operating-system }} |
| 93 | + needs: |
| 94 | + - setup |
| 95 | + - phpunit-with-coverage |
| 96 | + steps: |
| 97 | + - uses: actions/checkout@master |
| 98 | + |
| 99 | + - name: Restore/cache tools folder |
| 100 | + uses: actions/cache@v1 |
| 101 | + with: |
| 102 | + path: tools |
| 103 | + key: all-tools-${{ github.sha }} |
| 104 | + restore-keys: | |
| 105 | + all-tools-${{ github.sha }}- |
| 106 | + all-tools- |
| 107 | +
|
| 108 | + - name: Setup PHP |
| 109 | + uses: shivammathur/setup-php@v2 |
| 110 | + with: |
| 111 | + php-version: ${{ matrix.php-versions }} |
| 112 | + ini-values: memory_limit=2G, display_errors=On, error_reporting=-1 |
| 113 | + coverage: none |
| 114 | + |
| 115 | + - name: Get composer cache directory |
| 116 | + id: composer-cache |
| 117 | + run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 118 | + |
| 119 | + - name: Cache composer dependencies |
| 120 | + uses: actions/cache@v1 |
| 121 | + with: |
| 122 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 123 | + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} |
| 124 | + restore-keys: ${{ runner.os }}-composer- |
| 125 | + |
| 126 | + - name: Install Composer dependencies |
| 127 | + run: | |
| 128 | + composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader |
| 129 | +
|
| 130 | + - name: Run PHPUnit |
| 131 | + continue-on-error: true |
| 132 | + run: php tools/phpunit |
| 133 | + |
| 134 | + codestyle: |
| 135 | + runs-on: ubuntu-latest |
| 136 | + needs: [setup, phpunit] |
| 137 | + steps: |
| 138 | + - uses: actions/checkout@master |
| 139 | + - name: Restore/cache vendor folder |
| 140 | + uses: actions/cache@v1 |
| 141 | + with: |
| 142 | + path: vendor |
| 143 | + key: all-build-${{ hashFiles('**/composer.lock') }} |
| 144 | + restore-keys: | |
| 145 | + all-build-${{ hashFiles('**/composer.lock') }} |
| 146 | + all-build- |
| 147 | + - name: Code style check |
| 148 | + uses: phpDocumentor/coding-standard@master |
| 149 | + with: |
| 150 | + args: -s |
| 151 | + |
| 152 | + phpstan: |
| 153 | + runs-on: ubuntu-latest |
| 154 | + needs: [setup, phpunit] |
| 155 | + steps: |
| 156 | + - uses: actions/checkout@master |
| 157 | + - name: Restore/cache vendor folder |
| 158 | + uses: actions/cache@v1 |
| 159 | + with: |
| 160 | + path: vendor |
| 161 | + key: all-build-${{ hashFiles('**/composer.lock') }} |
| 162 | + restore-keys: | |
| 163 | + all-build-${{ hashFiles('**/composer.lock') }} |
| 164 | + all-build- |
| 165 | + - name: PHPStan |
| 166 | + uses: phpDocumentor/phpstan-ga@master |
| 167 | + env: |
| 168 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 169 | + with: |
| 170 | + args: analyse src --configuration phpstan.neon |
| 171 | + |
| 172 | + psalm: |
| 173 | + runs-on: ubuntu-latest |
| 174 | + needs: [setup, phpunit] |
| 175 | + steps: |
| 176 | + - uses: actions/checkout@master |
| 177 | + |
| 178 | + - name: Setup PHP |
| 179 | + uses: shivammathur/setup-php@v2 |
| 180 | + with: |
| 181 | + php-version: 7.2 |
| 182 | + ini-values: memory_limit=2G, display_errors=On, error_reporting=-1 |
| 183 | + tools: psalm |
| 184 | + coverage: none |
| 185 | + |
| 186 | + - name: Get composer cache directory |
| 187 | + id: composer-cache |
| 188 | + run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 189 | + |
| 190 | + - name: Cache composer dependencies |
| 191 | + uses: actions/cache@v1 |
| 192 | + with: |
| 193 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 194 | + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} |
| 195 | + restore-keys: ${{ runner.os }}-composer- |
| 196 | + |
| 197 | + - name: Install Composer dependencies |
| 198 | + run: | |
| 199 | + composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader |
| 200 | +
|
| 201 | + - name: Psalm |
| 202 | + run: psalm --output-format=github |
| 203 | + |
| 204 | + bc_check: |
| 205 | + name: BC Check |
| 206 | + runs-on: ubuntu-latest |
| 207 | + needs: [setup, phpunit] |
| 208 | + steps: |
| 209 | + - uses: actions/checkout@master |
| 210 | + - name: fetch tags |
| 211 | + run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* |
| 212 | + - name: Restore/cache vendor folder |
| 213 | + uses: actions/cache@v1 |
| 214 | + with: |
| 215 | + path: vendor |
| 216 | + key: all-build-${{ hashFiles('**/composer.lock') }} |
| 217 | + restore-keys: | |
| 218 | + all-build-${{ hashFiles('**/composer.lock') }} |
| 219 | + all-build- |
| 220 | + - name: Roave BC Check |
| 221 | + uses: docker://nyholm/roave-bc-check-ga |
0 commit comments