|  | 
|  | 1 | +name: continuous-integration | 
|  | 2 | +on: | 
|  | 3 | +  push: | 
|  | 4 | +    branches: | 
|  | 5 | +      - master | 
|  | 6 | +      - release/* | 
|  | 7 | +  pull_request: | 
|  | 8 | +jobs: | 
|  | 9 | +  unit-testing: | 
|  | 10 | +    name: PHPUnit (PHP ${{ matrix.php-versions }}) | 
|  | 11 | +    runs-on: ubuntu-latest | 
|  | 12 | +    strategy: | 
|  | 13 | +      fail-fast: false | 
|  | 14 | +      matrix: | 
|  | 15 | +        php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1'] | 
|  | 16 | +        coverage: ['pcov'] | 
|  | 17 | +        code-analysis: ['no'] | 
|  | 18 | +        include: | 
|  | 19 | +          - php-versions: '7.1' | 
|  | 20 | +            coverage: 'none' | 
|  | 21 | +            code-analysis: 'yes' | 
|  | 22 | +    steps: | 
|  | 23 | +      - name: Checkout | 
|  | 24 | +        uses: actions/checkout@v2 | 
|  | 25 | + | 
|  | 26 | +      - name: Setup PHP, with composer and extensions | 
|  | 27 | +        uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php | 
|  | 28 | +        with: | 
|  | 29 | +          php-version: ${{ matrix.php-versions }} | 
|  | 30 | +          extensions: mbstring, dom, fileinfo, mysql, redis, opcache | 
|  | 31 | +          coverage: ${{ matrix.coverage }} | 
|  | 32 | +          tools: composer | 
|  | 33 | + | 
|  | 34 | +      - name: Get composer cache directory | 
|  | 35 | +        id: composer-cache | 
|  | 36 | +        run: echo "::set-output name=dir::$(composer config cache-files-dir)" | 
|  | 37 | + | 
|  | 38 | +      - name: Cache composer dependencies | 
|  | 39 | +        uses: actions/cache@v2 | 
|  | 40 | +        with: | 
|  | 41 | +          path: ${{ steps.composer-cache.outputs.dir }} | 
|  | 42 | +          # Use composer.json for key, if composer.lock is not committed. | 
|  | 43 | +          # key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | 
|  | 44 | +          key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | 
|  | 45 | +          restore-keys: ${{ runner.os }}-composer- | 
|  | 46 | + | 
|  | 47 | +      - name: Install Composer dependencies | 
|  | 48 | +        run: composer install --no-progress --prefer-dist --optimize-autoloader | 
|  | 49 | + | 
|  | 50 | +      - name: Code Analysis(PHP CS-Fixer) | 
|  | 51 | +        if: matrix.code-analysis == 'yes' | 
|  | 52 | +        run: php vendor/bin/php-cs-fixer fix --dry-run --diff | 
|  | 53 | + | 
|  | 54 | +      - name: Code Analysis(PHPStan) | 
|  | 55 | +        if: matrix.code-analysis == 'yes' | 
|  | 56 | +        run: composer phpstan | 
|  | 57 | + | 
|  | 58 | +      - name: Test with phpunit | 
|  | 59 | +        run: vendor/bin/phpunit --configuration tests/phpunit.xml --coverage-clover clover.xml | 
|  | 60 | + | 
|  | 61 | +      - uses: codecov/codecov-action@v2 | 
|  | 62 | +        if: matrix.coverage != 'none' | 
0 commit comments