Repository navigation
105 lines (94 loc) · 3.03 KB
/
Copy pathphpunit-lowest.yml
File metadata and controls
105 lines (94 loc) · 3.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# 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-lowest.yml'
push:
branches:
- develop
paths:
- '**.php'
- 'composer.*'
- 'phpunit*'
- '.github/workflows/phpunit-lowest.yml'
workflow_call:
inputs:
php-version:
required: false
type: string
default: '8.1'
db-platform:
required: false
type: string
default: 'MySQLi'
mysql-version:
required: false
type: string
default: '5.7'
dependencies:
required: false
type: string
default: 'lowest'
coveralls-php:
required: false
type: string
default: '8.1'
permissions:
contents: read
jobs:
main:
name: PHP ${{ inputs['php-version'] }} - ${{ inputs['db-platform'] }} - ${{ inputs['dependencies'] }}
runs-on: ubuntu-latest
if: (! contains(github.event.head_commit.message, '[ci skip]'))
services:
mysql:
image: mysql:${{ inputs['mysql-version'] }}
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@v5
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ inputs['php-version'] }}
tools: composer, phive, phpunit
extensions: intl, json, mbstring, gd, xdebug, xml, sqlite3
coverage: xdebug
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- 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@v4
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: 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: ${{ inputs['dependencies'] == 'lowest' && '--prefer-lowest' || '' }}
- name: Test with PHPUnit
run: vendor/bin/phpunit --coverage-text --testsuite main
env:
DB: ${{ inputs['db-platform'] }}
TERM: xterm-256color
TACHYCARDIA_MONITOR_GA: enabled