diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..eead528 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +# Container image that runs your code +FROM php:7.3-cli-alpine3.9 + +COPY --from=composer:1 /usr/bin/composer /usr/local/bin/composer + +RUN /usr/local/bin/composer global require magento/magento-coding-standard:* +RUN ~/.composer/vendor/bin/phpcs --config-set installed_paths ../../magento/magento-coding-standard/ +RUN echo memory_limit = -1 >> /usr/local/etc/php/conf.d/custom-memory.ini +# Copies your code file from your action repository to the filesystem path `/` of the container +COPY entrypoint.sh /entrypoint.sh + +# Code file to execute when the docker container starts up (`entrypoint.sh`) +ENTRYPOINT ["/entrypoint.sh"] \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..36f2596 --- /dev/null +++ b/README.md @@ -0,0 +1,21 @@ +# Coding Standard for Magento 2 docker action + +This action checks coding standard of magento 2 extensions. + +## Inputs + +## `error-severity` + +The severity of error to check. Default `"10"`. + +## Outputs + +## `errors` + +The test result + +## Example usage + +uses: actions/magento2-docker-action@v1 +with: + error-severity: '10' \ No newline at end of file diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..cd9b3b8 --- /dev/null +++ b/action.yml @@ -0,0 +1,16 @@ +# action.yml +name: 'Coding Standard for Magento 2' +description: 'Github Action for magento 2' +inputs: + error-severity: # id of input + description: 'Error severity' + required: false + default: '10' +outputs: + time: # id of output + description: 'The test result' +runs: + using: 'docker' + image: 'Dockerfile' + args: + - ${{ inputs.error-severity }} \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 0000000..c65e5e0 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,4 @@ +#!/bin/sh -l + +cd $GITHUB_WORKSPACE +sh -c "/root/.composer/vendor/bin/phpcs --standard=Magento2 --error-severity=10 --warning-severity=8 $GITHUB_WORKSPACE -s $*"