|
| 1 | +name: Build |
| 2 | +on: [ push, pull_request ] |
| 3 | +jobs: |
| 4 | + test: |
| 5 | + runs-on: ubuntu-latest |
| 6 | + strategy: |
| 7 | + matrix: |
| 8 | + php-version: |
| 9 | + - '7.2' |
| 10 | + - '7.3' |
| 11 | + - '7.4' |
| 12 | + - '8.0' |
| 13 | + |
| 14 | + name: PHP ${{ matrix.php-version }} |
| 15 | + |
| 16 | + steps: |
| 17 | + - name: Checkout |
| 18 | + uses: actions/checkout@v2 |
| 19 | + |
| 20 | + - name: Setup PHP, with composer and extensions |
| 21 | + uses: shivammathur/setup-php@v2 |
| 22 | + with: |
| 23 | + php-version: ${{ matrix.php-version }} |
| 24 | + extensions: ctype, dom, gd, iconv, fileinfo, libxml, mbstring, simplexml, xml, xmlreader, xmlwriter, zip, zlib |
| 25 | + coverage: none |
| 26 | + |
| 27 | + - name: Get composer cache directory |
| 28 | + id: composer-cache |
| 29 | + run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 30 | + |
| 31 | + - name: Cache composer dependencies |
| 32 | + uses: actions/cache@v2 |
| 33 | + with: |
| 34 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 35 | + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} |
| 36 | + restore-keys: ${{ runner.os }}-composer- |
| 37 | + |
| 38 | + - name: Delete composer lock file |
| 39 | + id: composer-lock |
| 40 | + if: ${{ matrix.php-version == '8.0' }} |
| 41 | + run: | |
| 42 | + rm composer.lock |
| 43 | + echo "::set-output name=flags::--ignore-platform-reqs" |
| 44 | +
|
| 45 | + - name: Install dependencies |
| 46 | + run: composer install --no-progress --prefer-dist --optimize-autoloader ${{ steps.composer-lock.outputs.flags }} |
| 47 | + |
| 48 | + - name: Setup problem matchers for PHP |
| 49 | + run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" |
| 50 | + |
| 51 | + - name: Setup problem matchers for PHPUnit |
| 52 | + run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" |
| 53 | + |
| 54 | + - name: Test with PHPUnit |
| 55 | + run: ./vendor/bin/phpunit |
| 56 | + |
| 57 | + php-cs-fixer: |
| 58 | + runs-on: ubuntu-latest |
| 59 | + steps: |
| 60 | + - name: Checkout |
| 61 | + uses: actions/checkout@v2 |
| 62 | + |
| 63 | + - name: Setup PHP, with composer and extensions |
| 64 | + uses: shivammathur/setup-php@v2 |
| 65 | + with: |
| 66 | + php-version: 7.4 |
| 67 | + extensions: ctype, dom, gd, iconv, fileinfo, libxml, mbstring, simplexml, xml, xmlreader, xmlwriter, zip, zlib |
| 68 | + coverage: none |
| 69 | + tools: cs2pr |
| 70 | + |
| 71 | + - name: Get composer cache directory |
| 72 | + id: composer-cache |
| 73 | + run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 74 | + |
| 75 | + - name: Cache composer dependencies |
| 76 | + uses: actions/cache@v2 |
| 77 | + with: |
| 78 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 79 | + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} |
| 80 | + restore-keys: ${{ runner.os }}-composer- |
| 81 | + |
| 82 | + - name: Install dependencies |
| 83 | + run: composer install --no-progress --prefer-dist --optimize-autoloader |
| 84 | + |
| 85 | + - name: Code style with PHP-CS-Fixer |
| 86 | + run: ./vendor/bin/php-cs-fixer fix --format=checkstyle | cs2pr |
| 87 | + |
| 88 | + phpcs: |
| 89 | + runs-on: ubuntu-latest |
| 90 | + steps: |
| 91 | + - name: Checkout |
| 92 | + uses: actions/checkout@v2 |
| 93 | + |
| 94 | + - name: Setup PHP, with composer and extensions |
| 95 | + uses: shivammathur/setup-php@v2 |
| 96 | + with: |
| 97 | + php-version: 7.4 |
| 98 | + extensions: ctype, dom, gd, iconv, fileinfo, libxml, mbstring, simplexml, xml, xmlreader, xmlwriter, zip, zlib |
| 99 | + coverage: none |
| 100 | + tools: cs2pr |
| 101 | + |
| 102 | + - name: Get composer cache directory |
| 103 | + id: composer-cache |
| 104 | + run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 105 | + |
| 106 | + - name: Cache composer dependencies |
| 107 | + uses: actions/cache@v2 |
| 108 | + with: |
| 109 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 110 | + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} |
| 111 | + restore-keys: ${{ runner.os }}-composer- |
| 112 | + |
| 113 | + - name: Install dependencies |
| 114 | + run: composer install --no-progress --prefer-dist --optimize-autoloader |
| 115 | + |
| 116 | + - name: Code style with PHP_CodeSniffer |
| 117 | + run: ./vendor/bin/phpcs -q --report=checkstyle | cs2pr |
| 118 | + |
| 119 | + coverage: |
| 120 | + runs-on: ubuntu-latest |
| 121 | + steps: |
| 122 | + - name: Checkout |
| 123 | + uses: actions/checkout@v2 |
| 124 | + |
| 125 | + - name: Setup PHP, with composer and extensions |
| 126 | + uses: shivammathur/setup-php@v2 |
| 127 | + with: |
| 128 | + php-version: 7.4 |
| 129 | + extensions: ctype, dom, gd, iconv, fileinfo, libxml, mbstring, simplexml, xml, xmlreader, xmlwriter, zip, zlib |
| 130 | + coverage: pcov |
| 131 | + |
| 132 | + - name: Get composer cache directory |
| 133 | + id: composer-cache |
| 134 | + run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 135 | + |
| 136 | + - name: Cache composer dependencies |
| 137 | + uses: actions/cache@v2 |
| 138 | + with: |
| 139 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 140 | + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} |
| 141 | + restore-keys: ${{ runner.os }}-composer- |
| 142 | + |
| 143 | + - name: Install dependencies |
| 144 | + run: composer install --no-progress --prefer-dist --optimize-autoloader |
| 145 | + |
| 146 | + - name: Coverage |
| 147 | + run: | |
| 148 | + ./vendor/bin/phpunit --coverage-clover coverage-clover.xml |
| 149 | + curl -LO https://scrutinizer-ci.com/ocular.phar |
| 150 | + php ocular.phar code-coverage:upload --format=php-clover coverage-clover.xml |
0 commit comments