27
27
- phpunit.xml.dist
28
28
- .github/workflows/test-phpunit.yml
29
29
30
+ concurrency :
31
+ group : ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
32
+ cancel-in-progress : true
33
+
34
+ env :
35
+ COVERAGE_PHP_VERSION : ' 8.1'
36
+ NLS_LANG : ' AMERICAN_AMERICA.UTF8'
37
+ NLS_DATE_FORMAT : ' YYYY-MM-DD HH24:MI:SS'
38
+ NLS_TIMESTAMP_FORMAT : ' YYYY-MM-DD HH24:MI:SS'
39
+ NLS_TIMESTAMP_TZ_FORMAT : ' YYYY-MM-DD HH24:MI:SS'
40
+
30
41
jobs :
31
42
tests :
32
43
name : PHP ${{ matrix.php-versions }} - ${{ matrix.db-platforms }}
33
- runs-on : ubuntu-20 .04
44
+ runs-on : ubuntu-22 .04
34
45
if : " !contains(github.event.head_commit.message, '[ci skip]')"
35
46
36
47
strategy :
65
76
options : --health-cmd=pg_isready --health-interval=10s --health-timeout=5s --health-retries=3
66
77
67
78
mssql :
68
- image : mcr.microsoft.com/mssql/server:2019-CU10-ubuntu-20.04
79
+ image : mcr.microsoft.com/mssql/server:2022-latest
69
80
env :
70
81
SA_PASSWORD : 1Secure*Password1
71
82
ACCEPT_EULA : Y
@@ -75,12 +86,18 @@ jobs:
75
86
options : --health-cmd="/opt/mssql-tools/bin/sqlcmd -S 127.0.0.1 -U sa -P 1Secure*Password1 -Q 'SELECT @@VERSION'" --health-interval=10s --health-timeout=5s --health-retries=3
76
87
77
88
oracle :
78
- image : quillbuilduser /oracle-18-xe
89
+ image : gvenzl /oracle-xe:21
79
90
env :
80
- ORACLE_ALLOW_REMOTE : true
91
+ ORACLE_RANDOM_PASSWORD : true
92
+ APP_USER : ORACLE
93
+ APP_USER_PASSWORD : ORACLE
81
94
ports :
82
95
- 1521:1521
83
- options : --health-cmd="/opt/oracle/product/18c/dbhomeXE/bin/sqlplus -s sys/Oracle18@oracledbxe/XE as sysdba <<< 'SELECT 1 FROM DUAL'" --health-interval=10s --health-timeout=5s --health-retries=3
96
+ options : >-
97
+ --health-cmd healthcheck.sh
98
+ --health-interval 20s
99
+ --health-timeout 10s
100
+ --health-retries 10
84
101
85
102
redis :
86
103
image : redis
@@ -98,28 +115,6 @@ jobs:
98
115
if : matrix.db-platforms == 'SQLSRV'
99
116
run : sqlcmd -S 127.0.0.1 -U sa -P 1Secure*Password1 -Q "CREATE DATABASE test"
100
117
101
- - name : Install Oracle InstantClient
102
- if : matrix.db-platforms == 'OCI8'
103
- run : |
104
- sudo apt-get install wget libaio1 alien
105
- sudo wget https://download.oracle.com/otn_software/linux/instantclient/185000/oracle-instantclient18.5-basic-18.5.0.0.0-3.x86_64.rpm
106
- sudo wget https://download.oracle.com/otn_software/linux/instantclient/185000/oracle-instantclient18.5-devel-18.5.0.0.0-3.x86_64.rpm
107
- sudo wget https://download.oracle.com/otn_software/linux/instantclient/185000/oracle-instantclient18.5-sqlplus-18.5.0.0.0-3.x86_64.rpm
108
- sudo alien oracle-instantclient18.5-basic-18.5.0.0.0-3.x86_64.rpm
109
- sudo alien oracle-instantclient18.5-devel-18.5.0.0.0-3.x86_64.rpm
110
- sudo alien oracle-instantclient18.5-sqlplus-18.5.0.0.0-3.x86_64.rpm
111
- sudo dpkg -i oracle-instantclient18.5-basic_18.5.0.0.0-4_amd64.deb oracle-instantclient18.5-devel_18.5.0.0.0-4_amd64.deb oracle-instantclient18.5-sqlplus_18.5.0.0.0-4_amd64.deb
112
- echo "LD_LIBRARY_PATH=/lib/oracle/18.5/client64/lib/" >> $GITHUB_ENV
113
- echo "NLS_LANG=AMERICAN_AMERICA.UTF8" >> $GITHUB_ENV
114
- echo "C_INCLUDE_PATH=/usr/include/oracle/18.5/client64" >> $GITHUB_ENV
115
- echo 'NLS_DATE_FORMAT=YYYY-MM-DD HH24:MI:SS' >> $GITHUB_ENV
116
- echo 'NLS_TIMESTAMP_FORMAT=YYYY-MM-DD HH24:MI:SS' >> $GITHUB_ENV
117
- echo 'NLS_TIMESTAMP_TZ_FORMAT=YYYY-MM-DD HH24:MI:SS' >> $GITHUB_ENV
118
-
119
- - name : Create database for Oracle Database
120
- if : matrix.db-platforms == 'OCI8'
121
- run : echo -e "ALTER SESSION SET CONTAINER = XEPDB1;\nCREATE BIGFILE TABLESPACE \"TEST\" DATAFILE '/opt/oracle/product/18c/dbhomeXE/dbs/TEST' SIZE 10M AUTOEXTEND ON MAXSIZE UNLIMITED SEGMENT SPACE MANAGEMENT AUTO EXTENT MANAGEMENT LOCAL AUTOALLOCATE;\nCREATE USER \"ORACLE\" IDENTIFIED BY \"ORACLE\" DEFAULT TABLESPACE \"TEST\" TEMPORARY TABLESPACE TEMP QUOTA UNLIMITED ON \"TEST\";\nGRANT CONNECT,RESOURCE TO \"ORACLE\";\nexit;" | /lib/oracle/18.5/client64/bin/sqlplus -s sys/Oracle18@localhost:1521/XE as sysdba
122
-
123
118
- name : Checkout
124
119
uses : actions/checkout@v3
125
120
@@ -129,70 +124,110 @@ jobs:
129
124
php-version : ${{ matrix.php-versions }}
130
125
tools : composer, pecl
131
126
extensions : imagick, sqlsrv, gd, sqlite3, redis, memcached, oci8, pgsql
132
- coverage : xdebug
127
+ coverage : ${{ env.COVERAGE_DRIVER }}
133
128
env :
134
129
update : true
130
+ COVERAGE_DRIVER : ${{ matrix.php-versions == env.COVERAGE_PHP_VERSION && 'xdebug' || 'none'}}
135
131
136
132
- name : Install latest ImageMagick
137
133
run : |
138
134
sudo apt-get update
139
- sudo apt-get install --reinstall libgs9-common fonts-noto-mono libgs9:amd64 libijs-0.35:amd64 fonts-urw-base35 ghostscript poppler-data libjbig2dec0:amd64 gsfonts libopenjp2-7:amd64 fonts-droid-fallback ttf -dejavu-core
135
+ sudo apt-get install --reinstall libgs9-common fonts-noto-mono libgs9:amd64 libijs-0.35:amd64 fonts-urw-base35 ghostscript poppler-data libjbig2dec0:amd64 gsfonts libopenjp2-7:amd64 fonts-droid-fallback fonts -dejavu-core
140
136
sudo apt-get install -y imagemagick
141
137
sudo apt-get install --fix-broken
142
138
143
139
- name : Get composer cache directory
144
- id : composercache
145
- run : echo "::set-output name=dir::$(composer config cache-files-dir)"
140
+ run : echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV
146
141
147
142
- name : Cache dependencies
148
143
uses : actions/cache@v3
149
144
with :
150
- path : ${{ steps.composercache.outputs.dir }}
145
+ path : ${{ env.COMPOSER_CACHE_FILES_DIR }}
151
146
key : ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
152
147
restore-keys : ${{ runner.os }}-composer-
153
148
154
149
- name : Install dependencies
155
150
run : |
156
151
composer update --ansi --no-interaction
157
152
composer remove --ansi --dev --unused -W -- rector/rector phpstan/phpstan friendsofphp/php-cs-fixer nexusphp/cs-config codeigniter/coding-standard
158
- env :
159
- COMPOSER_AUTH : ${{ secrets.COMPOSER_AUTH }}
160
153
161
- - name : Profile slow tests in PHP 8.0
162
- if : matrix.php-versions == '8.0'
154
+ - name : Profile slow tests in PHP ${{ env.COVERAGE_PHP_VERSION }}
155
+ if : matrix.php-versions == env.COVERAGE_PHP_VERSION
163
156
run : echo "TACHYCARDIA_MONITOR_GA=enabled" >> $GITHUB_ENV
164
157
165
158
- name : Compute coverage option
166
159
uses : actions/github-script@v6
167
160
id : phpunit-coverage-option
168
161
with :
169
- script : ' return "${{ matrix.php-versions }}" == "8.0" ? "" : "--no-coverage"'
162
+ script : |
163
+ const { COVERAGE_NAME } = process.env
164
+
165
+ return "${{ matrix.php-versions }}" == "${{ env.COVERAGE_PHP_VERSION }}" ? `--coverage-php build/cov/coverage-${COVERAGE_NAME}.cov` : "--no-coverage"
170
166
result-encoding : string
167
+ env :
168
+ COVERAGE_NAME : php-v${{ env.COVERAGE_PHP_VERSION }}-${{ matrix.db-platforms }}
171
169
172
170
- name : Test with PHPUnit
173
171
run : script -e -c "vendor/bin/phpunit --color=always --exclude-group=auto-review ${{ steps.phpunit-coverage-option.outputs.result }}"
174
172
env :
175
173
DB : ${{ matrix.db-platforms }}
176
174
TERM : xterm-256color
177
175
178
- - name : Run Coveralls
179
- if : github.repository_owner == 'codeigniter4' && matrix.php-versions == '8.0'
180
- run : |
181
- composer global require --ansi php-coveralls/php-coveralls:^2.4
182
- php-coveralls --coverage_clover=build/logs/clover.xml -v
176
+ - name : Upload coverage file
177
+ if : matrix.php-versions == env.COVERAGE_PHP_VERSION
178
+ uses : actions/upload-artifact@v3
179
+ with :
180
+ name : ${{ env.COVERAGE_NAME }}
181
+ path : build/cov/coverage-${{ env.COVERAGE_NAME }}.cov
182
+ if-no-files-found : error
183
+ retention-days : 1
183
184
env :
184
- COVERALLS_REPO_TOKEN : ${{ secrets.GITHUB_TOKEN }}
185
- COVERALLS_PARALLEL : true
186
- COVERALLS_FLAG_NAME : PHP ${{ matrix.php-versions }} - ${{ matrix.db-platforms }}
185
+ COVERAGE_NAME : php-v${{ env.COVERAGE_PHP_VERSION }}-${{ matrix.db-platforms }}
187
186
188
- coveralls-finish :
187
+ coveralls :
189
188
if : github.repository_owner == 'codeigniter4'
190
- needs : [ tests]
191
- runs-on : ubuntu-20 .04
189
+ needs : tests
190
+ runs-on : ubuntu-22 .04
192
191
193
192
steps :
194
- - name : Coveralls Finished
195
- uses : coverallsapp/github-action@master
193
+ - name : Checkout
194
+ uses : actions/checkout@v3
195
+
196
+ - name : Setup PHP, with composer and extensions
197
+ uses : shivammathur/setup-php@v2
198
+ with :
199
+ php-version : ${{ env.COVERAGE_PHP_VERSION }}
200
+ tools : composer
201
+ coverage : xdebug
202
+ env :
203
+ update : true
204
+
205
+ - name : Download coverage files
206
+ uses : actions/download-artifact@v3
207
+ with :
208
+ path : build/cov
209
+
210
+ - name : Display structure of downloaded files
211
+ run : ls -R
212
+ working-directory : build/cov
213
+
214
+ - name : Get composer cache directory
215
+ run : echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV
216
+
217
+ - name : Cache dependencies
218
+ uses : actions/cache@v3
196
219
with :
197
- github-token : ${{ secrets.GITHUB_TOKEN }}
198
- parallel-finished : true
220
+ path : ${{ env.COMPOSER_CACHE_FILES_DIR }}
221
+ key : ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
222
+ restore-keys : ${{ runner.os }}-composer-
223
+
224
+ - name : Install dependencies
225
+ run : composer update --ansi --no-interaction
226
+
227
+ - name : Merge coverage files
228
+ run : vendor/bin/phpcov merge --clover build/logs/clover.xml build/cov
229
+
230
+ - name : Upload coverage to Coveralls
231
+ run : vendor/bin/php-coveralls --verbose --exclude-no-stmt --ansi
232
+ env :
233
+ COVERALLS_REPO_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments