# https://docs.github.com/en/actions

name: Code Testing

on:
  pull_request: null
  push:
    branches:
      - master

jobs:
  phpstan:
    name: PHPStan Tests

    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Get Composer cache directory
        id: composer-cache
        run: echo "::set-output name=dir::$(composer config cache-files-dir)"

      - name: Cache dependencies
        uses: actions/cache@v2
        with:
          path: ${{ steps.composer-cache.outputs.dir }}
          key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
          restore-keys: ${{ runner.os }}-composer-

      - name: Install dependencies
        run: composer install

      - name: Set up PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: 8.0
          extensions: mbstring
          coverage: none
          tools: composer:v2
        env:
          COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

      - name: Setup problem matchers for PHP
        run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"

      - name: Run PhpStan
        run: vendor/bin/phpstan

      - name: Run PhpCS
        run: vendor/bin/phpcs --no-cache --parallel=1 --report-full

# https://docs.github.com/en/actions

name: Code Testing

on:
  pull_request: null
  push:
    branches:
      - master

jobs:
  phpstan:
    name: PHPStan Tests

    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Get Composer cache directory
        id: composer-cache
        run: echo "::set-output name=dir::$(composer config cache-files-dir)"

      - name: Cache dependencies
        uses: actions/cache@v2
        with:
          path: ${{ steps.composer-cache.outputs.dir }}
          key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
          restore-keys: ${{ runner.os }}-composer-

      - name: Install dependencies
        run: composer install

      - name: Set up PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: 8.0
          extensions: mbstring
          coverage: none
          tools: composer:v2, cs2pr
        env:
          COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

      - name: Setup problem matchers for PHP
        run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"

      - name: Run PhpStan
        run: vendor/bin/phpstan --error-format=checkstyle | cs2pr

      - name: Run PhpCS
        run: vendor/bin/phpcs --no-cache --parallel=1 --report-full --report-checkstyle --graceful-warnings --notices-as-warnings | cs2pr

Annotate PRs from code analysis reports
Annotate PRs from code analysis reports
