This repository was archived by the owner on Feb 10, 2026. It is now read-only.
File tree Expand file tree Collapse file tree 7 files changed +175
-2
lines changed
Expand file tree Collapse file tree 7 files changed +175
-2
lines changed Original file line number Diff line number Diff line change 1+ name : Test Action
2+
3+ on :
4+ pull_request :
5+ push :
6+ branches :
7+ - main
8+ - ' claude/**'
9+
10+ jobs :
11+ test-local-action :
12+ name : Test PHPArkitect Action
13+ runs-on : ubuntu-latest
14+
15+ strategy :
16+ fail-fast : false
17+ matrix :
18+ test_case :
19+ - name : " Basic check"
20+ args : " check"
21+ require_dev : " false"
22+ - name : " Check with dev dependencies"
23+ args : " check"
24+ require_dev : " true"
25+ - name : " Check with PHP 8.0"
26+ args : " check"
27+ require_dev : " false"
28+ php_version : " 8.0"
29+ - name : " Check with PHP 8.2"
30+ args : " check"
31+ require_dev : " false"
32+ php_version : " 8.2"
33+
34+ steps :
35+ - name : Checkout
36+ uses : actions/checkout@v4
37+
38+ - name : Copy test project files to root
39+ run : |
40+ cp test-project/composer.json .
41+ cp test-project/phparkitect.php .
42+ cp -r test-project/src .
43+
44+ - name : Test PHPArkitect Action - ${{ matrix.test_case.name }}
45+ uses : ./
46+ env :
47+ REQUIRE_DEV : ${{ matrix.test_case.require_dev }}
48+ PHP_VERSION : ${{ matrix.test_case.php_version }}
49+ with :
50+ args : ${{ matrix.test_case.args }}
51+
52+ test-docker-build :
53+ name : Test Docker Build
54+ runs-on : ubuntu-latest
55+
56+ steps :
57+ - name : Checkout
58+ uses : actions/checkout@v4
59+
60+ - name : Set up Docker Buildx
61+ uses : docker/setup-buildx-action@v3
62+
63+ - name : Build Docker image
64+ uses : docker/build-push-action@v5
65+ with :
66+ context : .
67+ push : false
68+ tags : phparkitect/arkitect-github-actions:test
69+ cache-from : type=gha
70+ cache-to : type=gha,mode=max
71+
72+ - name : Test Docker image
73+ run : |
74+ docker run --rm phparkitect/arkitect-github-actions:test --version
Original file line number Diff line number Diff line change @@ -6,10 +6,18 @@ branding:
66 icon : " check"
77 color : " blue"
88
9- description : " Use Arkitect via GithubAction ."
9+ description : " Use PHPArkitect via GitHub Actions to enforce architectural rules in your PHP projects ."
1010
1111name : " phparkitect-arkitect"
1212
13+ inputs :
14+ args :
15+ description : ' Arguments to pass to PHPArkitect (e.g., check, list)'
16+ required : false
17+ default : ' check'
18+
1319runs :
1420 using : " docker"
15- image : " docker://phparkitect/arkitect-github-actions:0.7.0"
21+ image : " Dockerfile"
22+ args :
23+ - ${{ inputs.args }}
Original file line number Diff line number Diff line change 1+ /vendor /
2+ composer.lock
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " phparkitect/test-project" ,
3+ "description" : " Test project for PHPArkitect GitHub Action" ,
4+ "type" : " project" ,
5+ "require" : {
6+ "php" : " >=7.4"
7+ },
8+ "autoload" : {
9+ "psr-4" : {
10+ "App\\ " : " src/"
11+ }
12+ }
13+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ use Arkitect \ClassSet ;
6+ use Arkitect \CLI \Config ;
7+ use Arkitect \Expression \ForClasses \HaveNameMatching ;
8+ use Arkitect \Expression \ForClasses \NotHaveDependencyOutsideNamespace ;
9+ use Arkitect \Expression \ForClasses \ResideInOneOfTheseNamespaces ;
10+ use Arkitect \Rules \Rule ;
11+
12+ return static function (Config $ config ): void {
13+ $ classSet = ClassSet::fromDir (__DIR__ . '/src ' );
14+
15+ $ rules = [];
16+
17+ // Domain layer should not depend on Infrastructure
18+ $ rules [] = Rule::allClasses ()
19+ ->that (new ResideInOneOfTheseNamespaces ('App\Domain ' ))
20+ ->should (new NotHaveDependencyOutsideNamespace ('App\Domain ' ))
21+ ->because ('Domain layer should be independent ' );
22+
23+ // Repository classes should be in Infrastructure namespace
24+ $ rules [] = Rule::allClasses ()
25+ ->that (new HaveNameMatching ('*Repository ' ))
26+ ->should (new ResideInOneOfTheseNamespaces ('App\Infrastructure ' ))
27+ ->because ('Repositories should be in Infrastructure layer ' );
28+
29+ $ config
30+ ->add ($ classSet , ...$ rules );
31+ };
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace App \Domain ;
4+
5+ class User
6+ {
7+ private string $ name ;
8+ private string $ email ;
9+
10+ public function __construct (string $ name , string $ email )
11+ {
12+ $ this ->name = $ name ;
13+ $ this ->email = $ email ;
14+ }
15+
16+ public function getName (): string
17+ {
18+ return $ this ->name ;
19+ }
20+
21+ public function getEmail (): string
22+ {
23+ return $ this ->email ;
24+ }
25+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace App \Infrastructure ;
4+
5+ use App \Domain \User ;
6+
7+ class UserRepository
8+ {
9+ private array $ users = [];
10+
11+ public function save (User $ user ): void
12+ {
13+ $ this ->users [] = $ user ;
14+ }
15+
16+ public function findAll (): array
17+ {
18+ return $ this ->users ;
19+ }
20+ }
You can’t perform that action at this time.
0 commit comments