|
| 1 | +name: build |
| 2 | +on: [push, pull_request] |
| 3 | + |
| 4 | +jobs: |
| 5 | + full-build: |
| 6 | + name: "Coding standards & coverage tests" |
| 7 | + runs-on: ${{ matrix.operating-system }} |
| 8 | + strategy: |
| 9 | + matrix: |
| 10 | + operating-system: ['ubuntu-latest'] |
| 11 | + php-versions: ['7.4'] |
| 12 | + env: |
| 13 | + extensions: pcov, dom, json, libxml, mbstring, pdo_sqlite, soap, xml, xmlwriter |
| 14 | + key: cache-v2 |
| 15 | + steps: |
| 16 | + - name: "Checkout" |
| 17 | + uses: actions/checkout@v2 |
| 18 | + - name: "Setup PHP extensions cache environment" |
| 19 | + id: cache-env |
| 20 | + uses: shivammathur/cache-extensions@v1 |
| 21 | + with: |
| 22 | + php-version: ${{ matrix.php-versions }} |
| 23 | + extensions: ${{ env.extensions }} |
| 24 | + key: ${{ env.key }} |
| 25 | + - name: "Cache PHP extensions" |
| 26 | + uses: actions/cache@v2 |
| 27 | + with: |
| 28 | + path: ${{ steps.cache-env.outputs.dir }} |
| 29 | + key: ${{ steps.cache-env.outputs.key }} |
| 30 | + restore-keys: ${{ steps.cache-env.outputs.key }} |
| 31 | + - name: "Install PHP with extensions" |
| 32 | + uses: shivammathur/setup-php@v2 |
| 33 | + with: |
| 34 | + php-version: ${{ matrix.php-versions }} |
| 35 | + coverage: pcov |
| 36 | + extensions: ${{ env.extensions }} |
| 37 | + ini-values: assert.exception=1, zend.assertions=1 |
| 38 | + - name: "Validate composer.json" |
| 39 | + run: composer validate |
| 40 | + - name: "Setup composer cache" |
| 41 | + uses: actions/cache@v2 |
| 42 | + with: |
| 43 | + path: ~/.composer/cache |
| 44 | + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} |
| 45 | + restore-keys: ${{ runner.os }}-composer- |
| 46 | + - name: "Install highest dependencies" |
| 47 | + run: composer update --no-interaction --no-ansi --no-progress --no-suggest --prefer-stable |
| 48 | + - name: "Coding standard Php-CS-Fixer checks" |
| 49 | + run: vendor/bin/php-cs-fixer --dry-run -v --config=cs-fixer.php.dist --path-mode=intersection fix src tests |
| 50 | + - name: "Coding standard CodeSniffer checks" |
| 51 | + run: | |
| 52 | + vendor/bin/phpcs --extensions=php --standard=${tpl.PHPCS} src |
| 53 | + vendor/bin/phpcs --extensions=php --standard=${tpl.PHPCS} --ignore=tests/CodeSamples/* tests |
| 54 | + - name: "Package skeleton validation" |
| 55 | + run: ${tpl.PHP_EXEC}polymorphine-skeleton check |
| 56 | + - name: "Run PhpUnit tests with coverage" |
| 57 | + run: | |
| 58 | + mkdir -p build/logs |
| 59 | + vendor/bin/phpunit{original.content} --coverage-clover build/logs/clover.xml |
| 60 | + - name: "Send coverage report to coveralls.io" |
| 61 | + run: vendor/bin/php-coveralls -v |
| 62 | + env: |
| 63 | + COVERALLS_RUN_LOCALLY: 1 |
| 64 | + COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} |
| 65 | + |
| 66 | + php-os-builds: |
| 67 | + name: "PHP 8 tests" |
| 68 | + runs-on: ${{ matrix.operating-system }} |
| 69 | + strategy: |
| 70 | + matrix: |
| 71 | + operating-system: ['ubuntu-latest', 'windows-latest', 'macos-latest'] |
| 72 | + php-versions: ['8.0', '8.1'] |
| 73 | + env: |
| 74 | + extensions: dom, json, libxml, mbstring, pdo_sqlite, soap, xml, xmlwriter |
| 75 | + key: cache-v2 |
| 76 | + steps: |
| 77 | + - name: "Turn off git EOL conversion" |
| 78 | + run: git config --global core.autocrlf false |
| 79 | + - name: "Checkout" |
| 80 | + uses: actions/checkout@v2 |
| 81 | + - name: "Setup PHP extensions cache environment" |
| 82 | + id: cache-env |
| 83 | + uses: shivammathur/cache-extensions@v1 |
| 84 | + with: |
| 85 | + php-version: ${{ matrix.php-versions }} |
| 86 | + extensions: ${{ env.extensions }} |
| 87 | + key: ${{ env.key }} |
| 88 | + - name: "Cache PHP extensions" |
| 89 | + uses: actions/cache@v2 |
| 90 | + with: |
| 91 | + path: ${{ steps.cache-env.outputs.dir }} |
| 92 | + key: ${{ steps.cache-env.outputs.key }} |
| 93 | + restore-keys: ${{ steps.cache-env.outputs.key }} |
| 94 | + - name: "Install PHP with extensions" |
| 95 | + uses: shivammathur/setup-php@v2 |
| 96 | + with: |
| 97 | + php-version: ${{ matrix.php-versions }} |
| 98 | + coverage: none |
| 99 | + extensions: ${{ env.extensions }} |
| 100 | + ini-values: assert.exception=1, zend.assertions=1 |
| 101 | + - name: "Setup composer cache" |
| 102 | + uses: actions/cache@v2 |
| 103 | + with: |
| 104 | + path: ~/.composer/cache |
| 105 | + key: ${{ runner.os }}-php${{ matrix.php-versions }}-composer-${{ hashFiles('**/composer.json') }} |
| 106 | + restore-keys: ${{ runner.os }}-php${{ matrix.php-versions }}-composer- |
| 107 | + - name: "Install highest dependencies" |
| 108 | + run: composer update --no-interaction --no-ansi --no-progress --no-suggest --prefer-stable |
| 109 | + - name: "Run PhpUnit tests (no coverage)" |
| 110 | + run: vendor/bin/phpunit{original.content} --no-coverage |
0 commit comments