Skip to content

Commit 7f19d43

Browse files
authored
Merge pull request #16 from codeigniter4/remove-lowest-from-phpunit.yml
Add phpunit-lowest.yml
2 parents b3a5965 + f1b5ab6 commit 7f19d43

File tree

3 files changed

+114
-10
lines changed

3 files changed

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

.github/workflows/phpunit-no-db.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ jobs:
3838
dependencies: ['highest', 'lowest']
3939

4040
steps:
41+
- name: Check disk space
42+
run: df -h
43+
4144
- name: Checkout
4245
uses: actions/checkout@v4
4346

.github/workflows/phpunit.yml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ permissions:
2929

3030
jobs:
3131
main:
32-
name: PHP ${{ matrix.php-versions }} - ${{ matrix.db-platforms }} - ${{ matrix.dependencies }}
32+
name: PHP ${{ matrix.php-versions }} - ${{ matrix.db-platforms }}
3333
runs-on: ubuntu-latest
3434
if: "!contains(github.event.head_commit.message, '[ci skip]')"
3535
strategy:
@@ -43,27 +43,18 @@ jobs:
4343
- php-versions: '7.4'
4444
db-platforms: MySQLi
4545
mysql-versions: '8.0'
46-
dependencies: 'highest'
47-
# Lowest Dependency
48-
- php-versions: '7.4'
49-
db-platforms: MySQLi
50-
mysql-versions: '5.7'
51-
dependencies: 'lowest'
5246
# Postgre
5347
- php-versions: '7.4'
5448
db-platforms: Postgre
5549
mysql-versions: '5.7'
56-
dependencies: 'highest'
5750
# SQLSRV
5851
- php-versions: '7.4'
5952
db-platforms: SQLSRV
6053
mysql-versions: '5.7'
61-
dependencies: 'highest'
6254
# OCI8
6355
- php-versions: '7.4'
6456
db-platforms: OCI8
6557
mysql-versions: '5.7'
66-
dependencies: 'highest'
6758

6859
services:
6960
mysql:
@@ -104,6 +95,22 @@ jobs:
10495
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
10596

10697
steps:
98+
- name: Free Disk Space (Ubuntu)
99+
uses: jlumbroso/free-disk-space@main
100+
with:
101+
# this might remove tools that are actually needed,
102+
# if set to "true" but frees about 6 GB
103+
tool-cache: false
104+
105+
# all of these default to true, but feel free to set to
106+
# "false" if necessary for your workflow
107+
android: true
108+
dotnet: true
109+
haskell: true
110+
large-packages: false
111+
docker-images: true
112+
swap-storage: true
113+
107114
- name: Create database for MSSQL Server
108115
if: matrix.db-platforms == 'SQLSRV'
109116
run: sqlcmd -S 127.0.0.1 -U sa -P 1Secure*Password1 -Q "CREATE DATABASE test"

0 commit comments

Comments
 (0)