Refactored case sniffs to allow choosing snake or camel case. #46
Workflow file for this run
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
| name: Test PHP | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| - 'feature/**' | |
| workflow_dispatch: | |
| inputs: | |
| enable_terminal: | |
| type: boolean | |
| description: 'Enable terminal session.' | |
| required: false | |
| default: false | |
| jobs: | |
| test-php: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| php-versions: ['8.2', '8.3', '8.4', '8.5'] | |
| phpcs-versions: ['3', '4'] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Cache Composer dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: /tmp/composer-cache | |
| key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }} | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php-versions }} | |
| coverage: pcov | |
| ini-values: pcov.directory=. | |
| - name: Install dependencies | |
| run: | | |
| if [ "${{ matrix.php-versions }}" == "8.2" ]; then | |
| composer require --dev phpunit/phpunit:^11 --no-update | |
| fi | |
| if [ "${{ matrix.phpcs-versions }}" == "3" ]; then | |
| composer require squizlabs/php_codesniffer:^3.10 --no-update --with-all-dependencies | |
| composer require --dev drupal/coder:^8.3 --no-update --with-all-dependencies | |
| elif [ "${{ matrix.phpcs-versions }}" == "4" ]; then | |
| composer require squizlabs/php_codesniffer:^4 --no-update --with-all-dependencies | |
| composer require --dev drupal/coder:^9@alpha --no-update --with-all-dependencies | |
| fi | |
| composer install ${{ matrix.php-versions == '8.5' && '--ignore-platform-reqs' || '' }} | |
| - name: Validate composer.json | |
| run: | | |
| composer --verbose validate | |
| composer normalize --dry-run | |
| - name: Check coding standards | |
| run: composer lint | |
| continue-on-error: ${{ vars.CI_LINT_IGNORE_FAILURE == '1' }} | |
| - name: Run tests | |
| run: | | |
| if [ "${{ matrix.php-versions }}" != "8.2" ]; then | |
| composer test-coverage | |
| else | |
| composer test | |
| fi | |
| continue-on-error: ${{ vars.CI_TEST_IGNORE_FAILURE == '1' }} | |
| - name: Upload coverage report as an artifact | |
| uses: actions/upload-artifact@v5 | |
| if: ${{ matrix.php-versions != '8.2' }} | |
| with: | |
| name: ${{github.job}}-code-coverage-report-php${{ matrix.php-versions }}-phpcs${{ matrix.phpcs-versions }} | |
| path: .logs | |
| include-hidden-files: true | |
| if-no-files-found: error | |
| - name: Upload test results to Codecov | |
| uses: codecov/test-results-action@v1 | |
| if: ${{ env.CODECOV_TOKEN != '' && matrix.php-versions != '8.2' }} | |
| with: | |
| files: .logs/junit.xml | |
| fail_ci_if_error: true | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| - name: Upload coverage report to Codecov | |
| uses: codecov/codecov-action@v5 | |
| if: ${{ env.CODECOV_TOKEN != '' && matrix.php-versions != '8.2' }} | |
| with: | |
| files: .logs/cobertura.xml | |
| fail_ci_if_error: true | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| - name: Setup tmate session | |
| if: ${{ !cancelled() && github.event.inputs.enable_terminal }} | |
| uses: mxschmitt/action-tmate@v3 | |
| timeout-minutes: 30 |