mirror of
https://github.com/TheAlgorithms/PHP.git
synced 2025-01-16 22:58:14 +01:00
add cs checking to ci flow
This commit is contained in:
parent
a554210156
commit
ca17a0db74
32
.github/workflows/ci.yml
vendored
32
.github/workflows/ci.yml
vendored
@ -12,23 +12,23 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Validate composer.json and composer.lock
|
- name: Validate composer.json and composer.lock
|
||||||
run: composer validate
|
run: composer validate
|
||||||
|
|
||||||
- name: Cache Composer packages
|
- name: Cache Composer packages
|
||||||
id: composer-cache
|
id: composer-cache
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: vendor
|
path: vendor
|
||||||
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-php-
|
${{ runner.os }}-php-
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
if: steps.composer-cache.outputs.cache-hit != 'true'
|
if: steps.composer-cache.outputs.cache-hit != 'true'
|
||||||
run: composer install --prefer-dist --no-progress --no-suggest
|
run: composer install --prefer-dist --no-progress --no-suggest
|
||||||
|
|
||||||
- name: Run PHPUnit
|
- name: Run PHPUnit
|
||||||
run: composer run-script test
|
run: composer run-script test
|
25
.github/workflows/code-style.yml
vendored
Normal file
25
.github/workflows/code-style.yml
vendored
Normal file
@ -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
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -4,4 +4,7 @@
|
|||||||
.phan
|
.phan
|
||||||
composer.lock
|
composer.lock
|
||||||
|
|
||||||
|
/.phpcs-cache
|
||||||
|
/phpcs.xml
|
||||||
|
|
||||||
.phpunit.result.cache
|
.phpunit.result.cache
|
@ -12,7 +12,8 @@
|
|||||||
"phan/phan": "^2.7"
|
"phan/phan": "^2.7"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/phpunit": "^9"
|
"phpunit/phpunit": "^9",
|
||||||
|
"squizlabs/php_codesniffer": "^3.7"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "vendor/bin/phpunit tests"
|
"test": "vendor/bin/phpunit tests"
|
||||||
|
9
phpcs.xml.dist
Normal file
9
phpcs.xml.dist
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd">
|
||||||
|
|
||||||
|
<arg name="extensions" value="php"/>
|
||||||
|
<rule ref="PSR12"/>
|
||||||
|
|
||||||
|
<file>.</file>
|
||||||
|
</ruleset>
|
Loading…
x
Reference in New Issue
Block a user