-
Notifications
You must be signed in to change notification settings - Fork 207
52 lines (49 loc) · 1.53 KB
/
linting.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
name: Linting
on:
pull_request
env:
WP_VERSION: latest
WC_VERSION: latest
jobs:
php_lint:
name: PHP linting
runs-on: ubuntu-latest
steps:
# clone the repository
- uses: actions/checkout@v2
# enable dependencies caching
- uses: actions/cache@v2
with:
path: ~/.cache/composer/
key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }}
# setup PHP, but without debug extensions for reasonable performance
- uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
tools: composer
coverage: none
# install dependencies and run linter
- run: composer self-update 2.0.6 && composer install --no-progress && ./vendor/bin/phpcs --standard=phpcs.xml.dist -n $(git ls-files | grep .php$)
js_css_lint:
name: JS & CSS linting
runs-on: ubuntu-latest
steps:
# clone the repository
- uses: actions/checkout@v2
# use the node version defined in nvmrc
- uses: actions/setup-node@v2
with:
node-version-file: '.nvmrc'
# enable dependencies caching
- uses: actions/cache@v2
with:
path: ~/.cache/composer/
key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }}
- uses: actions/cache@v2
with:
path: ~/.npm/
key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }}
# install dependencies and run linter
- run: npm ci
- run: npm run lint:js
- run: npm run lint:css