Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 35 additions & 46 deletions .github/workflows/run-tests-with-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,65 +2,54 @@ name: Run tests with coverage

on:
push:
branches: ["development"]
branches: [ "development" ]
pull_request:
branches: ["development"]
branches: [ "development" ]

jobs:
test-with-coverage:
tests-with-coverage:
runs-on: ubuntu-latest
env:
DB_CONNECTION: pgsql
DB_HOST: localhost
DB_PASSWORD: ""
DB_USERNAME: forge
DB_DATABASE: forge
REDIS_HOST: localhost
REDIS_PASSWORD: ""
REDIS_PORT: 6379

services:
postgres:
image: postgres:17.4
env:
POSTGRES_PASSWORD: ""
POSTGRES_USER: forge
POSTGRES_DB: forge
POSTGRES_HOST_AUTH_METHOD: trust
ports:
- 5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis:7.4
env:
ALLOW_EMPTY_PASSWORD: "yes"
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5

strategy:
matrix:
php-version: [ "8.2", "8.3", "8.4" ]
steps:
- uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
extensions: pgsql
- uses: actions/checkout@v3
php-version: ${{ matrix.php-version }}
coverage: xdebug, pcov
tools: composer:v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
- name: Execute unit tests via PHPUnit with coverage
run: vendor/bin/phpunit --coverage-clover build/logs/clover.xml
env:
DB_PORT: ${{ job.services.postgres.ports[5432] }}
- name: Export coverage report
if: ${{ matrix.php-version == '8.4' }}
uses: actions/upload-artifact@v4
with:
name: clover.xml
path: build/logs

upload-to-coveralls:
needs: tests-with-coverage
runs-on: ubuntu-latest
steps:
- uses: shivammathur/setup-php@v2
with:
php-version: "8.4"
tools: composer:v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/download-artifact@v4
with:
name: clover.xml
path: build/logs
- name: Upload coverage results to Coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
composer global require php-coveralls/php-coveralls
php-coveralls --coverage_clover=build/logs/clover.xml -v
php-coveralls --coverage_clover=build/logs/clover.xml -v --json_path=coveralls-upload.json
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"license": "MIT",
"type": "project",
"require": {
"php": "^8.3",
"php": "^8.2",
"ext-openssl": "*",
"laravel/framework": "^12.0",
"laravel/legacy-factories": "^1.4",
Expand Down
Loading
Loading