Skip to content

Commit

Permalink
chore: update phpunit workflow
Browse files Browse the repository at this point in the history
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---github.com-rectorphp-rector.git/'

Cloning into bare repository '/home/runner/.cache/composer/vcs/https---github.com-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.
  • Loading branch information
kenjis committed Sep 28, 2023
1 parent a54e614 commit b319800
Show file tree
Hide file tree
Showing 2 changed files with 288 additions and 2 deletions.
106 changes: 106 additions & 0 deletions .github/workflows/phpunit-lowest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# This workflow runs tests on MySQLi with the lowest PHP version and Composer dependencies.
name: PHPUnit Lowest

on:
pull_request:
branches:
- develop
paths:
- '**.php'
- 'composer.*'
- 'phpunit*'
- '.github/workflows/phpunit.yml'
push:
branches:
- develop
paths:
- '**.php'
- 'composer.*'
- 'phpunit*'
- '.github/workflows/phpunit.yml'
workflow_call:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
contents: read

jobs:
main:
name: PHP ${{ matrix.php-versions }} - ${{ matrix.db-platforms }} - ${{ matrix.dependencies }}
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"
strategy:
matrix:
php-versions: ['7.4']
db-platforms: ['MySQLi']
mysql-versions: ['5.7']
dependencies: ['lowest']

services:
mysql:
image: mysql:${{ matrix.mysql-versions }}
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: test
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

steps:
- name: Check disk space
run: df -h

- name: Checkout
uses: actions/checkout@v4

- name: Check disk space
run: df -h

- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: composer, phive, phpunit
extensions: intl, json, mbstring, gd, xdebug, xml, sqlite3
coverage: xdebug
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Check disk space
run: df -h

- name: Get composer cache directory
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV

- name: Cache composer dependencies
uses: actions/cache@v3
with:
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
key: ${{ runner.os }}-composer-lowest-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-lowest-

- name: Check disk space
run: df -h

- name: Install dependencies
run: |
if [ -f composer.lock ]; then
composer install ${{ env.COMPOSER_UPDATE_FLAGS }} --no-progress --no-interaction --prefer-dist --optimize-autoloader
else
composer update ${{ env.COMPOSER_UPDATE_FLAGS }} --no-progress --no-interaction --prefer-dist --optimize-autoloader
fi
env:
COMPOSER_UPDATE_FLAGS: ${{ matrix.dependencies == 'lowest' && '--prefer-lowest' || '' }}

- name: Check disk space
run: df -h

- name: Test with PHPUnit
run: vendor/bin/phpunit --verbose --coverage-text --testsuite main
env:
DB: ${{ matrix.db-platforms }}
TERM: xterm-256color
TACHYCARDIA_MONITOR_GA: enabled
184 changes: 182 additions & 2 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# This workflow runs tests on all databases supported by CI4.
name: PHPUnit

on:
Expand All @@ -17,7 +18,186 @@ on:
- 'composer.*'
- 'phpunit*'
- '.github/workflows/phpunit.yml'
workflow_call:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
contents: read

jobs:
phpunit:
uses: codeigniter4/.github/.github/workflows/phpunit.yml@main
main:
name: PHP ${{ matrix.php-versions }} - ${{ matrix.db-platforms }}
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"
strategy:
matrix:
php-versions: ['7.4', '8.0', '8.1', '8.2']
db-platforms: ['MySQLi', 'SQLite3']
mysql-versions: ['5.7']
dependencies: ['highest']
include:
# MySQL 8.0
- php-versions: '7.4'
db-platforms: MySQLi
mysql-versions: '8.0'
# Postgre
- php-versions: '7.4'
db-platforms: Postgre
mysql-versions: '5.7'
# SQLSRV
- php-versions: '7.4'
db-platforms: SQLSRV
mysql-versions: '5.7'
# OCI8
- php-versions: '7.4'
db-platforms: OCI8
mysql-versions: '5.7'

services:
mysql:
image: mysql:${{ matrix.mysql-versions }}
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: test
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

postgres:
image: postgres
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: test
ports:
- 5432:5432
options: --health-cmd=pg_isready --health-interval=10s --health-timeout=5s --health-retries=3

mssql:
image: mcr.microsoft.com/mssql/server:2019-CU10-ubuntu-20.04
env:
SA_PASSWORD: 1Secure*Password1
ACCEPT_EULA: Y
MSSQL_PID: Developer
ports:
- 1433:1433
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

oracle:
image: quillbuilduser/oracle-18-xe
env:
ORACLE_ALLOW_REMOTE: true
ports:
- 1521:1521
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

steps:
- name: Check disk space
run: df -h

- name: Create database for MSSQL Server
if: matrix.db-platforms == 'SQLSRV'
run: sqlcmd -S 127.0.0.1 -U sa -P 1Secure*Password1 -Q "CREATE DATABASE test"

- name: Install Oracle InstantClient
if: matrix.db-platforms == 'OCI8'
run: |
sudo apt-get install wget libaio1 alien
sudo wget https://download.oracle.com/otn_software/linux/instantclient/185000/oracle-instantclient18.5-basic-18.5.0.0.0-3.x86_64.rpm
sudo wget https://download.oracle.com/otn_software/linux/instantclient/185000/oracle-instantclient18.5-devel-18.5.0.0.0-3.x86_64.rpm
sudo wget https://download.oracle.com/otn_software/linux/instantclient/185000/oracle-instantclient18.5-sqlplus-18.5.0.0.0-3.x86_64.rpm
sudo alien oracle-instantclient18.5-basic-18.5.0.0.0-3.x86_64.rpm
sudo alien oracle-instantclient18.5-devel-18.5.0.0.0-3.x86_64.rpm
sudo alien oracle-instantclient18.5-sqlplus-18.5.0.0.0-3.x86_64.rpm
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
echo "LD_LIBRARY_PATH=/lib/oracle/18.5/client64/lib/" >> $GITHUB_ENV
echo "NLS_LANG=AMERICAN_AMERICA.UTF8" >> $GITHUB_ENV
echo "C_INCLUDE_PATH=/usr/include/oracle/18.5/client64" >> $GITHUB_ENV
echo 'NLS_DATE_FORMAT=YYYY-MM-DD HH24:MI:SS' >> $GITHUB_ENV
echo 'NLS_TIMESTAMP_FORMAT=YYYY-MM-DD HH24:MI:SS' >> $GITHUB_ENV
echo 'NLS_TIMESTAMP_TZ_FORMAT=YYYY-MM-DD HH24:MI:SS' >> $GITHUB_ENV
- name: Create database for Oracle Database
if: matrix.db-platforms == 'OCI8'
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

- name: Check disk space
run: df -h

- name: Checkout
uses: actions/checkout@v4

- name: Check disk space
run: df -h

- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: composer, phive, phpunit
extensions: intl, json, mbstring, gd, xdebug, xml, sqlite3, sqlsrv, oci8, pgsql
coverage: xdebug
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Check disk space
run: df -h

- name: Get composer cache directory
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV

- name: Check disk space
run: df -h

- name: Cache composer dependencies
uses: actions/cache@v3
with:
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install dependencies
run: |
if [ -f composer.lock ]; then
composer install ${{ env.COMPOSER_UPDATE_FLAGS }} --no-progress --no-interaction --prefer-dist --optimize-autoloader
else
composer update ${{ env.COMPOSER_UPDATE_FLAGS }} --no-progress --no-interaction --prefer-dist --optimize-autoloader
fi
env:
COMPOSER_UPDATE_FLAGS: ${{ matrix.dependencies == 'lowest' && '--prefer-lowest' || '' }}

- name: Check disk space
run: df -h

- name: Test with PHPUnit
run: vendor/bin/phpunit --verbose --coverage-text --testsuite main
env:
DB: ${{ matrix.db-platforms }}
TERM: xterm-256color
TACHYCARDIA_MONITOR_GA: enabled

- if: matrix.php-versions == '8.1'
name: Run Coveralls
continue-on-error: true
run: |
sudo phive --no-progress install --global --trust-gpg-keys E82B2FB314E9906E php-coveralls
php-coveralls --verbose --coverage_clover=build/phpunit/clover.xml --json_path build/phpunit/coveralls-upload.json
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_PARALLEL: true
COVERALLS_FLAG_NAME: PHP ${{ matrix.php-versions }} - ${{ matrix.db-platforms }}

coveralls:
needs: [main]
name: Coveralls Finished
runs-on: ubuntu-latest
steps:
- name: Upload Coveralls results
uses: coverallsapp/github-action@master
continue-on-error: true
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true

0 comments on commit b319800

Please sign in to comment.