From 49184a2cf2d2060663a9e63d662016be495525c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Sun, 16 May 2021 19:28:28 +0200 Subject: [PATCH] Sync workflow files with upstream --- .github/workflows/coding-standards.yml | 10 +++- .github/workflows/continuous-integration.yml | 55 +++++++++++++++++--- .github/workflows/static-analysis.yml | 8 +-- phpstan.neon | 4 ++ 4 files changed, 64 insertions(+), 13 deletions(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index a548d01d5..f710db645 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -1,7 +1,13 @@ name: "Coding Standards" -on: ["pull_request", "push"] +on: + pull_request: + branches: + - "*.x" + push: + branches: + - "*.x" jobs: coding-standards: @@ -26,6 +32,8 @@ jobs: - name: "Install dependencies with Composer" uses: "ramsey/composer-install@v1" + with: + dependency-versions: "highest" # https://github.com/doctrine/.github/issues/3 - name: "Run PHP_CodeSniffer" diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 7a344bd21..e4bdcf4b7 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -4,11 +4,12 @@ on: pull_request: branches: - "*.x" - - "master" push: branches: - "*.x" - - "master" + +env: + fail-fast: true jobs: phpunit: @@ -23,11 +24,11 @@ jobs: - "7.3" - "7.4" - "8.0" - deps: + dependencies: - "highest" include: - - deps: "lowest" - php-version: "7.2" + - php-version: "7.2" + dependencies: "lowest" steps: - name: "Checkout" @@ -35,17 +36,55 @@ jobs: with: fetch-depth: 2 - - name: "Install PHP" + - name: "Install PHP with PCOV" uses: "shivammathur/setup-php@v2" + if: "${{ matrix.php-version != '7.1' }}" with: php-version: "${{ matrix.php-version }}" coverage: "pcov" ini-values: "zend.assertions=1" + - name: "Install PHP with XDebug" + uses: "shivammathur/setup-php@v2" + if: "${{ matrix.php-version == '7.1' }}" + with: + php-version: "${{ matrix.php-version }}" + coverage: "xdebug" + ini-values: "zend.assertions=1" + - name: "Install dependencies with Composer" uses: "ramsey/composer-install@v1" with: - dependency-versions: "${{ matrix.deps }}" + dependency-versions: "${{ matrix.dependencies }}" + composer-options: "--prefer-dist" - name: "Run PHPUnit" - run: "vendor/bin/phpunit" + run: "vendor/bin/phpunit --coverage-clover=coverage.xml" + + - name: "Upload coverage file" + uses: "actions/upload-artifact@v2" + with: + name: "phpunit-${{ matrix.php-version }}.coverage" + path: "coverage.xml" + + upload_coverage: + name: "Upload coverage to Codecov" + runs-on: "ubuntu-20.04" + needs: + - "phpunit" + + steps: + - name: "Checkout" + uses: "actions/checkout@v2" + with: + fetch-depth: 2 + + - name: "Download coverage files" + uses: "actions/download-artifact@v2" + with: + path: "reports" + + - name: "Upload to Codecov" + uses: "codecov/codecov-action@v1" + with: + directory: "reports" diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 7be649809..d0e0d857d 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -1,14 +1,13 @@ + name: "Static Analysis" on: pull_request: branches: - "*.x" - - "master" push: branches: - "*.x" - - "master" jobs: static-analysis-phpstan: @@ -29,10 +28,11 @@ jobs: with: coverage: "none" php-version: "${{ matrix.php-version }}" - tools: "cs2pr" - name: "Install dependencies with Composer" uses: "ramsey/composer-install@v1" + with: + dependency-versions: "highest" - name: "Run a static analysis with phpstan/phpstan" - run: "vendor/bin/phpstan analyse -l 3 -c phpstan.neon --error-format=checkstyle lib/ tests/ | cs2pr" + run: "vendor/bin/phpstan analyse" diff --git a/phpstan.neon b/phpstan.neon index 7871956e7..fb5991ee4 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,4 +1,8 @@ parameters: + level: 3 + paths: + - lib + - tests excludes_analyse: - tests/*/Fixtures/* - tests/Doctrine/Tests/Common/Annotations/ReservedKeywordsClasses.php