1
- name : Main Workflow
1
+ name : PHP CI
2
2
3
- on : ["pull_request"]
3
+ on :
4
+ push :
5
+ branches :
6
+ - main
7
+ - develop
8
+ pull_request :
9
+ branches :
10
+ - main
11
+ - develop
12
+ workflow_dispatch : {}
4
13
5
14
jobs :
6
- run :
7
- name : Run
15
+ php-test :
16
+ name : PHP Test
8
17
runs-on : ubuntu-latest
9
-
10
18
strategy :
11
19
matrix :
12
- php-version : [ 7.3, 8.2 ]
20
+ php-version : [ '7.3', '8.2', '8.4' ]
21
+ include :
22
+ - php-version : ' 8.2'
23
+ validate : true
13
24
14
25
steps :
26
+ - name : Checkout
27
+ uses : actions/checkout@v4
28
+ with :
29
+ fetch-depth : 0
30
+
15
31
- name : Setup PHP
16
32
uses : shivammathur/setup-php@v2
17
33
with :
18
34
php-version : ${{ matrix.php-version }}
19
35
tools : composer:v2
20
36
37
+ - name : Validate composer.json and composer.lock
38
+ if : matrix.validate
39
+ run : composer validate --strict
40
+
41
+ - name : Check PHP syntax
42
+ if : matrix.validate
43
+ run : find -L . -path ./vendor -prune -o -path ./tests -prune -o -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l
44
+
45
+ - name : Install dependencies
46
+ run : composer install --prefer-dist --no-progress
47
+
48
+ - name : Run unit tests
49
+ run : vendor/bin/phpunit --testsuite=unit --coverage-clover build/clover.xml --log-junit build/tests-log.xml
50
+
51
+ - name : Clean up reports
52
+ run : sed -i "s;`pwd`/;;g" build/*.xml
53
+
54
+ php-lint :
55
+ name : PHP Lint
56
+ needs : php-test
57
+ runs-on : ubuntu-latest
58
+ steps :
21
59
- name : Checkout
22
60
uses : actions/checkout@v4
23
61
with :
24
- # Disabling shallow clone to improve relevancy of SonarCloud reporting
25
62
fetch-depth : 0
26
63
27
- - name : Validate composer.json and composer.lock
28
- run : composer validate --strict
64
+ - name : Setup PHP
65
+ uses : shivammathur/setup-php@v2
66
+ with :
67
+ php-version : ' 8.2'
68
+ tools : composer:v2
69
+
70
+ - name : Install dependencies
71
+ run : composer install --prefer-dist --no-progress
72
+
73
+ - name : Run PHP Code Sniffer
74
+ run : vendor/bin/phpcs --exclude=Generic.Files.LineLength
75
+
76
+ integration-tests :
77
+ name : Integration Tests
78
+ needs : [php-test, php-lint]
79
+ runs-on : ubuntu-latest
80
+
81
+ # Only run integration tests on pull requests with release label and from the main repository
82
+ if : |
83
+ github.event_name == 'pull_request' &&
84
+ contains(github.event.pull_request.labels.*.name, 'release') &&
85
+ github.event.pull_request.head.repo.full_name == github.repository
86
+
87
+ steps :
88
+ - name : Checkout
89
+ uses : actions/checkout@v4
90
+ with :
91
+ fetch-depth : 0
92
+
93
+ - name : Setup PHP
94
+ uses : shivammathur/setup-php@v2
95
+ with :
96
+ php-version : ' 8.2'
97
+ tools : composer:v2
29
98
30
99
- name : Install dependencies
31
100
run : composer install --prefer-dist --no-progress
@@ -44,17 +113,3 @@ jobs:
44
113
INTEGRATION_STORE_PAYOUT_PASSWORD : ${{ secrets.INTEGRATION_STORE_PAYOUT_PASSWORD }}
45
114
INTEGRATION_REVIEW_PAYOUT_USERNAME : ${{ secrets.INTEGRATION_REVIEW_PAYOUT_USERNAME }}
46
115
INTEGRATION_REVIEW_PAYOUT_PASSWORD : ${{ secrets.INTEGRATION_REVIEW_PAYOUT_PASSWORD }}
47
-
48
- - name : Run unit tests
49
- run : vendor/bin/phpunit --testsuite=unit --coverage-clover build/clover.xml --log-junit build/tests-log.xml
50
-
51
- # PHPUnit generates absolute file paths and SonarCloud expects relative file paths. This command removes the
52
- # current working directory from the report files.
53
- - name : Clean up reports
54
- run : sed -i "s;`pwd`/;;g" build/*.xml
55
-
56
- - name : Run PHP Code Sniffer
57
- run : vendor/bin/phpcs --exclude=Generic.Files.LineLength
58
-
59
- - name : Make sure project files are compilable
60
- run : find -L . -path ./vendor -prune -o -path ./tests -prune -o -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l
0 commit comments