Skip to content

Commit de693ee

Browse files
committed
Add PHPUnit Lowest workflow
1 parent 25d35d6 commit de693ee

1 file changed

Lines changed: 94 additions & 0 deletions

File tree

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

0 commit comments

Comments
 (0)