-
Notifications
You must be signed in to change notification settings - Fork 5
53 lines (47 loc) · 1.53 KB
/
code-checks.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
name: Code Checks
on: [pull_request]
jobs:
codechecks:
name: PHPStan and phpcs
runs-on: ubuntu-20.04
timeout-minutes: 15
steps:
- name: Setup env
run: |
echo "REPO_NAME=${PWD##*/}" >> $GITHUB_ENV
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
# No composer nor xdebug, but we need our commandline tools.
tools: none, phpstan, phpcs
coverage: none
# The checkout action refuses to put it outside, so we have to do it in
# two steps.
- name: Checkout coding standard
uses: actions/checkout@v4
with:
repository: backdrop-ops/phpcs
ref: 1.0.0-beta2
path: phpcs
- name: Move standard outside current dir
run: mv phpcs ..
# Core code is necessary for phpstan.
- name: Checkout Backdrop core
uses: actions/checkout@v4
with:
repository: backdrop/backdrop
- name: Checkout module
uses: actions/checkout@v4
with:
path: modules/${{ env.REPO_NAME }}
- name: Run PHPStan
run: |
cd modules/${{ env.REPO_NAME }}
phpstan analyze -c .github/phpstan/phpstan.neon --error-format=github --no-progress .
# We run phpcs even if phpstan fails.
- name: Run CodeSniffer
if: ${{ always() }}
run: |
cd modules/${{ env.REPO_NAME }}
phpcs --standard=../../../phpcs/Backdrop --report=.github/misc/Github.php -n --basepath=. *