Skip to content

Commit

Permalink
add cs checking to ci flow
Browse files Browse the repository at this point in the history
  • Loading branch information
salehhashemi1992 committed Oct 4, 2023
1 parent e967070 commit 7ef7fb5
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 3 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Validate composer.json and composer.lock
run: composer validate
Expand All @@ -26,9 +26,17 @@ jobs:
restore-keys: |
${{ runner.os }}-php-
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.3'

- name: Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer install --prefer-dist --no-progress --no-suggest

- name: Run script
run: composer run-script cs-check

- name: Run PHPUnit
run: composer run-script test
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@
.phan
composer.lock

/.phpcs-cache
/phpcs.xml

.phpunit.result.cache
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
"phan/phan": "^2.7"
},
"require-dev": {
"phpunit/phpunit": "^9"
"phpunit/phpunit": "^9",
"squizlabs/php_codesniffer": "^3.7"
},
"scripts": {
"test": "vendor/bin/phpunit tests"
"test": "vendor/bin/phpunit tests",
"cs-check" : "vendor/bin/phpcs"
}
}
12 changes: 12 additions & 0 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0"?>
<ruleset name="The Algorithms - PHP">
<description>PHP CodeSniffer configuration for The Algorithms - PHP.</description>

<!-- Set the default standard to PSR-12 -->
<arg name="standard" value="PSR12"/>

<file>.</file>

<!-- Include only .php files -->
<arg name="extensions" value="php"/>
</ruleset>

0 comments on commit 7ef7fb5

Please sign in to comment.