10up / wpcs-action

GitHub Action to help you lint your PHP without additional dependencies within your codebase
MIT License
54 stars 13 forks source link

Allowed memory size exceeded #40

Closed pokhiii closed 6 months ago

pokhiii commented 6 months ago

Describe your question

My .github/workflows/wpcs.yml file

name: WPCS check

on: pull_request

jobs:
  phpcs:
      name: WPCS
      runs-on: ubuntu-latest
      steps:
        - uses: actions/checkout@v3
        - name: WPCS check
          uses: 10up/wpcs-action@stable
        - name: WPCS check
          uses: 10up/wpcs-action@stable
          with:
            enable_warnings: false # Enable checking for warnings (-w)
            paths: 'public/wp-content/themes/xyz' # Paths to check, space separated
            excludes: '' # Paths to excludes, space separated
            standard: 'WordPress' # Standard to use. Accepts WordPress|WordPress-Core|WordPress-Docs|WordPress-Extra|WordPress-VIP-Go|WordPressVIPMinimum|10up-Default.
            standard_repo: '' # Public (git) repository URL of the coding standard
            repo_branch: 'master' # Branch of Standard repository
            phpcs_bin_path: 'phpcs' # Custom PHPCS bin path
            use_local_config: 'false' # Use local config if available
            extra_args: '' # Extra arguments passing to the command

GitHub Action Logs

Run 10up/wpcs-action@stable
/usr/bin/docker run --name b0d2b9517f5e[8](https://github.com/pokhiii/xyz/actions/runs/8081233395/job/22079321658#step:4:9)1e4dbcac[9](https://github.com/pokhiii/xyz/actions/runs/8081233395/job/22079321658#step:4:10)9de2d5c1a3221_db14a9 --label 539b0d --workdir /github/workspace --rm -e "INPUT_ENABLE_WARNINGS" -e "INPUT_PATHS" -e "INPUT_EXCLUDES" -e "INPUT_STANDARD" -e "INPUT_STANDARD_REPO" -e "INPUT_REPO_BRANCH" -e "INPUT_PHPCS_BIN_PATH" -e "INPUT_USE_LOCAL_CONFIG" -e "INPUT_EXTRA_ARGS" -e "HOME" -e "GITHUB_JOB" -e "GITHUB_REF" -e "GITHUB_SHA" -e "GITHUB_REPOSITORY" -e "GITHUB_REPOSITORY_OWNER" -e "GITHUB_REPOSITORY_OWNER_ID" -e "GITHUB_RUN_ID" -e "GITHUB_RUN_NUMBER" -e "GITHUB_RETENTION_DAYS" -e "GITHUB_RUN_ATTEMPT" -e "GITHUB_REPOSITORY_ID" -e "GITHUB_ACTOR_ID" -e "GITHUB_ACTOR" -e "GITHUB_TRIGGERING_ACTOR" -e "GITHUB_WORKFLOW" -e "GITHUB_HEAD_REF" -e "GITHUB_BASE_REF" -e "GITHUB_EVENT_NAME" -e "GITHUB_SERVER_URL" -e "GITHUB_API_URL" -e "GITHUB_GRAPHQL_URL" -e "GITHUB_REF_NAME" -e "GITHUB_REF_PROTECTED" -e "GITHUB_REF_TYPE" -e "GITHUB_WORKFLOW_REF" -e "GITHUB_WORKFLOW_SHA" -e "GITHUB_WORKSPACE" -e "GITHUB_ACTION" -e "GITHUB_EVENT_PATH" -e "GITHUB_ACTION_REPOS
Cloning into '/github/home/wpcs'...
Note: switching to '7da1894633f168fe244afc6de00d141f27517b62'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:
  git switch -c <new-branch-name>
Or undo this operation with:
  git switch -
Turn off this advice by setting config variable advice.detachedHead to false
Using config file: /usr/bin/CodeSniffer.conf
Config value "installed_paths" added successfully
The installed coding standards are MySource, PEAR, PSR1, PSR2, PSR[12](https://github.com/pokhiii/xyz/actions/runs/8081233395/job/22079321658#step:4:13), Squiz, Zend, WordPress, WordPress-Core, WordPress-Docs and WordPress-Extra
Check for warnings disabled
Fatal error: Allowed memory size of [13](https://github.com/pokhiii/xyz/actions/runs/8081233395/job/22079321658#step:4:14)42[17](https://github.com/pokhiii/xyz/actions/runs/8081233395/job/22079321658#step:4:18)728 bytes exhausted (tried to allocate [20](https://github.com/pokhiii/xyz/actions/runs/8081233395/job/22079321658#step:4:21)480 bytes) in phar:///usr/bin/phpcs/src/Tokenizers/PHP.php on line 3
The PHP_CodeSniffer "phpcs" command ran out of memory.
Either raise the "memory_limit" of PHP in the php.ini file or raise the memory limit at runtime
using `phpcs -d memory_limit=512M` (replace 512M with the desired memory limit).

Screenshot

image

Code of Conduct

jeffpaul commented 6 months ago

@pokhiii you can at least remove the duplicate reference in your workflow file:

        - name: WPCS check
          uses: 10up/wpcs-action@stable
jeffpaul commented 6 months ago

you probably also don't need most of the rows after with: besides the non-default setting of paths: 'public/wp-content/themes/xyz' # Paths to check, space separated

pokhiii commented 6 months ago

@jeffpaul You rock! Applied both your suggestions and it worked. Thank you sir!