Skip to content

Merge pull request #86 from phenixphp/feature/add-listening-events #184

Merge pull request #86 from phenixphp/feature/add-listening-events

Merge pull request #86 from phenixphp/feature/add-listening-events #184

Workflow file for this run

name: run-tests
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
jobs:
test:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:8.0
env:
MYSQL_DATABASE: phenix
MYSQL_USER: phenix
MYSQL_PASSWORD: secret
MYSQL_ROOT_PASSWORD: secret
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping -h 127.0.0.1 -uroot -psecret --silent"
--health-interval=10s
--health-timeout=5s
--health-retries=10
redis:
image: redis:7-alpine
ports:
- 6379:6379
options: >-
--health-cmd="redis-cli ping"
--health-interval=10s
--health-timeout=5s
--health-retries=10
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
extensions: json, mbstring, pcntl, intl, fileinfo, sockets, mysqli, sqlite3
coverage: xdebug
- name: Setup problem matchers
run: |
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Install dependencies
run: |
composer install --no-interaction --prefer-dist --no-progress --no-suggest
- name: Check code formatting with PHP CS Fixer
run: |
vendor/bin/php-cs-fixer fix --dry-run --diff --ansi
- name: Analyze code statically with PHPStan
run: |
cp .env.example .env.testing
XDEBUG_MODE=off vendor/bin/phpstan --xdebug
- name: Execute tests
run: |
cp .env.example .env.testing
php phenix key:generate .env.testing --force
vendor/bin/phpunit
- name: Prepare paths for SonarQube analysis
run: |
sed -i "s|$GITHUB_WORKSPACE|/github/workspace|g" build/logs/clover.xml
sed -i "s|$GITHUB_WORKSPACE|/github/workspace|g" build/report.junit.xml
- name: Run SonarQube analysis
uses: sonarsource/sonarqube-scan-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}