Skip to content

Commit f4593c0

Browse files
committed
Added code samples testing with Deptrac
1 parent c636be4 commit f4593c0

File tree

5 files changed

+60
-2
lines changed

5 files changed

+60
-2
lines changed

.github/workflows/build.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ jobs:
105105
- name: Run PHPStan analysis
106106
run: composer phpstan
107107

108+
- name: Deptrac
109+
run: composer deptrac
110+
108111
code-samples-inclusion-check:
109112
name: Check code samples inclusion
110113
runs-on: ubuntu-latest

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ __pycache__/*
66
.php-cs-fixer.cache
77
composer.lock
88
tools/php-cs-fixer/vendor
9+
.deptrac.cache

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,31 @@ of the command.
5454

5555
## Testing the code samples
5656

57+
### PHPStan
5758
This repository uses PHPStan to test the code samples. To run the tests locally execute the commands below:
5859
```bash
5960
composer update
6061
composer phpstan
6162
```
6263

64+
Regenerate the baseline by running:
65+
```bash
66+
composer phpstan -- --generate-baseline
67+
```
68+
69+
### Deptrac
70+
71+
This repository uses Deptrac to test the code samples. To run the tests locally execute the commands below:
72+
```bash
73+
composer update
74+
composer deptrac
75+
```
76+
77+
Regenerate the baseline by running:
78+
```bash
79+
vendor/bin/deptrac --formatter=baseline
80+
```
81+
6382
## Where to View
6483

6584
https://doc.ibexa.co

composer.json

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,20 @@
6161
"ibexa/solr": "5.0.x-dev",
6262
"ibexa/version-comparison": "5.0.x-dev",
6363
"league/oauth2-google": "^4.0",
64-
"ibexa/core-search": "~5.0.x-dev"
64+
"ibexa/core-search": "~5.0.x-dev",
65+
"qossmic/deptrac": "^2.0"
6566
},
6667
"scripts": {
6768
"fix-cs": "php-cs-fixer fix --config=.php-cs-fixer.php -v --show-progress=dots",
6869
"check-cs": "@fix-cs --dry-run",
69-
"phpstan": "phpstan analyse"
70+
"phpstan": "phpstan analyse",
71+
"deptrac": "deptrac analyse"
72+
},
73+
"scripts-descriptions": {
74+
"fix-cs": "Automatically fixes code style in all files",
75+
"check-cs": "Run code style checker for all files",
76+
"phpstan": "Run static code analysis",
77+
"deptrac": "Run Deptrac architecture testing"
7078
},
7179
"config": {
7280
"allow-plugins": false

deptrac.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
imports:
2+
- deptrac.baseline.yaml
3+
4+
deptrac:
5+
paths:
6+
- ./code_samples
7+
layers:
8+
- name: CodeSamples
9+
collectors:
10+
- type: directory
11+
value: code_samples
12+
- name: IbexaContracts
13+
collectors:
14+
- type: classLike
15+
value: .*Ibexa\\Contracts\\.*
16+
- name: IbexaNotContracts
17+
collectors:
18+
- type: bool
19+
must:
20+
- type: classLike
21+
value: .*Ibexa\\.*
22+
must_not:
23+
- type: classLike
24+
value: .*Ibexa\\Contracts.*
25+
ruleset:
26+
CodeSamples:
27+
- IbexaContracts

0 commit comments

Comments
 (0)