Skip to content

Commit 326792a

Browse files
committed
Run static analysis in Github Actions
1 parent 76a15ec commit 326792a

3 files changed

Lines changed: 33 additions & 5 deletions

File tree

.github/workflows/phpstan.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Static analysis (phpstan)
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- name: Checkout code
11+
uses: actions/checkout@v4
12+
with:
13+
fetch-depth: 0
14+
15+
- name: Setup PHP
16+
uses: shivammathur/setup-php@v2
17+
with:
18+
php-version: 8.2
19+
extensions: mbstring, gd, bcmath, imagick
20+
21+
- name: Install dependencies
22+
run: composer install --prefer-dist --no-progress --no-interaction
23+
24+
- name: Run analysis
25+
run: vendor/bin/phpstan analyse src --level 1

.github/workflows/phpunit.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
1-
name: phpunit
1+
name: Unit tests (phpunit)
22

33
on: [push, pull_request]
44

55
jobs:
66
build:
7-
87
runs-on: ubuntu-latest
98

109
strategy:
1110
matrix:
1211
php-versions: ['7.3', '7.4', '8.0', '8.1', '8.2']
1312

1413
steps:
15-
- uses: actions/checkout@v4
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
1618

1719
- name: Setup PHP
1820
uses: shivammathur/setup-php@v2
@@ -24,7 +26,7 @@ jobs:
2426
run: composer validate
2527

2628
- name: Install dependencies
27-
run: composer install --prefer-dist --no-progress
29+
run: composer install --prefer-dist --no-progress --no-interaction
2830

2931
- name: Run test suite
3032
run: composer run-script test

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"ext-mbstring": "*"
2323
},
2424
"require-dev": {
25-
"phpunit/phpunit": "^9.5"
25+
"phpunit/phpunit": "^9.5",
26+
"phpstan/phpstan": "^1.10"
2627
},
2728
"suggest": {
2829
"ext-bcmath": "Barcode IMB (Intelligent Mail Barcode) needs bcmath extension",

0 commit comments

Comments
 (0)