@@ -2,24 +2,84 @@ name: Test
22
33on :
44 push :
5- branches : [ ' main' ]
5+ branches : [main]
66 pull_request :
7- types : [ 'opened', 'synchronize', 'reopened' ]
7+ branches : [main]
8+ types : [opened, synchronize, reopened]
9+
10+ concurrency :
11+ group : ${{ github.workflow }}-${{ github.ref }}
12+ cancel-in-progress : true
813
914jobs :
15+ lint :
16+ name : Lint
17+ runs-on : ubuntu-latest
18+
19+ steps :
20+ - name : Checkout
21+ uses : actions/checkout@v4
22+
23+ - name : Set up PHP
24+ uses : shivammathur/setup-php@v2
25+ with :
26+ php-version : " 8.3"
27+ tools : composer:v2
28+
29+ - name : Cache dependencies
30+ uses : actions/cache@v4
31+ with :
32+ path : ~/.composer/cache
33+ key : php-8.3-composer-${{ hashFiles('**/composer.json') }}
34+ restore-keys : php-8.3-composer-
35+
36+ - name : Install dependencies
37+ run : composer install --prefer-dist --no-progress
38+
39+ - name : Check code style
40+ run : composer pint-test
41+
42+ analyse :
43+ name : Static Analysis
44+ runs-on : ubuntu-latest
45+
46+ steps :
47+ - name : Checkout
48+ uses : actions/checkout@v4
49+
50+ - name : Set up PHP
51+ uses : shivammathur/setup-php@v2
52+ with :
53+ php-version : " 8.3"
54+ tools : composer:v2
55+
56+ - name : Cache dependencies
57+ uses : actions/cache@v4
58+ with :
59+ path : ~/.composer/cache
60+ key : php-8.3-composer-${{ hashFiles('**/composer.json') }}
61+ restore-keys : php-8.3-composer-
62+
63+ - name : Install dependencies
64+ run : composer install --prefer-dist --no-progress
65+
66+ - name : Run PHPStan
67+ run : composer analyse
68+ continue-on-error : true
69+
1070 test :
11- name : Test on PHP ${{ matrix.php-version }}
71+ name : Test ( PHP ${{ matrix.php-version }})
1272 runs-on : ubuntu-latest
73+ needs : [lint]
1374
1475 strategy :
76+ fail-fast : false
1577 matrix :
16- php-version : [ ' 8.2', ' 8.3', ' 8.4' ]
78+ php-version : [" 8.2", " 8.3", " 8.4" ]
1779
1880 steps :
19- - name : Checkout source code
20- uses : actions/checkout@v2
21- with :
22- fetch-depth : 0
81+ - name : Checkout
82+ uses : actions/checkout@v4
2383
2484 - name : Set up PHP ${{ matrix.php-version }}
2585 uses : shivammathur/setup-php@v2
@@ -29,24 +89,45 @@ jobs:
2989 tools : composer:v2
3090
3191 - name : Cache dependencies
32- uses : actions/cache@v4.3.0
92+ uses : actions/cache@v4
3393 with :
3494 path : ~/.composer/cache
3595 key : php-${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }}
3696 restore-keys : php-${{ matrix.php-version }}-composer-
3797
38- - name : Validate composer.json and composer.lock
39- run : composer validate
40-
41- - name : Install Dependencies
42- if : steps.composer-cache.outputs.cache-hit != 'true'
98+ - name : Install dependencies
4399 run : composer install --prefer-dist --no-progress
44100
45- - name : Check Code Style
46- run : composer pint- test
101+ - name : Run tests
102+ run : composer test
47103
48- - name : Execute Static Code analysis
49- run : composer analyse
104+ ci-success :
105+ name : CI Success
106+ runs-on : ubuntu-latest
107+ needs : [lint, analyse, test]
108+ if : always()
50109
51- - name : Execute Unit, Integration and Acceptance Tests
52- run : composer test
110+ steps :
111+ - name : Check all jobs
112+ run : |
113+ echo "===== Job Results ====="
114+ echo "Lint: ${{ needs.lint.result }}"
115+ echo "Analyse: ${{ needs.analyse.result }}"
116+ echo "Test: ${{ needs.test.result }}"
117+ echo "======================="
118+
119+ if [ "${{ needs.lint.result }}" != "success" ]; then
120+ echo "❌ Lint failed"
121+ exit 1
122+ fi
123+
124+ if [ "${{ needs.test.result }}" != "success" ]; then
125+ echo "❌ Tests failed"
126+ exit 1
127+ fi
128+
129+ if [ "${{ needs.analyse.result }}" == "failure" ]; then
130+ echo "⚠️ Static analysis failed (non-blocking)"
131+ fi
132+
133+ echo "✅ All required checks passed!"
0 commit comments