Skip to content

Commit 81c5165

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 81c5165

File tree

2 files changed

+259
-2
lines changed

2 files changed

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

0 commit comments

Comments
 (0)