forked from wp-cli/wp-cli.github.com
-
Notifications
You must be signed in to change notification settings - Fork 0
93 lines (77 loc) · 2.91 KB
/
code-quality.yml
File metadata and controls
93 lines (77 loc) · 2.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: Code Quality Checks
on:
pull_request:
push:
branches:
- main
- master
# Cancels all previous workflow runs for the same branch that have not yet completed.
concurrency:
# The concurrency group contains the workflow name and the branch name.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint: #-----------------------------------------------------------------------
name: Lint PHP files
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: Set up PHP environment
if: steps.check_composer_file.outputs.files_exists == 'true'
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
tools: cs2pr
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install Composer dependencies & cache dependencies
if: steps.check_composer_file.outputs.files_exists == 'true'
uses: "ramsey/composer-install@v2"
env:
COMPOSER_ROOT_VERSION: dev-${{ github.event.repository.default_branch }}
- 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
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: Set up PHP environment
if: steps.check_files.outputs.files_exists == 'true'
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
tools: cs2pr
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install Composer dependencies & cache dependencies
if: steps.check_files.outputs.files_exists == 'true'
uses: "ramsey/composer-install@v2"
env:
COMPOSER_ROOT_VERSION: dev-${{ github.event.repository.default_branch }}
- name: Check existence of vendor/bin/phpcs file
id: check_phpcs_binary_file
uses: andstor/file-existence-action@v1
with:
files: "vendor/bin/phpcs"
- name: Run PHPCS
if: steps.check_phpcs_binary_file.outputs.files_exists == 'true'
run: vendor/bin/phpcs -q --report=checkstyle | cs2pr