diff --git a/.github/workflows/qa.yml b/.github/workflows/qa.yml index f6c2d2a..5efb0e0 100644 --- a/.github/workflows/qa.yml +++ b/.github/workflows/qa.yml @@ -1,31 +1,50 @@ name: PHP Quality Assurance -on: [push] +on: [push, pull_request] jobs: - build: + tests: runs-on: ubuntu-latest if: "!contains(github.event.head_commit.message, 'ci skip')" strategy: + fail-fast: true matrix: - php-versions: ['7.1', '7.2', '7.3', '7.4'] + php-versions: ['7.1', '7.2', '7.3', '7.4', '8.0'] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + + - name: Check syntax error in sources + run: find ./src/ ./tests/ -type f -name '*.php' -print0 | xargs -0 -L 1 -P 4 -- php -l + + - name: Install dependencies + uses: "ramsey/composer-install@v1" + + - name: Run unit tests + run: composer tests:no-cov + + static: + runs-on: ubuntu-latest + if: "!contains(github.event.head_commit.message, 'ci skip')" + steps: + - name: Checkout + uses: actions/checkout@v2 - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: ${{ matrix.php-versions }} - - - name: Check syntax error in sources - run: find ./src/ ./tests/ -type f -name '*.php' -print0 | xargs -0 -L 1 -P 4 -- php -l + php-version: 7.4 - name: Install dependencies - run: composer install -q -n -a --no-progress --prefer-dist - - - name: Run unit tests - run: ./vendor/bin/phpunit --no-coverage + uses: "ramsey/composer-install@v1" - name: Check code styles - run: ./vendor/bin/phpcs + run: composer cs - name: Check Psalm - run: ./vendor/bin/psalm --show-info=false --no-progress --output-format=compact + run: composer psalm + + - name: Check cross-version PHP compatibility + run: composer phpcompat diff --git a/composer.json b/composer.json index 235d169..1667e23 100644 --- a/composer.json +++ b/composer.json @@ -44,8 +44,10 @@ "psalm": "@php ./vendor/vimeo/psalm/psalm", "tests": "@php ./vendor/phpunit/phpunit/phpunit", "tests:no-cov": "@php ./vendor/phpunit/phpunit/phpunit --no-coverage", + "phpcompat": "@php ./vendor/squizlabs/php_codesniffer/bin/phpcs -p . --standard=PHPCompatibility --ignore=*/vendor/* --extensions=php --basepath=./ --runtime-set testVersion 7.1-", "qa": [ "@cs", + "@phpcompat", "@psalm", "@tests:no-cov" ] diff --git a/psalm.xml b/psalm.xml index 7f763a8..fb1ed5c 100644 --- a/psalm.xml +++ b/psalm.xml @@ -2,23 +2,12 @@