Skip to content
Merged
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
46 changes: 46 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Coverage

on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
workflow_dispatch:

jobs:
coverage:
runs-on: ubuntu-latest

name: Coverage (PHP 8.4 - Laravel 12)

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.4
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv
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 remove "crescat-io/saloon-sdk-generator" "larastan/larastan" "laravel/boost" "laravel/pint" --dev --no-interaction
composer require "laravel/framework:12.*" "saloonphp/laravel-plugin" --no-interaction --no-update
composer update --prefer-dist --no-interaction

- name: Run tests with coverage
run: ./vendor/bin/pest --coverage --coverage-clover coverage.xml

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
files: ./coverage.xml
fail_ci_if_error: false
verbose: true
6 changes: 5 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ jobs:
- name: Install dependencies
run: |
composer remove "crescat-io/saloon-sdk-generator" "larastan/larastan" "laravel/boost" "laravel/pint" --dev --no-interaction
composer require "laravel/framework:${{ matrix.laravel }}" " saloonphp/laravel-plugin" --no-interaction --no-update
if [[ "${{ matrix.laravel }}" == "10.*" ]]; then
composer require "laravel/framework:${{ matrix.laravel }}" "saloonphp/laravel-plugin:^3.5.0" --no-interaction --no-update
else
composer require "laravel/framework:${{ matrix.laravel }}" "saloonphp/laravel-plugin" --no-interaction --no-update
fi
composer update --prefer-dist --no-interaction

- name: Run Pest tests
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Timatic PHP SDK

[![Tests](https://github.com/Timatic/timatic-php-sdk/actions/workflows/tests.yml/badge.svg)](https://github.com/Timatic/timatic-php-sdk/actions/workflows/tests.yml)
[![codecov](https://codecov.io/gh/Timatic/timatic-php-sdk/branch/main/graph/badge.svg)](https://codecov.io/gh/Timatic/timatic-php-sdk)
[![Code Style](https://github.com/Timatic/timatic-php-sdk/actions/workflows/code-style.yml/badge.svg)](https://github.com/Timatic/timatic-php-sdk/actions/workflows/code-style.yml)
[![Static Analysis](https://github.com/Timatic/timatic-php-sdk/actions/workflows/static-analysis.yml/badge.svg)](https://github.com/Timatic/timatic-php-sdk/actions/workflows/static-analysis.yml)

Expand Down Expand Up @@ -245,7 +246,11 @@ The SDK uses a custom `JsonApiDtoGenerator` that:
### Running Tests

```bash
# Run tests
composer test

# Run tests with code coverage
composer coverage
```

## License
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
],
"scripts": {
"test": "pest",
"coverage": "pest --coverage --coverage-clover coverage.xml",
"format": "pint",
"analyse": "phpstan analyse --memory-limit=2G",
"regenerate": [
Expand Down