|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [master] |
| 6 | + pull_request: |
| 7 | + branches: [master] |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +jobs: |
| 11 | + tests: |
| 12 | + strategy: |
| 13 | + matrix: |
| 14 | + operating-system: [ubuntu-latest] |
| 15 | + php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0'] |
| 16 | + runs-on: ${{ matrix.operating-system }} |
| 17 | + steps: |
| 18 | + - name: Checkout |
| 19 | + uses: actions/checkout@v2 |
| 20 | + - name: Setup PHP |
| 21 | + uses: shivammathur/setup-php@v2 |
| 22 | + with: |
| 23 | + php-version: ${{ matrix.php-versions }} |
| 24 | + coverage: none |
| 25 | + - name: Get composer cache directory |
| 26 | + id: composer-cache |
| 27 | + run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 28 | + - name: Cache composer dependencies |
| 29 | + uses: actions/cache@v2 |
| 30 | + with: |
| 31 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 32 | + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} |
| 33 | + restore-keys: ${{ runner.os }}-composer- |
| 34 | + - name: Install dependencies |
| 35 | + run: composer install --no-progress --prefer-dist --classmap-authoritative --no-interaction |
| 36 | + - name: Setup problem matchers for PHPUnit |
| 37 | + run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" |
| 38 | + - name: Test with phpunit |
| 39 | + run: vendor/bin/phpunit |
| 40 | + lint: |
| 41 | + runs-on: ubuntu-latest |
| 42 | + steps: |
| 43 | + - name: Checkout |
| 44 | + uses: actions/checkout@v2 |
| 45 | + - name: Setup PHP |
| 46 | + uses: shivammathur/setup-php@v2 |
| 47 | + with: |
| 48 | + php-version: '7.4' |
| 49 | + coverage: none |
| 50 | + tools: cs2pr, php-cs-fixer, phpcs |
| 51 | + - name: Run PHP Coding Standards Fixer |
| 52 | + run: php-cs-fixer fix --dry-run --using-cache=no --format=checkstyle | cs2pr |
| 53 | + - name: Run PHP_CodeSniffer |
| 54 | + run: phpcs --standard=PSR12 --exclude=PSR12.Properties.ConstantVisibility -q --report=checkstyle src tests | cs2pr |
| 55 | + coverage: |
| 56 | + runs-on: ubuntu-latest |
| 57 | + steps: |
| 58 | + - name: Checkout |
| 59 | + uses: actions/checkout@v2 |
| 60 | + - name: Setup PHP |
| 61 | + uses: shivammathur/setup-php@v2 |
| 62 | + with: |
| 63 | + php-version: '8.0' |
| 64 | + coverage: xdebug |
| 65 | + - name: Get composer cache directory |
| 66 | + id: composer-cache |
| 67 | + run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 68 | + - name: Cache composer dependencies |
| 69 | + uses: actions/cache@v2 |
| 70 | + with: |
| 71 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 72 | + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} |
| 73 | + restore-keys: ${{ runner.os }}-composer- |
| 74 | + - name: Install dependencies |
| 75 | + run: composer install --no-progress --prefer-dist --classmap-authoritative --no-interaction |
| 76 | + - name: Setup problem matchers for PHPUnit |
| 77 | + run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" |
| 78 | + - name: Test with phpunit |
| 79 | + run: vendor/bin/phpunit --coverage-clover coverage.xml |
| 80 | + - name: Upload coverage |
| 81 | + uses: codecov/codecov-action@v1 |
0 commit comments