25
25
LANGUAGE : en_US.UTF-8
26
26
LC_ALL : en_US.UTF-8
27
27
28
- # Windows specific
29
- TOOLS_DIR : ' C:\tools'
30
-
31
28
# PHP extensions required by Composer
32
29
EXTENSIONS : intl, json, mbstring, msgpack
33
30
@@ -38,22 +35,22 @@ jobs:
38
35
name : " Validate Tests code style"
39
36
if : " !contains(github.event.head_commit.message, 'ci skip')"
40
37
41
- # needs: [ generate ]
42
-
43
38
permissions :
44
39
contents : read
45
40
46
- runs-on : ubuntu-20.04
41
+ runs-on : ubuntu-latest
47
42
48
43
strategy :
49
44
fail-fast : true
50
45
matrix :
51
46
php :
52
- - ' 8.0'
53
47
- ' 8.1'
54
48
- ' 8.2'
49
+ - ' 8.3'
50
+ - ' 8.4'
51
+
55
52
steps :
56
- - uses : actions/checkout@v3
53
+ - uses : actions/checkout@v4
57
54
58
55
- name : " Setup PHP"
59
56
uses : shivammathur/setup-php@v2
@@ -66,13 +63,17 @@ jobs:
66
63
COMPOSER_TOKEN : ${{ secrets.GITHUB_TOKEN }}
67
64
68
65
- name : " Install development dependencies with Composer"
69
- uses : " ramsey/composer-install@v2 "
66
+ uses : " ramsey/composer-install@v3 "
70
67
with :
71
68
composer-options : " --prefer-dist"
72
69
73
- - name : " PHPCS"
70
+ - name : " Code Sniffer"
71
+ run : |
72
+ composer cs
73
+
74
+ - name : " Code Analysis"
74
75
run : |
75
- vendor/bin/phpcs --standard=./phpcs.xml
76
+ composer cs
76
77
77
78
78
79
unit-tests :
@@ -81,49 +82,30 @@ jobs:
81
82
permissions :
82
83
contents : read # to fetch code (actions/checkout)
83
84
84
- name : Unit tests / PHP-${{ matrix.php }}-${{ matrix.ts }}-${{ matrix.name }}
85
- runs-on : ${{ matrix.os }}
85
+ name : Unit tests / PHP-${{ matrix.php }}
86
+ runs-on : ubuntu-latest
86
87
87
88
strategy :
88
89
matrix :
89
90
php :
90
- - ' 8.0'
91
91
- ' 8.1'
92
92
- ' 8.2'
93
- ts :
94
- - ' nts'
95
- - ' ts'
96
- name :
97
- - ubuntu-gcc
98
- - macos-clang
99
- # matrix names should be in next format:
100
- # {php}-{ts}-{os.name}-{compiler}-{arch}
101
- include :
102
- # Linux
103
- - { name: ubuntu-gcc, os: ubuntu-20.04, compiler: gcc }
104
- # macOS
105
- - { name: macos-clang, os: macos-11, compiler: clang }
106
- # Windows
107
- - { php: '8.0', ts: 'ts', arch: 'x64', name: 'windows2019-vs16', os: 'windows-2019', compiler: 'vs16' }
108
- - { php: '8.0', ts: 'nts', arch: 'x64', name: 'windows2019-vs16', os: 'windows-2019', compiler: 'vs16' }
109
- - { php: '8.1', ts: 'ts', arch: 'x64', name: 'windows2019-vs16', os: 'windows-2019', compiler: 'vs16' }
110
- - { php: '8.1', ts: 'nts', arch: 'x64', name: 'windows2019-vs16', os: 'windows-2019', compiler: 'vs16' }
93
+ - ' 8.3'
94
+ - ' 8.4'
111
95
112
96
steps :
113
- - uses : actions/checkout@v3
97
+ - uses : actions/checkout@v4
114
98
- name : " Setup platform specific environment"
115
99
shell : pwsh
116
100
run : |
117
101
git config --global core.autocrlf false
118
- $SessionSavePath = if ("${{ runner.os }}" -eq "Windows") { 'C:\temp' } else { '/tmp' }
119
- Write-Output "SESSION_SAVE_PATH=$SessionSavePath" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
120
102
121
103
- name : " Setup PHP"
122
104
uses : shivammathur/setup-php@v2
123
105
with :
124
106
php-version : ${{ matrix.php }}
125
107
extensions : ${{ env.EXTENSIONS }}
126
- ini-values : apc.enable_cli=on, session.save_path=${{ env.SESSION_SAVE_PATH }}
108
+ ini-values : apc.enable_cli=on
127
109
tools : pecl, composer:v2
128
110
coverage : pcov
129
111
env :
@@ -134,65 +116,71 @@ jobs:
134
116
run : composer validate --no-check-all --no-check-publish
135
117
136
118
- name : " Install development dependencies with Composer"
137
- uses : " ramsey/composer-install@v2 "
119
+ uses : " ramsey/composer-install@v3 "
138
120
with :
139
121
composer-options : " --prefer-dist"
140
122
141
123
- name : " Setup Tests"
142
124
shell : bash
143
125
run : |
144
- cp config/.env.example .env
145
- vendor/bin/codecept build
126
+ cp -v config/.env.example .env
146
127
147
128
- name : " Run Unit Tests"
148
129
if : always()
149
130
run : |
150
- vendor/bin/codecept run - -coverage-xml=coverage.xml --ext DotReporter unit
131
+ composer test-unit -coverage
151
132
152
133
- name : " Upload coverage file artifact"
153
- uses : " actions/upload-artifact@v3 "
134
+ uses : " actions/upload-artifact@v4 "
154
135
with :
155
- name : " unit-${{ matrix.php }}-${{ matrix.ts }}-${{ matrix.name }} .coverage"
136
+ name : " unit-${{ matrix.php }}.coverage"
156
137
path : " tests/_output/coverage.xml"
157
138
158
139
upload-coverage :
159
140
permissions :
160
141
contents : read
161
142
162
- name : " Upload coverage to Codecov/Codacy "
163
- runs-on : " ubuntu-22.04 "
143
+ name : " Upload coverage to Sonarcloud "
144
+ runs-on : ubuntu-latest
164
145
needs :
165
146
- " unit-tests"
166
147
167
148
steps :
168
149
- name : " Checkout"
169
- uses : " actions/checkout@v3 "
150
+ uses : " actions/checkout@v4 "
170
151
with :
171
- fetch-depth : 2
152
+ fetch-depth : 0
172
153
173
154
- name : " Display structure of downloaded files"
174
155
run : |
175
- mkdir -p reports
156
+ mkdir -p cv
176
157
177
158
- name : " Download coverage files"
178
- uses : " actions/download-artifact@v3 "
159
+ uses : " actions/download-artifact@v4 "
179
160
with :
180
- path : " reports "
161
+ path : " cv "
181
162
182
163
- name : " Display structure of downloaded files"
183
- run : ls -R
184
- working-directory : reports
185
-
186
- - name : " Upload to Codecov"
187
- uses : " codecov/codecov-action@v3"
188
- with :
189
- token : ${{ secrets.CODECOV_TOKEN }}
190
- directory : reports
191
- fail_ci_if_error : true
192
- verbose : true
193
-
194
- - name : " Upload to Codacy"
195
- uses : codacy/codacy-coverage-reporter-action@v1
164
+ run : |
165
+ mv cv/unit-8.1.coverage/coverage.xml cv/01.xml
166
+ mv cv/unit-8.2.coverage/coverage.xml cv/02.xml
167
+ mv cv/unit-8.3.coverage/coverage.xml cv/03.xml
168
+ mv cv/unit-8.4.coverage/coverage.xml cv/04.xml
169
+ ls -la cv/
170
+
171
+ - name : SonarCloud Scan
172
+ uses :
SonarSource/[email protected]
173
+ env :
174
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
175
+ SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
196
176
with :
197
- project-token : ${{ secrets.CODACY_PROJECT_TOKEN }}
198
- coverage-reports : reports/unit-8.0-ts-ubuntu-gcc.coverage/coverage.xml, reports/unit-8.1-ts-ubuntu-gcc.coverage/coverage.xml, reports/unit-8.2-ts-ubuntu-gcc.coverage/coverage.xml
177
+ projectBaseDir : ./
178
+ args : >
179
+ -Dsonar.organization=${{ secrets.SONAR_ORGANIZATION }}
180
+ -Dsonar.projectKey=${{ secrets.SONAR_PROJECT_KEY }}
181
+ -Dsonar.sources=src/
182
+ -Dsonar.exclusions=vendor/**,cv/**,tests/**
183
+ -Dsonar.sourceEncoding=UTF-8
184
+ -Dsonar.language=php
185
+ -Dsonar.tests=tests/
186
+ -Dsonar.php.coverage.reportPaths=cv/01.xml,cv/02.xml,cv/03.xml,cv/04.xml
0 commit comments