-
-
Notifications
You must be signed in to change notification settings - Fork 5
86 lines (81 loc) · 2.62 KB
/
lint-and-analyse.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
name: Lint and analyse files
permissions:
contents: read
on:
workflow_dispatch:
pull_request:
paths:
- "**/*.js"
- "**/*.php"
push:
paths:
- "**/*.js"
- "**/*.php"
jobs:
lint-node:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: yarn cache
uses: actions/cache@v4
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install modules
run: yarn install
- name: Lint files
run: |
set +e
yarn run jshint --verbose
JSHINT=$?
echo "Running prettier"
yarn run prettier --list-different
PRETTIER=$?
if [[ $JSHINT != 0 ]] || [[ $PRETTIER != 0 ]]; then
echo "You have some errors to fix !";
exit 1;
fi
lint-php:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use php 7.2
uses: shivammathur/setup-php@v2
with:
php-version: 7.2
- name: Validate composer.json and composer.lock
run: composer validate
- name: Cache module
uses: actions/cache@v4
with:
path: ~/.composer/cache/
key: composer-cache
- name: Install dependencies
run: composer install --no-interaction
- name: Lint files
run: composer run phpcs
analyse-php:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use php 7.2
uses: shivammathur/setup-php@v2
with:
php-version: 7.2
- name: Cache module
uses: actions/cache@v4
with:
path: ~/.composer/cache/
key: composer-cache
- name: Install dependencies
run: composer install --no-interaction
- name: Analyse files
run: composer run phpstan