name: "static analysis"

on: ["pull_request", "push"]

jobs:
  unit-tests:
    name: "static analysis"

    runs-on: "ubuntu-latest"

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

      - name: "installing PHP"
        uses: "shivammathur/setup-php@v2"
        with:
          php-version: "8.2"
          ini-values: memory_limit=-1
          tools: composer:v2, phpstan, cs2pr

      - name: "installing dependencies"
        run: "COMPOSER_ROOT_VERSION=dev-main composer update --no-interaction --no-progress"
        env:
          COMPOSER_ROOT_VERSION: 'dev-main'

      - name: "installing PHPUnit"
        run: "php vendor/bin/simple-phpunit install"

      - name: "running static analysis (PHPStan)"
        run: "phpstan analyse"
