Skip to content

fix: set name in to preiview in create method, add relative path to d… #267

fix: set name in to preiview in create method, add relative path to d…

fix: set name in to preiview in create method, add relative path to d… #267

name: Run tests with coverage
on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
jobs:
tests-with-coverage:
runs-on: ubuntu-latest
env:
DB_CONNECTION: pgsql
DB_HOST: 127.0.0.1
DB_PORT: 5432
DB_DATABASE: forge
DB_USERNAME: forge
DB_PASSWORD: secret
services:
postgres:
image: postgres
env:
POSTGRES_DB: forge
POSTGRES_USER: forge
POSTGRES_PASSWORD: secret
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
extensions: mbstring, pdo, pdo_pgsql, gd, dom, fileinfo, pgsql
coverage: xdebug
env:
POSTGRES_HOST: postgres
POSTGRES_PORT: 5432
- name: Set up PostgreSQL
run: |
sudo apt-get update
sudo apt-get install -y postgresql-client
psql --version
- name: Wait for PostgreSQL
run: |
echo "Waiting for PostgreSQL to be ready..."
for i in {1..30}; do
if pg_isready -h 127.0.0.1 -p 5432 -U forge -d forge; then
echo "PostgreSQL is ready"
exit 0
fi
echo "Waiting for PostgreSQL..."
sleep 2
done
echo "PostgreSQL failed to start"
exit 1
- name: Install Composer dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
- name: Run PHPUnit tests with coverage
run: php -d xdebug.mode=coverage vendor/bin/phpunit --coverage-clover=build/logs/clover.xml --stop-on-failure ./tests/
- name: Upload coverage results to Coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: php vendor/bin/php-coveralls --coverage_clover=build/logs/clover.xml -v