cloudflare/Cloudflare-WordPress
Publicmirrored fromhttps://github.com/cloudflare/Cloudflare-WordPress
.github/workflows/php.yml
57lines · modecode
5 years ago
| 1 | name: PHP Composer |
| 2 | |
| 3 | on: |
| 4 | push: |
| 5 | branches: [ master ] |
| 6 | pull_request: |
| 7 | branches: [ master ] |
| 8 | |
| 9 | jobs: |
| 10 | build: |
| 11 | |
| 12 | runs-on: ubuntu-latest |
| 13 | |
| 14 | strategy: |
| 15 | matrix: |
| 16 | php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4'] |
| 17 | |
| 18 | steps: |
| 19 | - uses: actions/checkout@v2 |
| 20 | |
| 21 | - name: Cache Composer dependencies |
| 22 | uses: actions/cache@v2 |
| 23 | with: |
| 24 | path: /tmp/composer-cache |
| 25 | key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }} |
| 26 | |
| 27 | - name: Setup PHP |
| 28 | uses: shivammathur/setup-php@v2 |
| 29 | with: |
| 30 | php-version: ${{ matrix.php-versions }} |
| 31 | env: |
| 32 | update: true |
| 33 | |
| 34 | - name: Validate composer.json and composer.lock |
| 35 | run: composer validate |
| 36 | |
| 37 | - name: Install dependencies |
| 38 | uses: php-actions/composer@v5 |
| 39 | with: |
| 40 | command: install |
| 41 | args: --prefer-dist --no-progress --no-suggest --verbose |
| 42 | version: 1 |
| 43 | |
| 44 | - name: Format |
| 45 | run: | |
| 46 | composer run-script format || exit_code=$? |
| 47 | if (( exit_code > 1 )) ; then |
| 48 | exit $exit_code |
| 49 | fi |
| 50 | |
| 51 | # Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit" |
| 52 | # Docs: https://getcomposer.org/doc/articles/scripts.md |
| 53 | |
| 54 | - name: Run test suite |
| 55 | # Skip testing on PHP 7.4, because php-mock required by PHP 5.6 breaks on 7.4+ |
| 56 | if: matrix.php-versions < '7.4' |
| 57 | run: composer run-script test |