-
Notifications
You must be signed in to change notification settings - Fork 156
83 lines (74 loc) · 2.4 KB
/
lint.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
name: Linting
env:
COMPOSER_VERSION: "2"
COMPOSER_CACHE: "${{ github.workspace }}/.composer-cache"
on:
push:
branches:
- develop
- trunk
pull_request:
branches:
- develop
jobs:
eslint:
name: eslint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use desired version of NodeJS
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Cache Node
uses: actions/cache@v4
with:
path: |
node_modules
~/.cache
~/.npm
key: ${{ hashFiles('package-lock.json') }}
- name: Check versions
run: npm -v; node -v
- name: npm install
run: npm install
- name: Generate linting report
run: npm run lint:js -- --output-file eslint-report.json --format json
continue-on-error: true
- name: Annotate code linting results
uses: ataylorme/[email protected]
with:
repo-token: '${{ secrets.GITHUB_TOKEN }}'
report-json: 'eslint-report.json'
- name: Update summary
run: |
npm_config_yes=true npx github:10up/eslint-json-to-md --path ./eslint-report.json --output ./eslint-report.md
cat eslint-report.md >> $GITHUB_STEP_SUMMARY
if: ${{ failure() }}
phpcs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- id: changed-files
uses: tj-actions/changed-files@v44
with:
files: |
**/*.php
- name: Set PHP version
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
tools: composer:v2, cs2pr
coverage: none
- name: Install dependencies
run: composer install
- name: Test all files
if: ${{ github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/trunk' }}
run: ./vendor/bin/phpcs . --report-full --report-checkstyle=./.github/phpcs-report.xml
- name: Test changed files
if: ${{ steps.changed-files.outputs.any_changed == 'true' && github.ref != 'refs/heads/develop' && github.ref != 'refs/heads/trunk' }}
run: ./vendor/bin/phpcs ${{ steps.changed-files.outputs.all_changed_files }} --report-full --report-checkstyle=./.github/phpcs-report.xml --runtime-set testVersion 7.4-
- name: Show PHPCS results in PR
if: ${{ always() }}
run: cs2pr ./.github/phpcs-report.xml