Skip to content

Commit

Permalink
Add code-style GitHub action
Browse files Browse the repository at this point in the history
  • Loading branch information
olvlvl committed Jul 13, 2021
1 parent 7fc8628 commit 5017185
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 10 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/code-style.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: code-style

on:
- push
- pull_request

jobs:
phpstan:
name: PHPCS
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.0"
ini-values: memory_limit=-1
tools: composer:v2, phpcs

- name: Run PHPCS
run: phpcs
20 changes: 10 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
ARG PHP_VERSION
FROM php:${PHP_VERSION}-alpine

RUN apk add --no-cache make

ENV COMPOSER_ALLOW_SUPERUSER 1
RUN curl -o /tmp/composer-setup.php https://getcomposer.org/installer && \
curl -o /tmp/composer-setup.sig https://composer.github.io/installer.sig && \
php -r "if (hash('SHA384', file_get_contents('/tmp/composer-setup.php')) !== trim(file_get_contents('/tmp/composer-setup.sig'))) { unlink('/tmp/composer-setup.php'); echo 'Invalid installer' . PHP_EOL; exit(1); }" && \
php /tmp/composer-setup.php && \
mv composer.phar /usr/local/bin/composer

RUN apk add --no-cache $PHPIZE_DEPS &&\
RUN apk add --no-cache make $PHPIZE_DEPS &&\
pecl install xdebug &&\
docker-php-ext-enable xdebug &&\
echo $'\
Expand All @@ -19,4 +10,13 @@ xdebug.mode=develop\n\
xdebug.start_with_request=yes\n\
' >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini

ENV COMPOSER_ALLOW_SUPERUSER 1

RUN curl -s https://raw.githubusercontent.com/composer/getcomposer.org/76a7060ccb93902cd7576b67264ad91c8a2700e2/web/installer | php -- --quiet && \
mv composer.phar /usr/local/bin/composer

ENV PATH /root/.composer/vendor/bin:$PATH

RUN composer global require squizlabs/php_codesniffer

WORKDIR app
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ with a container, run `make test-container-72` or `make test-container-74` to cr
The package is continuously tested by [Travis CI](http://about.travis-ci.org/).

[![Tests](https://github.com/olvlvl/symfony-dependency-injection-proxy/workflows/test/badge.svg?branch=master)](https://github.com/olvlvl/symfony-dependency-injection-proxy/actions?query=workflow%3Atest)
[![Code Style](https://github.com/olvlvl/symfony-dependency-injection-proxy/workflows/code-style/badge.svg?branch=main)](https://github.com/olvlvl/symfony-dependency-injection-proxy/actions?query=workflow%3Acode-style)



Expand Down
8 changes: 8 additions & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="PHP_CodeSniffer" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/squizlabs/PHP_CodeSniffer/master/phpcs.xsd">
<file>lib</file>
<file>tests</file>
<exclude-pattern>*/tests/sandbox/*</exclude-pattern>

<rule ref="PSR12"/>
</ruleset>

0 comments on commit 5017185

Please sign in to comment.