-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0d33652
commit 4a52ef8
Showing
1 changed file
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: Code Quality Checks | ||
|
||
on: pull_request | ||
|
||
jobs: | ||
lint: | ||
name: Linter | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out source code | ||
uses: actions/checkout@v2 | ||
- name: Check existence of composer.json file | ||
id: check_composer_file | ||
uses: andstor/file-existence-action@v1 | ||
with: | ||
files: "composer.json" | ||
- name: Get Composer cache Directory | ||
if: steps.check_composer_file.outputs.files_exists == 'true' | ||
id: composer-cache | ||
run: | | ||
echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
- name: Use Composer cache | ||
if: steps.check_composer_file.outputs.files_exists == 'true' | ||
uses: actions/cache@v1 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-composer- | ||
- name: Install dependencies | ||
if: steps.check_composer_file.outputs.files_exists == 'true' | ||
run: composer install --dev --prefer-dist --no-progress --no-suggest | ||
- name: Check existence of vendor/bin/parallel-lint file | ||
id: check_linter_file | ||
uses: andstor/file-existence-action@v1 | ||
with: | ||
files: "vendor/bin/parallel-lint" | ||
- name: Run Linter | ||
if: steps.check_linter_file.outputs.files_exists == 'true' | ||
run: vendor/bin/parallel-lint -j 10 . --exclude vendor --checkstyle | cs2pr --graceful-warnings | ||
|
||
phpcs: | ||
name: PHPCS | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out source code | ||
uses: actions/checkout@v2 | ||
- name: Check existence of composer.json & phpcs.xml.dist files | ||
id: check_files | ||
uses: andstor/file-existence-action@v1 | ||
with: | ||
files: "composer.json, phpcs.xml.dist" | ||
- name: Get Composer cache Directory | ||
if: steps.check_files.outputs.files_exists == 'true' | ||
id: composer-cache | ||
run: | | ||
echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
- name: Use Composer cache | ||
if: steps.check_files.outputs.files_exists == 'true' | ||
uses: actions/cache@v1 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-composer- | ||
- name: Install dependencies | ||
if: steps.check_files.outputs.files_exists == 'true' | ||
run: composer install --dev --prefer-dist --no-progress --no-suggest | ||
- name: Check existence of vendor/bin/phpcs file | ||
id: check_phpcs_binary_file | ||
uses: andstor/file-existence-action@v1 | ||
with: | ||
files: "vendor/bin/parallel-lint" | ||
- name: Run PHPCS | ||
if: steps.check_phpcs_binary_file.outputs.files_exists == 'true' | ||
run: vendor/bin/phpcs -q --report=checkstyle | cs2pr --graceful-warnings |