Skip to content

Commit 5ea9695

Browse files
committed
Add test workflow
1 parent b2725ab commit 5ea9695

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

.github/workflows/php.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: PHP Composer
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
branches: [ "master" ]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
build:
14+
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Validate composer.json and composer.lock
21+
run: docker compose run composer validate --strict
22+
23+
- name: Cache Composer packages
24+
id: composer-cache
25+
uses: actions/cache@v3
26+
with:
27+
path: vendor
28+
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.json') }}-${{ github.ref_name }}
29+
restore-keys: |
30+
${{ runner.os }}-php-${{ hashFiles('**/composer.json') }}
31+
${{ runner.os }}-php-
32+
33+
- name: Install packages
34+
run: docker compose run composer install
35+
36+
- name: Run test suite
37+
run: docker compose run phpspec
38+
39+
- name: Run static analyzer
40+
run: docker compose run phpstan
41+
42+
- name: Run code style checker
43+
run: docker compose run php-cs-fixer --dry-run

composer.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
},
3737
"scripts": {
3838
"test": "vendor/bin/phpspec run",
39+
"static-analyzer": "vendor/bin/phpstan",
40+
"check-style": "vendor/bin/php-cs-fixer fix --dry-run",
3941
"fix-style": "vendor/bin/php-cs-fixer fix"
4042
},
4143
"repositories": [

0 commit comments

Comments
 (0)