-
Notifications
You must be signed in to change notification settings - Fork 42
Code quality #51
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
Code quality #51
Changes from all commits
71aa6ea
e3e7183
7906be1
59001f4
60cee78
9229e6c
f4680e5
0276308
e785b77
5517cbc
5aad532
6691c98
55ceebf
7e3c912
322c698
1063eea
8488f8b
25cd6ab
17937e8
1662929
4eb3698
5d790ee
4e5b8b8
ee06993
e697225
6e20f1b
442c262
0a8fa98
73cb1ce
6210e94
108a002
bc9c354
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| name: "Setup PHP & Composer" | ||
| description: "Setup PHP & installs composer dependencies" | ||
| inputs: | ||
| PHP_VERSION: | ||
| description: PHP version | ||
| default: "8.2" | ||
| required: false | ||
| type: string | ||
| PHP_TOOLS: | ||
| description: PHP version | ||
| default: "" | ||
| required: false | ||
| type: string | ||
| COMPOSER_ARGS: | ||
| description: Set of arguments passed to Composer. | ||
| default: "--prefer-dist --no-scripts" | ||
| required: false | ||
| type: string | ||
| INSTALL_DEPS: | ||
| description: Whether to install dependencies or not. | ||
| default: true | ||
| required: false | ||
| type: boolean | ||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Set up PHP | ||
| uses: shivammathur/setup-php@v2 | ||
| with: | ||
| php-version: ${{ inputs.PHP_VERSION }} | ||
| tools: ${{ format('composer,{0}', inputs.PHP_TOOLS) }} | ||
| - name: Remove lock file | ||
| shell: bash | ||
| run: rm -f composer.lock | ||
| - name: Install Composer dependencies | ||
| if: ${{ inputs.INSTALL_DEPS == 'true' }} | ||
| uses: ramsey/composer-install@v3 | ||
| with: | ||
| composer-options: ${{ inputs.COMPOSER_ARGS }} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| name: PHP lint | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - master | ||
| paths: | ||
| - "**.php" | ||
| - "**composer.json" | ||
| pull_request: | ||
| branches: | ||
| - master | ||
| paths: | ||
| - "**.php" | ||
| - "**composer.json" | ||
| types: | ||
| - opened | ||
| - synchronize | ||
| - ready_for_review | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| php-lint: | ||
| name: PHP lint | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
|
|
||
| - name: Install dependencies | ||
| uses: ./.github/actions/setup | ||
| with: | ||
| PHP_TOOLS: "parallel-lint,cs2pr" | ||
| INSTALL_DEPS: false | ||
|
|
||
| - name: Get changed files | ||
| id: changed-files | ||
| uses: tj-actions/changed-files@v47 | ||
| with: | ||
| files: "**.php" | ||
|
|
||
| - name: Run PHP lint | ||
| if: steps.changed-files.outputs.all_changed_files != '' | ||
| run: parallel-lint --exclude .git --exclude vendor --checkstyle ${{ join(steps.changed-files.outputs.all_changed_files, ' ') }} | cs2pr |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,41 @@ | ||||||
| name: PHP Rector | ||||||
|
|
||||||
| on: | ||||||
| push: | ||||||
| branches: | ||||||
| - master | ||||||
| paths: | ||||||
| - "**.php" | ||||||
| - "**composer.json" | ||||||
| pull_request: | ||||||
| branches: | ||||||
| - master | ||||||
| paths: | ||||||
| - "**.php" | ||||||
| - "**composer.json" | ||||||
| types: | ||||||
| - opened | ||||||
| - synchronize | ||||||
| - ready_for_review | ||||||
|
|
||||||
| concurrency: | ||||||
| group: ${{ github.workflow }}-${{ github.ref }} | ||||||
| cancel-in-progress: true | ||||||
|
|
||||||
| jobs: | ||||||
| php-cs: | ||||||
| name: PHP Rector | ||||||
| runs-on: ubuntu-latest | ||||||
| steps: | ||||||
| - uses: actions/checkout@v6 | ||||||
|
|
||||||
| - name: Install dependencies | ||||||
| uses: ./.github/actions/setup | ||||||
|
|
||||||
| - name: Get changed files | ||||||
| id: changed-files | ||||||
| uses: tj-actions/changed-files@v47 | ||||||
|
|
||||||
| - name: Run Rector checks | ||||||
| if: steps.changed-files.outputs.all_changed_files != '' | ||||||
| run: ./vendor/bin/rector process --dry-run ${{ steps.changed-files.outputs.files }} | ||||||
|
||||||
| run: ./vendor/bin/rector process --dry-run ${{ steps.changed-files.outputs.files }} | |
| run: ./vendor/bin/rector process --dry-run ${{ steps.changed-files.outputs.all_changed_files }} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,114 @@ | ||
| name: PHP unit tests | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - master | ||
| paths: | ||
| - "**workflows/php-unit-tests.yml" | ||
| - "**.php" | ||
| - "**composer.*" | ||
| - "**phpunit.xml" | ||
| pull_request: | ||
| branches: | ||
| - master | ||
| paths: | ||
| - "**workflows/php-unit-tests.yml" | ||
|
Levdbas marked this conversation as resolved.
|
||
| - "**.php" | ||
| - "**composer.*" | ||
| - "**phpunit.xml" | ||
| types: | ||
| - opened | ||
| - synchronize | ||
| - ready_for_review | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| # ============================================================================= | ||
| # Detect PHP versions from composer.json | ||
| # ============================================================================= | ||
| php-versions: | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| versions: ${{ steps.versions.outputs.version }} | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - id: versions | ||
| uses: WyriHaximus/github-action-composer-php-versions-in-range@v1 | ||
| with: | ||
| upcomingReleases: true | ||
|
|
||
| # ============================================================================= | ||
| # Compatibility tests: PHP versions x WP versions | ||
| # ============================================================================= | ||
| php-unit-tests: | ||
| needs: php-versions | ||
| runs-on: ubuntu-latest | ||
| continue-on-error: ${{ matrix.experimental }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| php: ${{ fromJson(needs.php-versions.outputs.versions) }} | ||
| wp: ["latest"] | ||
| dependency-version: ["highest", "lowest"] | ||
| experimental: [false] | ||
| coverage: [false] | ||
| include: | ||
| # Oldest supported WP with lowest deps | ||
| - php: "8.2" | ||
| wp: "6.3" | ||
| dependency-version: "lowest" | ||
| experimental: false | ||
| coverage: false | ||
| # Coverage: PHP 8.2, WP latest, highest deps | ||
| - php: "8.2" | ||
| wp: "latest" | ||
| dependency-version: "highest" | ||
| experimental: false | ||
| coverage: true | ||
| # Trunk (experimental) | ||
| - php: "8.5" | ||
| wp: "trunk" | ||
| dependency-version: "highest" | ||
| experimental: true | ||
| coverage: false | ||
|
|
||
| name: PHP ${{ matrix.php }} | WP ${{ matrix.wp }} | ${{ matrix.dependency-version }}${{ matrix.coverage && ' | coverage' || '' }} | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v6 | ||
|
|
||
| - name: Setup PHP | ||
| uses: shivammathur/setup-php@v2 | ||
| with: | ||
| php-version: ${{ matrix.php }} | ||
| coverage: ${{ matrix.coverage && 'pcov' || 'none' }} | ||
| tools: composer:v2 | ||
| extensions: curl, date, dom, iconv, json, libxml, gd, sqlite3 | ||
| ini-values: ${{ matrix.coverage && 'pcov.directory=src' || '' }} | ||
|
|
||
| - name: Setup problem matchers | ||
| run: | | ||
| echo "::add-matcher::${{ runner.tool_cache }}/php.json" | ||
| echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" | ||
|
|
||
| - uses: ramsey/composer-install@v4 | ||
| with: | ||
| dependency-versions: ${{ matrix.dependency-version }} | ||
|
|
||
| # PHP 8.5: Collision and curl have deprecations we can't fix | ||
| - name: Disable failOnDeprecation for PHP 8.5 | ||
| if: matrix.experimental | ||
| run: sed -i 's/failOnDeprecation="true"/failOnDeprecation="false"/' phpunit.xml | ||
|
|
||
| - name: Create coverage directory | ||
| if: matrix.coverage | ||
| run: mkdir -p build/logs | ||
|
|
||
| - name: Run default testsuite | ||
| run: composer test ${{ matrix.coverage && '-- --coverage-php build/coverage-default.cov' || '' }} | ||
| env: | ||
| WP_VERSION: ${{ matrix.wp }} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,25 @@ | ||
| # osx noise | ||
| !/src/Cache | ||
| .tmp | ||
| *~ | ||
|
|
||
| # OS | ||
| .DS_Store | ||
| profile | ||
|
|
||
| # xcode noise | ||
| build/* | ||
| *.mode1 | ||
| *.mode1v3 | ||
| *.mode2v3 | ||
| *.perspective | ||
| *.perspectivev3 | ||
| *.pbxuser | ||
| *.xcworkspace | ||
| xcuserdata | ||
| # IDE and local environment | ||
| .idea | ||
| .vscode | ||
| *.swp | ||
|
|
||
| # svn & cvs | ||
| .svn | ||
| CVS | ||
| # Packages | ||
| vendor | ||
| composer.lock | ||
| # Application | ||
| build | ||
| /cache | ||
| twig-cache/* | ||
|
|
||
| # Tests | ||
| .phpunit.result.cache | ||
| /wp-content | ||
| /tmp | ||
| /.phpunit.cache |
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.