Skip to content

Commit

Permalink
Merge pull request #413 from greg0ire/exclude-test-from-analysis
Browse files Browse the repository at this point in the history
Exclude test from analysis
  • Loading branch information
greg0ire authored May 16, 2021
2 parents 69ba5b7 + 937b285 commit 426dcad
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 18 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@

name: "Coding Standards"

on: ["pull_request", "push"]
on:
pull_request:
branches:
- "*.x"
push:
branches:
- "*.x"

jobs:
coding-standards:
Expand All @@ -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"
Expand Down
55 changes: 47 additions & 8 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ on:
pull_request:
branches:
- "*.x"
- "master"
push:
branches:
- "*.x"
- "master"

env:
fail-fast: true

jobs:
phpunit:
Expand All @@ -23,29 +24,67 @@ 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"
uses: "actions/checkout@v2"
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"
8 changes: 4 additions & 4 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@

name: "Static Analysis"

on:
pull_request:
branches:
- "*.x"
- "master"
push:
branches:
- "*.x"
- "master"

jobs:
static-analysis-phpstan:
Expand All @@ -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"
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"doctrine/cache": "^1.11 || ^2.0",
"doctrine/coding-standard": "^6.0 || ^8.1",
"phpstan/phpstan": "^0.12.20",
"phpunit/phpunit": "^7.5 || ^9.1.5",
"phpunit/phpunit": "^7.5 || ^8.0 || ^9.1.5",
"symfony/cache": "^4.4 || ^5.2"
},
"config": {
Expand Down
13 changes: 9 additions & 4 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
parameters:
level: 3
paths:
- lib
- tests
excludes_analyse:
- %currentWorkingDirectory%/tests/*/Fixtures/*
- %currentWorkingDirectory%/tests/Doctrine/Tests/Common/Annotations/ReservedKeywordsClasses.php
- %currentWorkingDirectory%/tests/Doctrine/Tests/Common/Annotations/Ticket/DCOM58Entity.php
- %currentWorkingDirectory%/tests/Doctrine/Tests/DoctrineTestCase.php
- tests/*/Fixtures/*
- tests/Doctrine/Tests/Common/Annotations/ReservedKeywordsClasses.php
- tests/Doctrine/Tests/Common/Annotations/Ticket/DCOM58Entity.php
- tests/Doctrine/Tests/DoctrineTestCase.php
- tests/Doctrine/Tests/Common/Annotations/CachedReaderTest.php
polluteScopeWithLoopInitialAssignments: true
ignoreErrors:
- '#Instantiated class Doctrine_Tests_Common_Annotations_Fixtures_ClassNoNamespaceNoComment not found#'
Expand Down

0 comments on commit 426dcad

Please sign in to comment.