Skip to content

Commit b319800

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 b319800

File tree

2 files changed

+288
-2
lines changed

2 files changed

+288
-2
lines changed

.github/workflows/phpunit-lowest.yml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
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: Check disk space
54+
run: df -h
55+
56+
- name: Checkout
57+
uses: actions/checkout@v4
58+
59+
- name: Check disk space
60+
run: df -h
61+
62+
- name: Set up PHP
63+
uses: shivammathur/setup-php@v2
64+
with:
65+
php-version: ${{ matrix.php-versions }}
66+
tools: composer, phive, phpunit
67+
extensions: intl, json, mbstring, gd, xdebug, xml, sqlite3
68+
coverage: xdebug
69+
env:
70+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
71+
72+
- name: Check disk space
73+
run: df -h
74+
75+
- name: Get composer cache directory
76+
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV
77+
78+
- name: Cache composer dependencies
79+
uses: actions/cache@v3
80+
with:
81+
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
82+
key: ${{ runner.os }}-composer-lowest-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
83+
restore-keys: ${{ runner.os }}-composer-lowest-
84+
85+
- name: Check disk space
86+
run: df -h
87+
88+
- name: Install dependencies
89+
run: |
90+
if [ -f composer.lock ]; then
91+
composer install ${{ env.COMPOSER_UPDATE_FLAGS }} --no-progress --no-interaction --prefer-dist --optimize-autoloader
92+
else
93+
composer update ${{ env.COMPOSER_UPDATE_FLAGS }} --no-progress --no-interaction --prefer-dist --optimize-autoloader
94+
fi
95+
env:
96+
COMPOSER_UPDATE_FLAGS: ${{ matrix.dependencies == 'lowest' && '--prefer-lowest' || '' }}
97+
98+
- name: Check disk space
99+
run: df -h
100+
101+
- name: Test with PHPUnit
102+
run: vendor/bin/phpunit --verbose --coverage-text --testsuite main
103+
env:
104+
DB: ${{ matrix.db-platforms }}
105+
TERM: xterm-256color
106+
TACHYCARDIA_MONITOR_GA: enabled

.github/workflows/phpunit.yml

Lines changed: 182 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,186 @@ 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: Check disk space
99+
run: df -h
100+
101+
- name: Create database for MSSQL Server
102+
if: matrix.db-platforms == 'SQLSRV'
103+
run: sqlcmd -S 127.0.0.1 -U sa -P 1Secure*Password1 -Q "CREATE DATABASE test"
104+
105+
- name: Install Oracle InstantClient
106+
if: matrix.db-platforms == 'OCI8'
107+
run: |
108+
sudo apt-get install wget libaio1 alien
109+
sudo wget https://download.oracle.com/otn_software/linux/instantclient/185000/oracle-instantclient18.5-basic-18.5.0.0.0-3.x86_64.rpm
110+
sudo wget https://download.oracle.com/otn_software/linux/instantclient/185000/oracle-instantclient18.5-devel-18.5.0.0.0-3.x86_64.rpm
111+
sudo wget https://download.oracle.com/otn_software/linux/instantclient/185000/oracle-instantclient18.5-sqlplus-18.5.0.0.0-3.x86_64.rpm
112+
sudo alien oracle-instantclient18.5-basic-18.5.0.0.0-3.x86_64.rpm
113+
sudo alien oracle-instantclient18.5-devel-18.5.0.0.0-3.x86_64.rpm
114+
sudo alien oracle-instantclient18.5-sqlplus-18.5.0.0.0-3.x86_64.rpm
115+
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
116+
echo "LD_LIBRARY_PATH=/lib/oracle/18.5/client64/lib/" >> $GITHUB_ENV
117+
echo "NLS_LANG=AMERICAN_AMERICA.UTF8" >> $GITHUB_ENV
118+
echo "C_INCLUDE_PATH=/usr/include/oracle/18.5/client64" >> $GITHUB_ENV
119+
echo 'NLS_DATE_FORMAT=YYYY-MM-DD HH24:MI:SS' >> $GITHUB_ENV
120+
echo 'NLS_TIMESTAMP_FORMAT=YYYY-MM-DD HH24:MI:SS' >> $GITHUB_ENV
121+
echo 'NLS_TIMESTAMP_TZ_FORMAT=YYYY-MM-DD HH24:MI:SS' >> $GITHUB_ENV
122+
123+
- name: Create database for Oracle Database
124+
if: matrix.db-platforms == 'OCI8'
125+
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
126+
127+
- name: Check disk space
128+
run: df -h
129+
130+
- name: Checkout
131+
uses: actions/checkout@v4
132+
133+
- name: Check disk space
134+
run: df -h
135+
136+
- name: Set up PHP
137+
uses: shivammathur/setup-php@v2
138+
with:
139+
php-version: ${{ matrix.php-versions }}
140+
tools: composer, phive, phpunit
141+
extensions: intl, json, mbstring, gd, xdebug, xml, sqlite3, sqlsrv, oci8, pgsql
142+
coverage: xdebug
143+
env:
144+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
145+
146+
- name: Check disk space
147+
run: df -h
148+
149+
- name: Get composer cache directory
150+
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV
151+
152+
- name: Check disk space
153+
run: df -h
154+
155+
- name: Cache composer dependencies
156+
uses: actions/cache@v3
157+
with:
158+
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
159+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
160+
restore-keys: ${{ runner.os }}-composer-
161+
162+
- name: Install dependencies
163+
run: |
164+
if [ -f composer.lock ]; then
165+
composer install ${{ env.COMPOSER_UPDATE_FLAGS }} --no-progress --no-interaction --prefer-dist --optimize-autoloader
166+
else
167+
composer update ${{ env.COMPOSER_UPDATE_FLAGS }} --no-progress --no-interaction --prefer-dist --optimize-autoloader
168+
fi
169+
env:
170+
COMPOSER_UPDATE_FLAGS: ${{ matrix.dependencies == 'lowest' && '--prefer-lowest' || '' }}
171+
172+
- name: Check disk space
173+
run: df -h
174+
175+
- name: Test with PHPUnit
176+
run: vendor/bin/phpunit --verbose --coverage-text --testsuite main
177+
env:
178+
DB: ${{ matrix.db-platforms }}
179+
TERM: xterm-256color
180+
TACHYCARDIA_MONITOR_GA: enabled
181+
182+
- if: matrix.php-versions == '8.1'
183+
name: Run Coveralls
184+
continue-on-error: true
185+
run: |
186+
sudo phive --no-progress install --global --trust-gpg-keys E82B2FB314E9906E php-coveralls
187+
php-coveralls --verbose --coverage_clover=build/phpunit/clover.xml --json_path build/phpunit/coveralls-upload.json
188+
env:
189+
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
190+
COVERALLS_PARALLEL: true
191+
COVERALLS_FLAG_NAME: PHP ${{ matrix.php-versions }} - ${{ matrix.db-platforms }}
192+
193+
coveralls:
194+
needs: [main]
195+
name: Coveralls Finished
196+
runs-on: ubuntu-latest
197+
steps:
198+
- name: Upload Coveralls results
199+
uses: coverallsapp/github-action@master
200+
continue-on-error: true
201+
with:
202+
github-token: ${{ secrets.GITHUB_TOKEN }}
203+
parallel-finished: true

0 commit comments

Comments
 (0)