Char highlight #315
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PHPUnit | |
on: [push, pull_request] | |
jobs: | |
run: | |
runs-on: ${{ matrix.operating-system }} | |
strategy: | |
matrix: | |
# windows-latest, macOS-latest | |
operating-system: [ubuntu-latest] | |
php-version: ['5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3'] | |
name: PHP ${{ matrix.php-version }} Test on ${{ matrix.operating-system }} | |
# services: | |
# mysql: | |
# image: mysql:5.7 | |
# env: | |
# MYSQL_ALLOW_EMPTY_PASSWORD: yes | |
# MYSQL_DATABASE: test | |
# ports: | |
# - 3306 | |
# options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
env: | |
MYSQL_DATABASE: test | |
MYSQL_USERNAME: root | |
MYSQL_PASSWORD: root | |
steps: | |
- name: Set up MySQL | |
continue-on-error: true | |
run: | | |
sudo /etc/init.d/mysql start --default-auth=mysql_native_password | |
mysql -e 'CREATE DATABASE ${{ env.MYSQL_DATABASE }};' -u${{ env.MYSQL_USERNAME }} -p${{ env.MYSQL_PASSWORD }} | |
mysqld --version | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install PHP | |
uses: shivammathur/setup-php@v2 # https://github.com/marketplace/actions/setup-php-action | |
with: | |
php-version: ${{ matrix.php-version }} | |
extensions: intl, mysqli, oauth | |
ini-values: error_reporting=-1, post_max_size=256M, memory_limit=512M, xdebug.mode="coverage,develop" | |
coverage: xdebug #optional | |
- name: Check PHP Version | |
run: | | |
php -v | |
php -r 'echo "curl version: " . curl_version()["version"] . "\n";' | |
- name: Validate composer.json and composer.lock | |
run: composer validate --strict | |
- name: Cache composer packages | |
uses: actions/cache@v4 | |
id: composer-cache | |
with: | |
path: vendor | |
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-php- | |
- name: Install dependencies | |
run: | | |
composer --version | |
composer install --prefer-dist --no-progress | |
- name: Unit test | |
run: composer run test | |
- name: Publish code coverage | |
if: ${{ matrix.php-version == '8.2' && github.ref_name == 'master' }} | |
uses: paambaati/[email protected] | |
continue-on-error: true | |
env: | |
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} | |
with: | |
debug: false | |
coverageCommand: vendor/bin/phpunit --coverage-clover coverage/clover.xml | |
coverageLocations: coverage/clover.xml:clover | |
- name: Coverage summary | |
if: ${{ matrix.php-version == '8.2' && github.ref_name == 'master' }} | |
continue-on-error: true | |
run: php -f vendor/bdk/devutil/src/coverageChecker.php -- coverage/clover.xml |