Skip to content

Commit 42345e7

Browse files
committed
Add tasks for automation with Castor and made relevant updates
Introduced Castor tasks to automate and streamline the build process. Tasks include mutation testing, unit tests, static analysis, and coding standard checks. Various integration scripts were updated to use these tasks. Updated `.gitignore` and `.gitattributes` to handle Castor related files correctly. Documentation added or updated throughout the codebase for better code understanding.
1 parent 783a119 commit 42345e7

23 files changed

+315
-47
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
/.gitsplit.yml export-ignore
1111
/monorepo-builder.php export-ignore
1212
/CODE_OF_CONDUCT.md export-ignore
13+
/castor.php export-ignore
1314
/deptrac.yaml export-ignore
1415
/ecs.php export-ignore
1516
/infection.json export-ignore

.github/workflows/infection.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: "Integrate"
1+
name: "Infection"
22

33
on:
44
push:
@@ -7,26 +7,24 @@ on:
77

88
jobs:
99
mutation_testing:
10-
name: "5️⃣ Mutation Testing"
10+
name: "0️⃣ Mutation Testing"
1111
runs-on: "ubuntu-latest"
1212
steps:
1313
- name: "Set up PHP"
1414
uses: "shivammathur/setup-php@v2"
1515
with:
1616
php-version: "8.3"
1717
extensions: "json, mbstring, openssl, sqlite3, curl, uuid"
18+
tools: castor
1819

1920
- name: "Checkout code"
2021
uses: "actions/checkout@v4"
2122

22-
- name: "Fetch Git base reference"
23-
run: "git fetch --depth=1 origin ${GITHUB_BASE_REF}"
24-
2523
- name: "Install dependencies"
2624
uses: "ramsey/composer-install@v3"
2725
with:
2826
dependency-versions: "highest"
2927
composer-options: "--optimize-autoloader"
3028

3129
- name: "Execute Infection"
32-
run: "make ci-mu"
30+
run: "castor infect"

.github/workflows/integrate.yml

Lines changed: 52 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,33 @@ jobs:
3030
uses: "shivammathur/setup-php@v2"
3131
with:
3232
php-version: "8.3"
33+
extensions: "json, mbstring, openssl, sqlite3, curl, uuid"
34+
tools: castor
3335

3436
- name: "Checkout code"
3537
uses: "actions/checkout@v4"
3638

39+
- name: "Fetch Git base reference"
40+
run: "git fetch --depth=1 origin ${GITHUB_BASE_REF}"
41+
42+
- name: "Validate Composer configuration"
43+
run: "castor validate"
44+
3745
- name: "Install dependencies"
3846
uses: "ramsey/composer-install@v3"
3947
with:
40-
dependency-versions: "highest"
48+
dependency-versions: "${{ matrix.dependencies }}"
49+
composer-options: "--optimize-autoloader"
50+
51+
- name: "Cache dependencies"
52+
uses: "actions/cache@v4"
53+
id: "cache"
54+
with:
55+
path: "composer-cache"
56+
key: "${{ runner.os }}-${{ hashFiles('**/composer.json') }}"
4157

4258
- name: "Check source code for syntax errors"
43-
run: "composer exec -- parallel-lint src/ tests/"
59+
run: "castor lint"
4460

4561
unit_tests:
4662
name: "2️⃣ Unit and functional tests"
@@ -63,6 +79,7 @@ jobs:
6379
with:
6480
php-version: "${{ matrix.php-version }}"
6581
extensions: "json, mbstring, openssl, sqlite3, curl, uuid"
82+
tools: castor
6683
coverage: "xdebug"
6784

6885
- name: "Checkout code"
@@ -75,7 +92,7 @@ jobs:
7592
composer-options: "--optimize-autoloader"
7693

7794
- name: "Execute unit tests"
78-
run: "make ci-cc"
95+
run: "castor test --coverage-text"
7996

8097
static_analysis:
8198
name: "3️⃣ Static Analysis"
@@ -89,21 +106,19 @@ jobs:
89106
with:
90107
php-version: "8.3"
91108
extensions: "json, mbstring, openssl, sqlite3, curl, uuid"
109+
tools: castor
92110

93111
- name: "Checkout code"
94112
uses: "actions/checkout@v4"
95113

96-
- name: "Validate Composer configuration"
97-
run: "composer validate --strict"
98-
99114
- name: "Install dependencies"
100115
uses: "ramsey/composer-install@v3"
101116
with:
102117
dependency-versions: "highest"
103118
composer-options: "--optimize-autoloader"
104119

105120
- name: "Execute static analysis"
106-
run: "make st"
121+
run: "castor stan"
107122

108123
coding_standards:
109124
name: "4️⃣ Coding Standards"
@@ -117,21 +132,48 @@ jobs:
117132
with:
118133
php-version: "8.3"
119134
extensions: "json, mbstring, openssl, sqlite3, curl, uuid"
135+
tools: castor
120136

121137
- name: "Checkout code"
122138
uses: "actions/checkout@v4"
123139

140+
- name: "Install dependencies"
141+
uses: "ramsey/composer-install@v3"
142+
with:
143+
dependency-versions: "highest"
144+
composer-options: "--optimize-autoloader"
145+
124146
- name: "Check adherence to EditorConfig"
125147
uses: "greut/eclint-action@v0"
126148

149+
- name: "Check coding style"
150+
run: "castor cs"
151+
152+
check_licenses:
153+
name: "5️⃣ Check licenses"
154+
needs:
155+
- "byte_level"
156+
- "syntax_errors"
157+
runs-on: "ubuntu-latest"
158+
steps:
159+
- name: "Set up PHP"
160+
uses: "shivammathur/setup-php@v2"
161+
with:
162+
php-version: "8.3"
163+
extensions: "json, mbstring, openssl, sqlite3, curl, uuid"
164+
tools: castor
165+
166+
- name: "Checkout code"
167+
uses: "actions/checkout@v4"
168+
127169
- name: "Install dependencies"
128170
uses: "ramsey/composer-install@v3"
129171
with:
130172
dependency-versions: "highest"
131173
composer-options: "--optimize-autoloader"
132174

133175
- name: "Check coding style"
134-
run: "make ci-cs"
176+
run: "castor check-licenses"
135177

136178
rector_checkstyle:
137179
name: "6️⃣ Rector Checkstyle"
@@ -145,22 +187,20 @@ jobs:
145187
with:
146188
php-version: "8.3"
147189
extensions: "json, mbstring, openssl, sqlite3, curl, uuid"
190+
tools: castor
148191
coverage: "xdebug"
149192

150193
- name: "Checkout code"
151194
uses: "actions/checkout@v4"
152195

153-
- name: "Fetch Git base reference"
154-
run: "git fetch --depth=1 origin ${GITHUB_BASE_REF}"
155-
156196
- name: "Install dependencies"
157197
uses: "ramsey/composer-install@v3"
158198
with:
159199
dependency-versions: "highest"
160200
composer-options: "--optimize-autoloader"
161201

162202
- name: "Execute Rector"
163-
run: "make rector"
203+
run: "castor rector"
164204

165205
exported_files:
166206
name: "7️⃣ Exported files"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ composer.lock
88
vendor/
99
src/Bundle/JoseFramework/var/
1010
infection.txt
11+
.castor.stub.php

0 commit comments

Comments
 (0)