Skip to content
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

[Question] Static Test action support custom Path #36

Open
julienanquetil opened this issue Sep 1, 2021 · 2 comments
Open

[Question] Static Test action support custom Path #36

julienanquetil opened this issue Sep 1, 2021 · 2 comments

Comments

@julienanquetil
Copy link
Contributor

Hi,
I'm currently got some Magento repo with custom code on "app/code".
My goal is to be able to make the Github action Static test execute only on app/code...

By default it's not supported by your nice setup.
I was thinking adding a parameter like there is for the standard, but for the "path to scan" and after if not empty analyze that folder.

Do you think it's the "good way" to go ? thanks

@jissereitsma
Copy link
Contributor

Thanks for the suggestion. Just for clearity, which GitHub action are you referring to? I guess the PHPStan version because the PHPCS action does not use composer or Magento or anything - it just installs PHPCS and runs it ... If you could share your setup it would be helpful I guess.

@julienanquetil
Copy link
Contributor Author

julienanquetil commented Sep 1, 2021

I Mean the phpcs one for example the default one

name: ExtDN M2 Coding Standard
on: [push, pull_request]

jobs:
  static:
    name: M2 Coding Standard
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: extdn/github-actions-m2/magento-coding-standard@master

if you get a git repo for a magento project and not a module you will get some "false" report (like not what I expect)
inspection on setup/ and other folder

Capture d’écran 2021-09-01 à 12 19 40

my goals is to run phpcs only on app/code/ folder by doing something like

Updating the action.yml like that

name: 'Magento 2 Coding Style'
author: 'ExtDN'
description: 'performs php static code analysis with the Magento 2 Coding Standard'
inputs:
  phpcs_standard:
    description: 'Path to your own PHPCS file or a specific standard. Leave empty to use "Magento2".'
    required: false
  folder_name:
    description: 'Path to run the PHPCS inspection if not the whole project".'
    required: false
runs:
  using: 'docker'
  image: 'docker://extdn/magento-coding-standard-action:latest'
branding:
  icon: 'code'  
  color: 'green'


and then update the entrypoint like

sh -c "/root/.composer/vendor/bin/phpcs --report=checkstyle --standard=$INPUT_PHPCS_STANDARD $GITHUB_WORKSPACE/${INPUT_FOLDER_NAME} -s $*"

and finally be able in the project repo to add the workflow like

name: PHPCS Tests dev
on: [push, pull_request]

jobs:
  static:
    name: Static Code Analysis PHPCS
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: extdn/github-actions-m2/magento-coding-standard@master
        with:
          folder_name: app/code/VENDORNAME

i hope it's more clear ?

I made a "quick & dirty" test by changing the docker image (by forking your's) and got my use case working as expected. Not sure if relevant for everyone but usefull on our case :)

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants