diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..8ae9f41 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,25 @@ +name: CI +on: + pull_request: null + push: + branches: + - master +jobs: + tests: + runs-on: ubuntu-latest + strategy: + matrix: + php: ['7.3', '7.4', '8.0'] + + name: Linting - PHP ${{ matrix.php }} + steps: + - uses: actions/checkout@v2 + - uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: none + extensions: intl + - run: composer install --no-progress + - run: composer codestyle + - run: composer phpstan + - run: composer tests diff --git a/composer.json b/composer.json index 9990ce1..ab00995 100644 --- a/composer.json +++ b/composer.json @@ -24,6 +24,21 @@ "psr-4": { "Michelf\\": "Michelf/" } }, "require-dev": { - "phpunit/phpunit": ">= 9.5" + "phpspec/prophecy": "^1.6", + "friendsofphp/php-cs-fixer": "^3.0", + "phpunit/phpunit": "^9.5", + "phpstan/phpstan": "^1.0", + "phpstan/phpstan-phpunit": "^1.0" + }, + + "scripts": { + "tests": "vendor/bin/phpunit test/", + "phpstan": [ + "vendor/bin/phpstan analyse Michelf/ --level=5", + "vendor/bin/phpstan analyse -c test/phpstan.neon test/ --level=5" + ], + "codestyle": "vendor/bin/php-cs-fixer fix --dry-run --verbose --show-progress=none", + "codestyle-fix": "vendor/bin/php-cs-fixer fix" } + } diff --git a/test/phpstan.neon b/test/phpstan.neon new file mode 100644 index 0000000..e385cc8 --- /dev/null +++ b/test/phpstan.neon @@ -0,0 +1,2 @@ +includes: + - ../vendor/phpstan/phpstan-phpunit/extension.neon