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
32 changes: 32 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: CI

on: [push]

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
php: [8.2, 8.3, 8.4, 8.5]

steps:
- uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none

- name: Install dependencies
run: composer install --prefer-dist --no-progress

# - name: Check code style
# run: composer cs-check

# - name: Run PHPStan
# run: composer stan

# - name: Run tests
# run: composer test
47 changes: 47 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Contributing

Contributions are welcome! Please follow these steps to set up the project and ensure your changes pass all checks before submitting a PR.

## Setup

1. Fork the repository
2. Clone your fork
3. Install dependencies:

```bash
composer install
```

## Available Scripts

| Command | Description |
|---|---|
| `composer cs-check` | Check code style with PHPCS (PSR-12) |
| `composer cs-fix` | Auto-fix code style violations |
| `composer stan` | Run PHPStan static analysis (level 1) |
| `composer test` | Run the test suite (Pest) |
| `composer check` | Run all checks (style, static analysis, tests) |

## Before Submitting a PR

Make sure all checks pass locally:

```bash
composer check
```

This runs the three checks sequentially:

1. **Code style** (`composer cs-check`) — must pass with no violations
2. **Static analysis** (`composer stan`) — must pass with no errors
3. **Tests** (`composer test`) — all tests must pass

If you have code style violations, you can auto-fix most of them:

```bash
composer cs-fix
```

## CI Pipeline

A GitHub Actions CI pipeline runs automatically on every push and pull request targeting `main`. It runs all checks across **PHP 8.2, 8.3, 8.4, and 8.5**.
15 changes: 14 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,19 @@
}
},
"require-dev": {
"pestphp/pest": "^3"
"pestphp/pest": "^3",
"squizlabs/php_codesniffer": "^4.0",
"phpstan/phpstan": "^2.1"
},
"scripts": {
"test": "pest",
"cs-check": "phpcs",
"cs-fix": "phpcbf",
"stan": "phpstan analyse",
"check": [
"@cs-check",
"@stan",
"@test"
]
}
}
136 changes: 134 additions & 2 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0"?>
<ruleset name="Moyasar PHP">
<description>Coding standard for moyasar-php</description>

<arg name="colors"/>
<arg value="p"/>

<file>src/</file>
<file>tests/</file>

<rule ref="PSR12"/>

<!-- Pest config file naturally mixes side effects with declarations -->
<exclude-pattern>tests/Pest.php</exclude-pattern>
</ruleset>
4 changes: 4 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
parameters:
paths:
- src
level: 1
Loading