-
Notifications
You must be signed in to change notification settings - Fork 3
Require PHP 7.4, Fix CS and QA #48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
da60d75
Require PHP 7.4, Fix CS and QA
gmazzap 409b985
Do no update composer deps twice in CI
gmazzap 0e62f00
Try to fix unit tests in CI
gmazzap 91792b1
Another attempt at fixing unit test in CS CI
gmazzap c0fe5bd
fix: cover invalid author format in test
tfrommen 0331d1e
Ignore eval CS rule for tests
gmazzap b7a7fe4
Revert behavior fixing for PackageProxyContainer
gmazzap File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,29 +1,60 @@ | ||
| name: Quality assurance PHP | ||
|
|
||
| on: ['pull_request', 'push', 'workflow_dispatch'] | ||
| on: | ||
| push: | ||
| paths: | ||
| - '**workflows/php-qa.yml' | ||
| - '**.php' | ||
| - '**phpcs.xml.dist' | ||
| - '**psalm.xml' | ||
| - '**composer.json' | ||
| pull_request: | ||
| paths: | ||
| - '**workflows/php-qa.yml' | ||
| - '**.php' | ||
| - '**phpcs.xml.dist' | ||
| - '**psalm.xml' | ||
| - '**composer.json' | ||
| workflow_dispatch: | ||
| inputs: | ||
| jobs: | ||
| required: true | ||
| type: choice | ||
| default: 'Run all' | ||
| description: 'Choose jobs to run' | ||
| options: | ||
| - 'Run all' | ||
| - 'Run PHPCS only' | ||
| - 'Run Psalm only' | ||
| - 'Run lint only' | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
| group: "${{ github.workflow }}-${{ github.ref }}" | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| lint-php: | ||
| if: ${{ (github.event_name == 'workflow_dispatch') || (!contains(github.event.head_commit.message, 'skip lint')) }} | ||
| strategy: | ||
| matrix: | ||
| php: ["7.2", "7.3", "7.4", "8.0", "8.1", "8.2"] | ||
| uses: inpsyde/reusable-workflows/.github/workflows/lint-php.yml@main | ||
| with: | ||
| PHP_VERSION: ${{ matrix.php }} | ||
| lint: | ||
| if: ${{ (github.event_name != 'workflow_dispatch') || ((github.event.inputs.jobs == 'Run all') || (github.event.inputs.jobs == 'Run lint only')) }} | ||
| uses: inpsyde/reusable-workflows/.github/workflows/lint-php.yml@main | ||
| strategy: | ||
| matrix: | ||
| php: [ '7.4', '8.0', '8.1', '8.2', '8.3' ] | ||
| with: | ||
| PHP_VERSION: ${{ matrix.php }} | ||
| LINT_ARGS: '-e php --colors --show-deprecated ./src' | ||
|
|
||
| coding-standards-analysis-php: | ||
| if: ${{ (github.event_name == 'workflow_dispatch') || (!contains(github.event.head_commit.message, 'skip cs')) }} | ||
| needs: lint-php | ||
| uses: inpsyde/reusable-workflows/.github/workflows/coding-standards-php.yml@main | ||
| with: | ||
| PHPCS_ARGS: '--report=summary' | ||
| coding-standards-analysis: | ||
| if: ${{ (github.event_name != 'workflow_dispatch') || ((github.event.inputs.jobs == 'Run all') || (github.event.inputs.jobs == 'Run PHPCS only')) }} | ||
| uses: inpsyde/reusable-workflows/.github/workflows/coding-standards-php.yml@main | ||
| with: | ||
| PHP_VERSION: '8.3' | ||
|
|
||
| static-analysis-php: | ||
| if: ${{ (github.event_name == 'workflow_dispatch') || (!contains(github.event.head_commit.message, 'skip sa')) }} | ||
| needs: lint-php | ||
| uses: inpsyde/reusable-workflows/.github/workflows/static-analysis-php.yml@main | ||
| static-code-analysis: | ||
| if: ${{ (github.event_name != 'workflow_dispatch') || ((github.event.inputs.jobs == 'Run all') || (github.event.inputs.jobs == 'Run Psalm only')) }} | ||
| uses: inpsyde/reusable-workflows/.github/workflows/static-analysis-php.yml@main | ||
| strategy: | ||
| matrix: | ||
| php: [ '7.4', '8.0', '8.1', '8.2', '8.3' ] | ||
| with: | ||
| PHP_VERSION: ${{ matrix.php }} | ||
| PSALM_ARGS: --output-format=github --no-suggestions --no-cache --no-diff --find-unused-psalm-suppress | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,60 +1,72 @@ | ||
| name: PHP unit tests | ||
|
|
||
| on: ['pull_request', 'push', 'workflow_dispatch'] | ||
| on: | ||
| push: | ||
| paths: | ||
| - '**workflows/php-unit-tests.yml' | ||
| - '**.php' | ||
| - '**phpunit.xml.dist' | ||
| - '**composer.json' | ||
| pull_request: | ||
| paths: | ||
| - '**workflows/php-unit-tests.yml' | ||
| - '**.php' | ||
| - '**phpunit.xml.dist' | ||
| - '**composer.json' | ||
| workflow_dispatch: | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
| group: "${{ github.workflow }}-${{ github.ref }}" | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| tests-unit-php: | ||
| runs-on: ubuntu-latest | ||
| if: ${{ (github.event_name == 'workflow_dispatch') || (!contains(github.event.head_commit.message, 'skip tests')) }} | ||
|
|
||
| env: | ||
| USE_COVERAGE: 'no' | ||
|
|
||
| strategy: | ||
| matrix: | ||
| php-versions: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2' ] | ||
| dependency-versions: [ 'lowest', 'highest' ] | ||
| container-versions: [ '^1.1.0', '^2' ] | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v3 | ||
|
|
||
| - name: Use coverage? | ||
| if: ${{ (matrix.php-versions == '8.0') && (matrix.dependency-versions == 'highest') && (matrix.container-versions == '^2') }} | ||
| run: echo "USE_COVERAGE=yes" >> $GITHUB_ENV | ||
|
|
||
| - name: Setup PHP | ||
| uses: shivammathur/setup-php@v2 | ||
| with: | ||
| php-version: ${{ matrix.php-versions }} | ||
| ini-values: zend.assertions=1, error_reporting=-1, display_errors=On | ||
| coverage: ${{ ((env.USE_COVERAGE == 'yes') && 'xdebug') || 'none' }} | ||
|
|
||
| - name: Setup dependencies for PSR-11 target version | ||
| run: | | ||
| composer remove inpsyde/php-coding-standards inpsyde/wp-stubs-versions vimeo/psalm --dev --no-install | ||
| composer require "psr/container:${{ matrix.container-versions }}" --no-install | ||
|
|
||
| - name: Install Composer dependencies | ||
| uses: ramsey/composer-install@v2 | ||
| with: | ||
| dependency-versions: ${{ matrix.dependency-versions }} | ||
|
|
||
| - name: Run unit tests | ||
| run: | | ||
| ./vendor/bin/phpunit --atleast-version 9 && ./vendor/bin/phpunit --migrate-configuration || echo 'Config does not need updates.' | ||
| ./vendor/bin/phpunit ${{ ((env.USE_COVERAGE == 'yes') && '--coverage-clover coverage.xml') || '--no-coverage' }} | ||
|
|
||
| - name: Update coverage | ||
| if: ${{ env.USE_COVERAGE == 'yes' }} | ||
| uses: codecov/codecov-action@v3 | ||
| with: | ||
| token: ${{ secrets.CODECOV_TOKEN }} | ||
| files: ./coverage.xml | ||
| flags: unittests | ||
| verbose: true | ||
| tests-unit-php: | ||
| runs-on: ubuntu-latest | ||
| if: ${{ (github.event_name == 'workflow_dispatch') || (!contains(github.event.head_commit.message, 'skip tests')) }} | ||
|
|
||
| env: | ||
| USE_COVERAGE: 'no' | ||
|
|
||
| strategy: | ||
| matrix: | ||
| php-versions: [ '7.4', '8.0', '8.1', '8.2', '8.3' ] | ||
| dependency-versions: [ 'lowest', 'highest' ] | ||
| container-versions: [ '^1.1.0', '^2' ] | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Use coverage? | ||
| if: ${{ (matrix.php-versions == '8.2') && (matrix.dependency-versions == 'highest') && (matrix.container-versions == '^2') }} | ||
| run: echo "USE_COVERAGE=yes" >> $GITHUB_ENV | ||
|
|
||
| - name: Setup PHP | ||
| uses: shivammathur/setup-php@v2 | ||
| with: | ||
| php-version: ${{ matrix.php-versions }} | ||
| ini-values: zend.assertions=1, error_reporting=-1, display_errors=On | ||
| coverage: ${{ ((env.USE_COVERAGE == 'yes') && 'xdebug') || 'none' }} | ||
|
|
||
| - name: Setup dependencies for PSR-11 target version | ||
| run: | | ||
| composer remove inpsyde/php-coding-standards inpsyde/wp-stubs-versions vimeo/psalm --dev --no-update | ||
| composer require "psr/container:${{ matrix.container-versions }}" --no-update | ||
| composer config --no-plugins allow-plugins.roots/wordpress-core-installer false | ||
|
|
||
| - name: Install Composer dependencies | ||
| uses: ramsey/composer-install@v3 | ||
| with: | ||
| dependency-versions: ${{ matrix.dependency-versions }} | ||
|
|
||
| - name: Run unit tests | ||
| run: ./vendor/bin/phpunit ${{ ((env.USE_COVERAGE == 'yes') && '--coverage-clover coverage.xml') || '--no-coverage' }} | ||
|
|
||
| - name: Update coverage | ||
| if: ${{ env.USE_COVERAGE == 'yes' }} | ||
| uses: codecov/codecov-action@v4 | ||
| with: | ||
| token: ${{ secrets.CODECOV_TOKEN }} | ||
| files: ./coverage.xml | ||
| flags: unittests | ||
| verbose: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,46 @@ | ||
| <?xml version="1.0"?> | ||
| <ruleset> | ||
| <file>./src/</file> | ||
| <file>./tests/</file> | ||
| <file>./src</file> | ||
| <file>./tests</file> | ||
|
|
||
| <arg value="sp"/> | ||
| <arg name="colors"/> | ||
| <config name="testVersion" value="7.2-"/> | ||
| <config name="testVersion" value="7.4-"/> | ||
| <config name="ignore_warnings_on_exit" value="1"/> | ||
|
|
||
| <rule ref="Inpsyde"> | ||
| <exclude name="WordPress.PHP.DevelopmentFunctions.error_log_trigger_error" /> | ||
| </rule> | ||
|
|
||
| <rule ref="Inpsyde.CodeQuality.Psr4"> | ||
| <properties> | ||
| <property | ||
| name="psr4" | ||
| type="array" | ||
| value="Inpsyde\Modularity=>src,Inpsyde\Modularity\Tests=>tests/src,Inpsyde\Modularity\Tests\Unit=>tests/unit"/> | ||
| value=" | ||
| Inpsyde\Modularity=>src, | ||
| Inpsyde\Modularity\Tests=>tests/src, | ||
| Inpsyde\Modularity\Tests\Unit=>tests/unit" | ||
| /> | ||
| </properties> | ||
| </rule> | ||
|
|
||
| <rule ref="Inpsyde.CodeQuality.FunctionLength"> | ||
| <exclude-pattern>*/tests/*</exclude-pattern> | ||
| </rule> | ||
| <rule ref="Inpsyde.CodeQuality.ForbiddenPublicProperty"> | ||
| <exclude-pattern>*/tests/*</exclude-pattern> | ||
| </rule> | ||
| <rule ref="WordPress.PHP.DevelopmentFunctions"> | ||
| <exclude-pattern>*/tests/*</exclude-pattern> | ||
| </rule> | ||
| <rule ref="WordPress.PHP.DiscouragedPHPFunctions"> | ||
| <exclude-pattern>*/tests/*</exclude-pattern> | ||
| </rule> | ||
| <rule ref="WordPress.Security.EscapeOutput"> | ||
| <exclude-pattern>*/tests/*</exclude-pattern> | ||
| </rule> | ||
| <rule ref="Squiz.PHP.Eval"> | ||
| <exclude-pattern>*/tests/*</exclude-pattern> | ||
| </rule> | ||
| </ruleset> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.