-
Notifications
You must be signed in to change notification settings - Fork 55
111 lines (94 loc) · 2.9 KB
/
coding-standards.yml
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
name: Coding Standards
on:
push:
branches:
- trunk
paths:
- '**.php'
- '**.js'
- '**.scss'
pull_request:
paths:
- '**.php'
- '**.js'
- '**.scss'
workflow_dispatch:
jobs:
# Runs PHP coding standards checks.
#
# Violations are reported inline with annotations.
#
# Performs the following steps:
# - Checks out the repository.
# - Sets up PHP.
# - Logs debug information.
# - Installs Composer dependencies (use cache if possible).
# - Make Composer packages available globally.
# - Logs PHP_CodeSniffer debug information.
# - Runs PHPCS on the full codebase with warnings suppressed.
phpcs:
name: PHP coding standards
runs-on: ubuntu-latest
if: ${{ github.repository == 'WordPress/health-check' || github.event_name == 'pull_request' }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
coverage: none
tools: composer, cs2pr
- name: Log debug information
run: |
php --version
composer --version
- name: Install Composer dependencies
uses: ramsey/composer-install@v2
with:
composer-options: "--no-progress --no-ansi --no-interaction"
- name: Make Composer packages available globally
run: echo "${PWD}/vendor/bin" >> $GITHUB_PATH
- name: Log PHPCS debug information
run: phpcs -i
- name: Run PHPCS on all Core files
run: phpcs -q -n --report=checkstyle | cs2pr
- name: Check test suite files for warnings
run: phpcs tests -q --report=checkstyle | cs2pr
# Runs the JavaScript and CSS coding standards checks.
#
# Performs the following steps:
# - Checks out the repository.
# - Logs debug information about the runner container.
# - Installs NodeJS 12 (todo: install the version of NPM specified in the `.nvmrc` file to support older branches)
# - Sets up caching for NPM.
# - Logs updated debug information.
# _ Installs dependencies.
# - Run the ESLint checks.
# - Run the StyleLint checks.
eslint:
name: JavaScript and CSS style linters
runs-on: ubuntu-latest
if: ${{ github.repository == 'WordPress/health-check' || github.event_name == 'pull_request' }}
env:
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install NodeJS
uses: actions/setup-node@v3
with:
node-version: 16
cache: npm
- name: Log debug information
run: |
npm --version
node --version
git --version
svn --version
- name: Install Dependencies
run: npm ci
- name: Run ESLint
run: npm run lint:js
- name: Run StyleLint
run: npm run lint:css