diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 014f7539..076bab24 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,23 +12,23 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - - name: Validate composer.json and composer.lock - run: composer validate - - - name: Cache Composer packages - id: composer-cache - uses: actions/cache@v2 - with: - path: vendor - key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-php- - - - name: Install dependencies - if: steps.composer-cache.outputs.cache-hit != 'true' - run: composer install --prefer-dist --no-progress --no-suggest - - - name: Run PHPUnit - run: composer run-script test + - uses: actions/checkout@v2 + + - name: Validate composer.json and composer.lock + run: composer validate + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v2 + with: + path: vendor + key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php- + + - name: Install dependencies + if: steps.composer-cache.outputs.cache-hit != 'true' + run: composer install --prefer-dist --no-progress --no-suggest + + - name: Run PHPUnit + run: composer run-script test \ No newline at end of file diff --git a/.github/workflows/code-style.yml b/.github/workflows/code-style.yml new file mode 100644 index 00000000..16ab9a56 --- /dev/null +++ b/.github/workflows/code-style.yml @@ -0,0 +1,25 @@ +name: Code style + +on: [push, pull_request] + +permissions: + contents: read + +jobs: + phpcs: + name: PHPCS + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '7.4' + + - name: Install dependencies + run: composer update --prefer-dist --no-progress --no-suggest + + - name: Run script + run: vendor/bin/phpcs \ No newline at end of file diff --git a/.gitignore b/.gitignore index 96ccab44..8e409f4d 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,7 @@ .phan composer.lock +/.phpcs-cache +/phpcs.xml + .phpunit.result.cache \ No newline at end of file diff --git a/composer.json b/composer.json index d164a223..e3ca6e68 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,8 @@ "phan/phan": "^2.7" }, "require-dev": { - "phpunit/phpunit": "^9" + "phpunit/phpunit": "^9", + "squizlabs/php_codesniffer": "^3.7" }, "scripts": { "test": "vendor/bin/phpunit tests" diff --git a/phpcs.xml.dist b/phpcs.xml.dist new file mode 100644 index 00000000..15405496 --- /dev/null +++ b/phpcs.xml.dist @@ -0,0 +1,9 @@ + + + + + + + . +