Skip to content

Commit 7f0d5b3

Browse files
committed
chore: update phpunit workflow
The disk hosting /home/runner/.composer has less than 100MiB of free space, this may be the cause of the following exception Error: Failed to execute git clone --mirror -- '***github.com/rectorphp/rector.git' '/home/runner/.cache/composer/vcs/https---mygithub.libinneed.workers.dev-rectorphp-rector.git/' Cloning into bare repository '/home/runner/.cache/composer/vcs/https---mygithub.libinneed.workers.dev-rectorphp-rector.git'... fatal: write error: No space left on device fatal: fetch-pack: invalid index-pack output In Git.php line 472: Failed to execute git clone --mirror -- '***gi thub.com/rectorphp/rector.git' '/home/runner/.cache/composer/vcs/https---gi thub.com-rectorphp-rector.git/' Cloning into bare repository '/home/runner/.cache/composer/vcs/https---gith ub.com-rectorphp-rector.git'... fatal: write error: No space left on device fatal: fetch-pack: invalid index-pack output update [--with WITH] [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--dry-run] [--dev] [--no-dev] [--lock] [--no-install] [--no-audit] [--audit-format AUDIT-FORMAT] [--no-autoloader] [--no-suggest] [--no-progress] [-w|--with-dependencies] [-W|--with-all-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--apcu-autoloader-prefix APCU-AUTOLOADER-PREFIX] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [-i|--interactive] [--root-reqs] [--] [<packages>...] Error: Process completed with exit code 1.
1 parent a54e614 commit 7f0d5b3

File tree

2 files changed

+255
-2
lines changed

2 files changed

+255
-2
lines changed

.github/workflows/phpunit-lowest.yml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# This workflow runs tests on MySQLi with the lowest PHP version and Composer dependencies.
2+
name: PHPUnit Lowest
3+
4+
on:
5+
pull_request:
6+
branches:
7+
- develop
8+
paths:
9+
- '**.php'
10+
- 'composer.*'
11+
- 'phpunit*'
12+
- '.github/workflows/phpunit.yml'
13+
push:
14+
branches:
15+
- develop
16+
paths:
17+
- '**.php'
18+
- 'composer.*'
19+
- 'phpunit*'
20+
- '.github/workflows/phpunit.yml'
21+
workflow_call:
22+
23+
concurrency:
24+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
25+
cancel-in-progress: true
26+
27+
permissions:
28+
contents: read
29+
30+
jobs:
31+
main:
32+
name: PHP ${{ matrix.php-versions }} - ${{ matrix.db-platforms }} - ${{ matrix.dependencies }}
33+
runs-on: ubuntu-latest
34+
if: "!contains(github.event.head_commit.message, '[ci skip]')"
35+
strategy:
36+
matrix:
37+
php-versions: ['7.4']
38+
db-platforms: ['MySQLi']
39+
mysql-versions: ['5.7']
40+
dependencies: ['lowest']
41+
42+
services:
43+
mysql:
44+
image: mysql:${{ matrix.mysql-versions }}
45+
env:
46+
MYSQL_ALLOW_EMPTY_PASSWORD: yes
47+
MYSQL_DATABASE: test
48+
ports:
49+
- 3306:3306
50+
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
51+
52+
steps:
53+
- name: Checkout
54+
uses: actions/checkout@v4
55+
56+
- name: Set up PHP
57+
uses: shivammathur/setup-php@v2
58+
with:
59+
php-version: ${{ matrix.php-versions }}
60+
tools: composer, phive, phpunit
61+
extensions: intl, json, mbstring, gd, xdebug, xml, sqlite3
62+
coverage: xdebug
63+
env:
64+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65+
66+
- name: Get composer cache directory
67+
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV
68+
69+
- name: Cache composer dependencies
70+
uses: actions/cache@v3
71+
with:
72+
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
73+
key: ${{ runner.os }}-composer-lowest-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
74+
restore-keys: ${{ runner.os }}-composer-lowest-
75+
76+
- name: Install dependencies
77+
run: |
78+
if [ -f composer.lock ]; then
79+
composer install ${{ env.COMPOSER_UPDATE_FLAGS }} --no-progress --no-interaction --prefer-dist --optimize-autoloader
80+
else
81+
composer update ${{ env.COMPOSER_UPDATE_FLAGS }} --no-progress --no-interaction --prefer-dist --optimize-autoloader
82+
fi
83+
env:
84+
COMPOSER_UPDATE_FLAGS: ${{ matrix.dependencies == 'lowest' && '--prefer-lowest' || '' }}
85+
86+
- name: Test with PHPUnit
87+
run: vendor/bin/phpunit --verbose --coverage-text --testsuite main
88+
env:
89+
DB: ${{ matrix.db-platforms }}
90+
TERM: xterm-256color
91+
TACHYCARDIA_MONITOR_GA: enabled

.github/workflows/phpunit.yml

Lines changed: 164 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# This workflow runs tests on all databases supported by CI4.
12
name: PHPUnit
23

34
on:
@@ -17,7 +18,168 @@ on:
1718
- 'composer.*'
1819
- 'phpunit*'
1920
- '.github/workflows/phpunit.yml'
21+
workflow_call:
22+
23+
concurrency:
24+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
25+
cancel-in-progress: true
26+
27+
permissions:
28+
contents: read
2029

2130
jobs:
22-
phpunit:
23-
uses: codeigniter4/.github/.github/workflows/phpunit.yml@main
31+
main:
32+
name: PHP ${{ matrix.php-versions }} - ${{ matrix.db-platforms }}
33+
runs-on: ubuntu-latest
34+
if: "!contains(github.event.head_commit.message, '[ci skip]')"
35+
strategy:
36+
matrix:
37+
php-versions: ['7.4', '8.0', '8.1', '8.2']
38+
db-platforms: ['MySQLi', 'SQLite3']
39+
mysql-versions: ['5.7']
40+
dependencies: ['highest']
41+
include:
42+
# MySQL 8.0
43+
- php-versions: '7.4'
44+
db-platforms: MySQLi
45+
mysql-versions: '8.0'
46+
# Postgre
47+
- php-versions: '7.4'
48+
db-platforms: Postgre
49+
mysql-versions: '5.7'
50+
# SQLSRV
51+
- php-versions: '7.4'
52+
db-platforms: SQLSRV
53+
mysql-versions: '5.7'
54+
# OCI8
55+
- php-versions: '7.4'
56+
db-platforms: OCI8
57+
mysql-versions: '5.7'
58+
59+
services:
60+
mysql:
61+
image: mysql:${{ matrix.mysql-versions }}
62+
env:
63+
MYSQL_ALLOW_EMPTY_PASSWORD: yes
64+
MYSQL_DATABASE: test
65+
ports:
66+
- 3306:3306
67+
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
68+
69+
postgres:
70+
image: postgres
71+
env:
72+
POSTGRES_USER: postgres
73+
POSTGRES_PASSWORD: postgres
74+
POSTGRES_DB: test
75+
ports:
76+
- 5432:5432
77+
options: --health-cmd=pg_isready --health-interval=10s --health-timeout=5s --health-retries=3
78+
79+
mssql:
80+
image: mcr.microsoft.com/mssql/server:2019-CU10-ubuntu-20.04
81+
env:
82+
SA_PASSWORD: 1Secure*Password1
83+
ACCEPT_EULA: Y
84+
MSSQL_PID: Developer
85+
ports:
86+
- 1433:1433
87+
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
88+
89+
oracle:
90+
image: quillbuilduser/oracle-18-xe
91+
env:
92+
ORACLE_ALLOW_REMOTE: true
93+
ports:
94+
- 1521:1521
95+
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+
97+
steps:
98+
- name: Create database for MSSQL Server
99+
if: matrix.db-platforms == 'SQLSRV'
100+
run: sqlcmd -S 127.0.0.1 -U sa -P 1Secure*Password1 -Q "CREATE DATABASE test"
101+
102+
- name: Install Oracle InstantClient
103+
if: matrix.db-platforms == 'OCI8'
104+
run: |
105+
sudo apt-get install wget libaio1 alien
106+
sudo wget https://download.oracle.com/otn_software/linux/instantclient/185000/oracle-instantclient18.5-basic-18.5.0.0.0-3.x86_64.rpm
107+
sudo wget https://download.oracle.com/otn_software/linux/instantclient/185000/oracle-instantclient18.5-devel-18.5.0.0.0-3.x86_64.rpm
108+
sudo wget https://download.oracle.com/otn_software/linux/instantclient/185000/oracle-instantclient18.5-sqlplus-18.5.0.0.0-3.x86_64.rpm
109+
sudo alien oracle-instantclient18.5-basic-18.5.0.0.0-3.x86_64.rpm
110+
sudo alien oracle-instantclient18.5-devel-18.5.0.0.0-3.x86_64.rpm
111+
sudo alien oracle-instantclient18.5-sqlplus-18.5.0.0.0-3.x86_64.rpm
112+
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
113+
echo "LD_LIBRARY_PATH=/lib/oracle/18.5/client64/lib/" >> $GITHUB_ENV
114+
echo "NLS_LANG=AMERICAN_AMERICA.UTF8" >> $GITHUB_ENV
115+
echo "C_INCLUDE_PATH=/usr/include/oracle/18.5/client64" >> $GITHUB_ENV
116+
echo 'NLS_DATE_FORMAT=YYYY-MM-DD HH24:MI:SS' >> $GITHUB_ENV
117+
echo 'NLS_TIMESTAMP_FORMAT=YYYY-MM-DD HH24:MI:SS' >> $GITHUB_ENV
118+
echo 'NLS_TIMESTAMP_TZ_FORMAT=YYYY-MM-DD HH24:MI:SS' >> $GITHUB_ENV
119+
120+
- name: Create database for Oracle Database
121+
if: matrix.db-platforms == 'OCI8'
122+
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
123+
124+
- name: Checkout
125+
uses: actions/checkout@v4
126+
127+
- name: Set up PHP
128+
uses: shivammathur/setup-php@v2
129+
with:
130+
php-version: ${{ matrix.php-versions }}
131+
tools: composer, phive, phpunit
132+
extensions: intl, json, mbstring, gd, xdebug, xml, sqlite3, sqlsrv, oci8, pgsql
133+
coverage: xdebug
134+
env:
135+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
136+
137+
- name: Get composer cache directory
138+
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV
139+
140+
- name: Cache composer dependencies
141+
uses: actions/cache@v3
142+
with:
143+
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
144+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
145+
restore-keys: ${{ runner.os }}-composer-
146+
147+
- name: Install dependencies
148+
run: |
149+
if [ -f composer.lock ]; then
150+
composer install ${{ env.COMPOSER_UPDATE_FLAGS }} --no-progress --no-interaction --prefer-dist --optimize-autoloader
151+
else
152+
composer update ${{ env.COMPOSER_UPDATE_FLAGS }} --no-progress --no-interaction --prefer-dist --optimize-autoloader
153+
fi
154+
env:
155+
COMPOSER_UPDATE_FLAGS: ${{ matrix.dependencies == 'lowest' && '--prefer-lowest' || '' }}
156+
157+
- name: Test with PHPUnit
158+
run: vendor/bin/phpunit --verbose --coverage-text --testsuite main
159+
env:
160+
DB: ${{ matrix.db-platforms }}
161+
TERM: xterm-256color
162+
TACHYCARDIA_MONITOR_GA: enabled
163+
164+
- if: matrix.php-versions == '8.1'
165+
name: Run Coveralls
166+
continue-on-error: true
167+
run: |
168+
sudo phive --no-progress install --global --trust-gpg-keys E82B2FB314E9906E php-coveralls
169+
php-coveralls --verbose --coverage_clover=build/phpunit/clover.xml --json_path build/phpunit/coveralls-upload.json
170+
env:
171+
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
172+
COVERALLS_PARALLEL: true
173+
COVERALLS_FLAG_NAME: PHP ${{ matrix.php-versions }} - ${{ matrix.db-platforms }}
174+
175+
coveralls:
176+
needs: [main]
177+
name: Coveralls Finished
178+
runs-on: ubuntu-latest
179+
steps:
180+
- name: Upload Coveralls results
181+
uses: coverallsapp/github-action@master
182+
continue-on-error: true
183+
with:
184+
github-token: ${{ secrets.GITHUB_TOKEN }}
185+
parallel-finished: true

0 commit comments

Comments
 (0)