Skip to content

Commit

Permalink
ci: introduce phpcs, phpmd (#428)
Browse files Browse the repository at this point in the history
* ci: introduce phpcs, phpmd

* test: fix code sniffs

* test: fix mess detector
  • Loading branch information
g105b authored Mar 2, 2023
1 parent 307dba0 commit 1f3a429
Show file tree
Hide file tree
Showing 15 changed files with 1,342 additions and 67 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,53 @@ jobs:
php_version: ${{ matrix.php }}
path: src/

phpmd:
runs-on: ubuntu-latest
needs: [ composer ]
strategy:
matrix:
php: [ 8.1, 8.2 ]

steps:
- uses: actions/download-artifact@v3
with:
name: build-artifact
path: /tmp/github-actions

- name: Extract build archive
run: tar -xvf /tmp/github-actions/build.tar ./

- name: PHP Mess Detector
uses: php-actions/phpmd@v1
with:
php_version: ${{ matrix.php }}
path: src/
output: text
ruleset: phpmd.xml

phpcs:
runs-on: ubuntu-latest
needs: [ composer ]
strategy:
matrix:
php: [ 8.1, 8.2 ]

steps:
- uses: actions/download-artifact@v3
with:
name: build-artifact
path: /tmp/github-actions

- name: Extract build archive
run: tar -xvf /tmp/github-actions/build.tar ./

- name: PHP Code Sniffer
uses: php-actions/phpcs@v1
with:
php_version: ${{ matrix.php }}
path: src/
standard: phpcs.xml

remove_old_artifacts:
runs-on: ubuntu-latest

Expand Down
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@

"require-dev": {
"phpstan/phpstan": "^1.9",
"phpunit/phpunit": "^10.0"
"phpunit/phpunit": "^10.0",
"phpmd/phpmd": "^2.13",
"squizlabs/php_codesniffer": "^3.7"
},

"license": "MIT",
Expand Down
Loading

0 comments on commit 1f3a429

Please sign in to comment.