FIX: try #12
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: PHP Lint Check | ||
on: | ||
push: | ||
branches: [ "unittest" ] | ||
pull_request: | ||
branches: [ "unittest" ] | ||
permissions: | ||
contents: read | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
services: | ||
mysql: | ||
image: mysql:5.7 | ||
env: | ||
MYSQL_ROOT_PASSWORD: root | ||
MYSQL_DATABASE: seme_framework | ||
ports: | ||
- 3306:3306 | ||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | ||
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Install PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '8.2' | ||
extensions: mbstring, xml, ctype, iconv, intl, pdo, pdo_mysql, dom, filter, gd, json, libxml | ||
coverage: xdebug | ||
- name: Create config file | ||
run: | | ||
cat > app/config/development.php << 'EOL' | ||
<?php | ||
$site = "http://".$_SERVER['HTTP_HOST']."/"; | ||
$method = "REQUEST_URI"; | ||
$admin_secret_url = 'admin'; | ||
$cdn_url = ''; | ||
$db['host'] = '127.0.0.1'; | ||
$db['user'] = 'root'; | ||
$db['pass'] = 'root'; | ||
$db['name'] = 'seme_framework'; | ||
$db['port'] = '3306'; | ||
$db['charset'] = 'utf8mb4'; | ||
$db['engine'] = 'mysqli'; | ||
$db['enckey'] = ''; | ||
EOL | ||
- name: PHP lint | ||
run: | | ||
lint_errors=$(find app kero/sine -type f -name "*.php" -exec php -l {} \; 2>&1) | ||
echo "$lint_errors" | ||
if grep -q "Parse error" <<< "$lint_errors"; then | ||
exit 1 | ||
fi | ||
- name: Verify MySQL connection | ||
run: | | ||
while ! mysqladmin ping -h"127.0.0.1" -P"3306" --silent; do | ||
sleep 1 | ||
done | ||
- name: Set up MySQL | ||
run: | | ||
mysql -h127.0.0.1 -uroot -proot -e " | ||
ALTER DATABASE seme_framework CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; | ||
SET NAMES utf8mb4; | ||
SET character_set_server = utf8mb4; | ||
" | ||
- name: Install dependencies | ||
run: | | ||
composer install --no-ansi --no-interaction --no-progress --no-scripts --no-suggest | ||
composer require -W --dev phpunit/phpunit | ||
- name: List vendor directory | ||
run: ls -la vendor/bin/ | ||
- name: Run PHPUnit tests | ||
run: php vendor/bin/phpunit --configuration phpunit.xml --testsuite Dev --debug |