diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml new file mode 100644 index 0000000..d075ce5 --- /dev/null +++ b/.github/workflows/phpstan.yml @@ -0,0 +1,35 @@ +on: + pull_request: + push: + branches: + - master + +name: phpstan +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Install PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '7.1' + + - name: Install dependencies with composer + run: composer install + + - name: Cache phpstan cache + uses: actions/cache@v4 + with: + path: .phpstan-cache + key: phpstan-cache-${{ github.run_id }} # see https://github.com/phpstan/phpstan/discussions/9301 + restore-keys: | + phpstan-cache- + + - name: PHPStan + run: make phpstan diff --git a/Makefile b/Makefile index 61f4653..7eead1b 100644 --- a/Makefile +++ b/Makefile @@ -16,3 +16,7 @@ generate: init: php bin/init_user_agent.php > tests/user_agents.tmp.json && mv tests/user_agents.tmp.json tests/user_agents.dist.json make generate + +.PHONY: phpstan +phpstan: + php vendor/bin/phpstan analyse --memory-limit 2g