|
| 1 | +name: 'CI' |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - 'master' |
| 8 | + |
| 9 | +env: |
| 10 | + CONSISTENCE_PHP_VERSION: '7.3' |
| 11 | + |
| 12 | +jobs: |
| 13 | + composer-validate: |
| 14 | + name: 'Composer validate' |
| 15 | + runs-on: 'ubuntu-latest' |
| 16 | + |
| 17 | + steps: |
| 18 | + - |
| 19 | + name: 'Checkout' |
| 20 | + uses: 'actions/checkout@v3' |
| 21 | + - |
| 22 | + name: 'Setup PHP ${{ env.CONSISTENCE_PHP_VERSION }}' |
| 23 | + uses: 'shivammathur/setup-php@v2' |
| 24 | + with: |
| 25 | + php-version: '${{ env.CONSISTENCE_PHP_VERSION }}' |
| 26 | + coverage: 'none' |
| 27 | + - |
| 28 | + name: 'Setup problem matchers for PHP' |
| 29 | + run: 'echo "::add-matcher::${{ runner.tool_cache }}/php.json"' |
| 30 | + - |
| 31 | + name: 'Composer install' |
| 32 | + uses: 'ramsey/composer-install@v1' |
| 33 | + with: |
| 34 | + dependency-versions: 'highest' |
| 35 | + - |
| 36 | + name: 'Composer validate' |
| 37 | + run: 'bin/phing composer-validate' |
| 38 | + |
| 39 | + lint: |
| 40 | + name: 'Lint - PHP ${{ matrix.php-version }}' |
| 41 | + needs: 'composer-validate' |
| 42 | + runs-on: 'ubuntu-latest' |
| 43 | + |
| 44 | + strategy: |
| 45 | + fail-fast: false |
| 46 | + matrix: |
| 47 | + php-version: |
| 48 | + - '7.2' |
| 49 | + - '7.3' |
| 50 | + |
| 51 | + steps: |
| 52 | + - |
| 53 | + name: 'Checkout' |
| 54 | + uses: 'actions/checkout@v3' |
| 55 | + - |
| 56 | + name: 'Setup PHP ${{ matrix.php-version }}' |
| 57 | + uses: 'shivammathur/setup-php@v2' |
| 58 | + with: |
| 59 | + php-version: '${{ matrix.php-version }}' |
| 60 | + coverage: 'none' |
| 61 | + - |
| 62 | + name: 'Setup problem matchers for PHP' |
| 63 | + run: 'echo "::add-matcher::${{ runner.tool_cache }}/php.json"' |
| 64 | + - |
| 65 | + name: 'Composer install' |
| 66 | + uses: 'ramsey/composer-install@v1' |
| 67 | + with: |
| 68 | + dependency-versions: 'highest' |
| 69 | + - |
| 70 | + name: 'Lint' |
| 71 | + run: 'bin/phing phplint' |
| 72 | + |
| 73 | + coding-standard: |
| 74 | + name: 'Coding standard' |
| 75 | + needs: 'lint' |
| 76 | + runs-on: 'ubuntu-latest' |
| 77 | + |
| 78 | + steps: |
| 79 | + - |
| 80 | + name: 'Checkout' |
| 81 | + uses: 'actions/checkout@v3' |
| 82 | + - |
| 83 | + name: 'Setup PHP ${{ env.CONSISTENCE_PHP_VERSION }}' |
| 84 | + uses: 'shivammathur/setup-php@v2' |
| 85 | + with: |
| 86 | + php-version: '${{ env.CONSISTENCE_PHP_VERSION }}' |
| 87 | + coverage: 'none' |
| 88 | + tools: 'cs2pr' |
| 89 | + - |
| 90 | + name: 'Setup problem matchers for PHP' |
| 91 | + run: 'echo "::add-matcher::${{ runner.tool_cache }}/php.json"' |
| 92 | + - |
| 93 | + name: 'Composer install' |
| 94 | + uses: 'ramsey/composer-install@v1' |
| 95 | + with: |
| 96 | + dependency-versions: 'highest' |
| 97 | + - |
| 98 | + name: 'Check coding standard' |
| 99 | + run: 'bin/phing create-dirs cs || cat build/log/phpcs-checkstyle.xml | cs2pr' |
| 100 | + |
| 101 | + tests: |
| 102 | + name: 'Tests - PHP ${{ matrix.php-version }}, ${{ matrix.composer-dependencies }} dependencies' |
| 103 | + needs: 'lint' |
| 104 | + runs-on: 'ubuntu-latest' |
| 105 | + |
| 106 | + strategy: |
| 107 | + fail-fast: false |
| 108 | + matrix: |
| 109 | + php-version: |
| 110 | + - '7.2' |
| 111 | + - '7.3' |
| 112 | + composer-dependencies: |
| 113 | + - 'highest' |
| 114 | + - 'lowest' |
| 115 | + |
| 116 | + steps: |
| 117 | + - |
| 118 | + name: 'Checkout' |
| 119 | + uses: 'actions/checkout@v3' |
| 120 | + - |
| 121 | + name: 'Setup PHP ${{ matrix.php-version }}' |
| 122 | + uses: 'shivammathur/setup-php@v2' |
| 123 | + with: |
| 124 | + php-version: '${{ matrix.php-version }}' |
| 125 | + coverage: 'xdebug' |
| 126 | + - |
| 127 | + name: 'Setup problem matchers for PHP' |
| 128 | + run: 'echo "::add-matcher::${{ runner.tool_cache }}/php.json"' |
| 129 | + - |
| 130 | + name: 'Setup problem matchers for PHPUnit' |
| 131 | + run: 'echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"' |
| 132 | + - |
| 133 | + name: 'Composer install' |
| 134 | + uses: 'ramsey/composer-install@v1' |
| 135 | + with: |
| 136 | + dependency-versions: '${{ matrix.composer-dependencies }}' |
| 137 | + - |
| 138 | + name: 'Run tests' |
| 139 | + run: 'bin/phing tests' |
| 140 | + - |
| 141 | + name: 'Upload code coverage to Coveralls' |
| 142 | + env: |
| 143 | + COVERALLS_REPO_TOKEN: '${{ secrets.GITHUB_TOKEN }}' |
| 144 | + COVERALLS_PARALLEL: true |
| 145 | + COVERALLS_FLAG_NAME: 'php-${{ matrix.php-version }}+${{ matrix.composer-dependencies }}-dependencies' |
| 146 | + run: | |
| 147 | + wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.4.3/php-coveralls.phar |
| 148 | + php php-coveralls.phar --verbose --config build/coveralls.yml |
| 149 | +
|
| 150 | + finish_coveralls: |
| 151 | + name: 'Finish Coveralls upload' |
| 152 | + needs: 'tests' |
| 153 | + runs-on: 'ubuntu-latest' |
| 154 | + |
| 155 | + steps: |
| 156 | + - |
| 157 | + name: 'Finish Coveralls upload' |
| 158 | + uses: 'coverallsapp/[email protected]' |
| 159 | + with: |
| 160 | + github-token: '${{ secrets.GITHUB_TOKEN }}' |
| 161 | + parallel-finished: true |
0 commit comments