Skip to content

Commit 9aa6104

Browse files
authored
Merge pull request #6793 from codeigniter4/develop
4.2.8 Ready code
2 parents f6dd565 + 0ff3835 commit 9aa6104

File tree

218 files changed

+1270
-2755
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

218 files changed

+1270
-2755
lines changed

.github/workflows/deploy-apidocs.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
build:
1616
name: Deploy to api
1717
if: github.repository == 'codeigniter4/CodeIgniter4'
18-
runs-on: ubuntu-20.04
18+
runs-on: ubuntu-22.04
1919

2020
steps:
2121
- name: Setup credentials

.github/workflows/test-autoreview.yml

+7-4
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,14 @@ on:
1414
- '**.php'
1515
- .github/workflows/test-autoreview.yml
1616

17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
19+
cancel-in-progress: true
20+
1721
jobs:
1822
auto-review-tests:
1923
name: Automatic Code Review
20-
runs-on: ubuntu-20.04
24+
runs-on: ubuntu-22.04
2125

2226
steps:
2327
- name: Checkout
@@ -30,13 +34,12 @@ jobs:
3034
coverage: none
3135

3236
- name: Get composer cache directory
33-
id: composercache
34-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
37+
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV
3538

3639
- name: Cache dependencies
3740
uses: actions/cache@v3
3841
with:
39-
path: ${{ steps.composercache.outputs.dir }}
42+
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
4043
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
4144
restore-keys: ${{ runner.os }}-composer-
4245

.github/workflows/test-coding-standards.yml

+7-4
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,14 @@ on:
1212
- 'spark'
1313
- '.github/workflows/test-coding-standards.yml'
1414

15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
17+
cancel-in-progress: true
18+
1519
jobs:
1620
lint:
1721
name: PHP ${{ matrix.php-version }} Lint with PHP CS Fixer
18-
runs-on: ubuntu-20.04
22+
runs-on: ubuntu-22.04
1923

2024
strategy:
2125
fail-fast: false
@@ -36,13 +40,12 @@ jobs:
3640
coverage: none
3741

3842
- name: Get composer cache directory
39-
id: composer-cache
40-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
43+
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV
4144

4245
- name: Cache dependencies
4346
uses: actions/cache@v3
4447
with:
45-
path: ${{ steps.composer-cache.outputs.dir }}
48+
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
4649
key: ${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('**/composer.lock') }}
4750
restore-keys: |
4851
${{ runner.os }}-${{ matrix.php-version }}-

.github/workflows/test-deptrac.yml

+8-8
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,14 @@ on:
2424
- 'depfile.yaml'
2525
- '.github/workflows/test-deptrac.yml'
2626

27+
concurrency:
28+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
29+
cancel-in-progress: true
30+
2731
jobs:
2832
build:
2933
name: Architectural Inspection
30-
runs-on: ubuntu-20.04
34+
runs-on: ubuntu-22.04
3135
steps:
3236
- name: Checkout
3337
uses: actions/checkout@v3
@@ -43,16 +47,12 @@ jobs:
4347
run: composer validate --strict
4448

4549
- name: Get composer cache directory
46-
id: composer-cache
47-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
48-
49-
- name: Create composer cache directory
50-
run: mkdir -p ${{ steps.composer-cache.outputs.dir }}
50+
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV
5151

52-
- name: Cache composer dependencies
52+
- name: Cache dependencies
5353
uses: actions/cache@v3
5454
with:
55-
path: ${{ steps.composer-cache.outputs.dir }}
55+
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
5656
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
5757
restore-keys: ${{ runner.os }}-composer-
5858

.github/workflows/test-phpcpd.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,14 @@ on:
2323
- 'system/**.php'
2424
- '.github/workflows/test-phpcpd.yml'
2525

26+
concurrency:
27+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
28+
cancel-in-progress: true
29+
2630
jobs:
2731
build:
2832
name: Duplicate Code Detection
29-
runs-on: ubuntu-20.04
33+
runs-on: ubuntu-22.04
3034
steps:
3135
- name: Checkout
3236
uses: actions/checkout@v3

.github/workflows/test-phpstan.yml

+9-11
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,24 @@ on:
2727
- '**.neon.dist'
2828
- '.github/workflows/test-phpstan.yml'
2929

30+
concurrency:
31+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
32+
cancel-in-progress: true
33+
3034
jobs:
3135
build:
3236
name: PHP ${{ matrix.php-versions }} Static Analysis
33-
runs-on: ubuntu-20.04
37+
runs-on: ubuntu-22.04
3438
strategy:
3539
fail-fast: false
36-
matrix:
37-
php-versions: ['8.0', '8.1']
3840
steps:
3941
- name: Checkout
4042
uses: actions/checkout@v3
4143

4244
- name: Setup PHP
4345
uses: shivammathur/setup-php@v2
4446
with:
45-
php-version: ${{ matrix.php-versions }}
47+
php-version: '8.1'
4648
extensions: intl
4749

4850
- name: Use latest Composer
@@ -52,16 +54,12 @@ jobs:
5254
run: composer validate --strict
5355

5456
- name: Get composer cache directory
55-
id: composer-cache
56-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
57-
58-
- name: Create composer cache directory
59-
run: mkdir -p ${{ steps.composer-cache.outputs.dir }}
57+
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV
6058

61-
- name: Cache composer dependencies
59+
- name: Cache dependencies
6260
uses: actions/cache@v3
6361
with:
64-
path: ${{ steps.composer-cache.outputs.dir }}
62+
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
6563
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
6664
restore-keys: ${{ runner.os }}-composer-
6765

.github/workflows/test-phpunit.yml

+87-52
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,21 @@ on:
2727
- phpunit.xml.dist
2828
- .github/workflows/test-phpunit.yml
2929

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+
3041
jobs:
3142
tests:
3243
name: PHP ${{ matrix.php-versions }} - ${{ matrix.db-platforms }}
33-
runs-on: ubuntu-20.04
44+
runs-on: ubuntu-22.04
3445
if: "!contains(github.event.head_commit.message, '[ci skip]')"
3546

3647
strategy:
@@ -65,7 +76,7 @@ jobs:
6576
options: --health-cmd=pg_isready --health-interval=10s --health-timeout=5s --health-retries=3
6677

6778
mssql:
68-
image: mcr.microsoft.com/mssql/server:2019-CU10-ubuntu-20.04
79+
image: mcr.microsoft.com/mssql/server:2022-latest
6980
env:
7081
SA_PASSWORD: 1Secure*Password1
7182
ACCEPT_EULA: Y
@@ -75,12 +86,18 @@ jobs:
7586
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
7687

7788
oracle:
78-
image: quillbuilduser/oracle-18-xe
89+
image: gvenzl/oracle-xe:21
7990
env:
80-
ORACLE_ALLOW_REMOTE: true
91+
ORACLE_RANDOM_PASSWORD: true
92+
APP_USER: ORACLE
93+
APP_USER_PASSWORD: ORACLE
8194
ports:
8295
- 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
84101
85102
redis:
86103
image: redis
@@ -98,28 +115,6 @@ jobs:
98115
if: matrix.db-platforms == 'SQLSRV'
99116
run: sqlcmd -S 127.0.0.1 -U sa -P 1Secure*Password1 -Q "CREATE DATABASE test"
100117

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-
123118
- name: Checkout
124119
uses: actions/checkout@v3
125120

@@ -129,70 +124,110 @@ jobs:
129124
php-version: ${{ matrix.php-versions }}
130125
tools: composer, pecl
131126
extensions: imagick, sqlsrv, gd, sqlite3, redis, memcached, oci8, pgsql
132-
coverage: xdebug
127+
coverage: ${{ env.COVERAGE_DRIVER }}
133128
env:
134129
update: true
130+
COVERAGE_DRIVER: ${{ matrix.php-versions == env.COVERAGE_PHP_VERSION && 'xdebug' || 'none'}}
135131

136132
- name: Install latest ImageMagick
137133
run: |
138134
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
140136
sudo apt-get install -y imagemagick
141137
sudo apt-get install --fix-broken
142138
143139
- 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
146141

147142
- name: Cache dependencies
148143
uses: actions/cache@v3
149144
with:
150-
path: ${{ steps.composercache.outputs.dir }}
145+
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
151146
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
152147
restore-keys: ${{ runner.os }}-composer-
153148

154149
- name: Install dependencies
155150
run: |
156151
composer update --ansi --no-interaction
157152
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 }}
160153
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
163156
run: echo "TACHYCARDIA_MONITOR_GA=enabled" >> $GITHUB_ENV
164157

165158
- name: Compute coverage option
166159
uses: actions/github-script@v6
167160
id: phpunit-coverage-option
168161
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"
170166
result-encoding: string
167+
env:
168+
COVERAGE_NAME: php-v${{ env.COVERAGE_PHP_VERSION }}-${{ matrix.db-platforms }}
171169

172170
- name: Test with PHPUnit
173171
run: script -e -c "vendor/bin/phpunit --color=always --exclude-group=auto-review ${{ steps.phpunit-coverage-option.outputs.result }}"
174172
env:
175173
DB: ${{ matrix.db-platforms }}
176174
TERM: xterm-256color
177175

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
183184
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 }}
187186

188-
coveralls-finish:
187+
coveralls:
189188
if: github.repository_owner == 'codeigniter4'
190-
needs: [tests]
191-
runs-on: ubuntu-20.04
189+
needs: tests
190+
runs-on: ubuntu-22.04
192191

193192
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
196219
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

Comments
 (0)