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
38 changes: 33 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ name: CI
on:
push:
branches-ignore:
- develop
- main
- main # main is never pushed to directly; releases are tag-driven
tags:
- '*'
pull_request:
Expand Down Expand Up @@ -62,17 +61,46 @@ jobs:
test-namespace: 'PayplugPluginCore\tests\'

# -----------------------------------------------------------------------
# 5. PACKAGE — zip and store the artifact on PR merged → develop
# 5. PUSH-DIST — push transpiled code to dist/{php-target}/{branch}
# Runs in parallel with validate, as soon as downgrade succeeds.
# On feature branch push → dist/php72/feature/xxxx
# On push to develop → dist/php72/develop
# -----------------------------------------------------------------------
push-dist:
if: github.ref_type != 'tag' && github.event.action != 'closed'
needs: validate
permissions:
contents: write
uses: payplug/template-ci/.github/workflows/php72-push-dist.yml@main
with:
artifact-name: 'payplug-core-php72'
source-branch: ${{ github.head_ref || github.ref_name }}
php-target: 'php72'

# -----------------------------------------------------------------------
# 6. PACKAGE — zip and store the artifact on PR merged → develop
# -----------------------------------------------------------------------
package:
if: github.event_name == 'pull_request' && github.event.pull_request.merged == true
if: github.ref_type != 'tag' && github.event.action != 'closed'
uses: payplug/template-ci/.github/workflows/php-package.yml@main
with:
php-version: '8.4'
zip-prefix: 'payplug-plugin-core-php72'

# -----------------------------------------------------------------------
# 6. RELEASE — create a GitHub Release from a tag on main
# 7. CLEANUP-DIST — delete dist/php72/feature/xxxx when PR is merged
# -----------------------------------------------------------------------
cleanup-dist:
if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true
permissions:
contents: write
uses: payplug/template-ci/.github/workflows/php72-delete-dist.yml@main
with:
source-branch: ${{ github.head_ref }}
php-target: 'php72'

# -----------------------------------------------------------------------
# 8. RELEASE — create a GitHub Release from a tag on main
# -----------------------------------------------------------------------
release:
if: github.event_name == 'push' && github.ref_type == 'tag'
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ vendor

# PHPStan
var/
/
payplug-core/
.claude
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:8.4-cli
FROM php:8.1-cli

# Install system dependencies
RUN apt-get update && apt-get install -y \
Expand Down
26 changes: 18 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,32 +25,42 @@ update:
$(PHP) composer update

## Quality
test:
$(PHP) vendor/bin/phpunit
test-unit:
$(PHP) vendor/bin/phpunit tests

test-unit-inte:
$(PHP) vendor/bin/phpunit tests --group integration

test-unit-units:
$(PHP) vendor/bin/phpunit tests --group units

tu-dep:
$(PHP) vendor/bin/phpunit tests --display-phpunit-deprecations

stan:
$(PHP) vendor/bin/phpstan analyse

lint:
cs-lint:
$(PHP) vendor/bin/php-cs-fixer fix --diff --dry-run

fix:
cs-fix:
$(PHP) vendor/bin/php-cs-fixer fix

rector-dry:
$(PHP) vendor/bin/rector process --dry-run

## Release (downgrade src/ to PHP 7.2 into release/)
## Release (downgrade src/ to PHP 7.2 into payplug-core/)
release:
rm -rf payplug-core && cp -r src payplug-core && cp -r tests payplug-core
$(PHP) vendor/bin/rector process
rm -rf payplug-core && mkdir payplug-core && cp -r src payplug-core/ && cp -r tests payplug-core/
$(PHP) vendor/bin/rector process --config rector.php
$(PHP) php scripts/generate-release-composer.php

## Debug (Xdebug step-debug enabled)
debug:
$(PHP_DEBUG) bash

## CI (runs all checks)
ci: stan lint test
ci: stan cs-lint test-unit

install: build update comp-install

Expand Down
14 changes: 14 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,17 @@ Module core for Payplug integration. Enables management of payments, merchants,

## Next step Dev :
- [ ] Develop endpoint to create a payment link


## Quick start:

```bash
composer install # Hooks are installed automatically
composer cs:fix # Manual code formatting
composer hooks:install # Reinstall hooks if needed
composer hooks:install # Reinstall hooks if needed

composer phpunit:unit # Run only unitary phpUnit tests
composer phpunit:inte # Run only integration phpUnit tests
composer phpunit:all # Run all phpUnit tests
```
2 changes: 1 addition & 1 deletion captainhook.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
{
"action": "\\CaptainHook\\App\\Hook\\Branch\\Action\\EnsureNaming",
"options": {
"regex": "/^(feature|fix|hotfix|refactor|release)\\/(PRE|MAG|SYL|SMP)-\\d+/"
"regex": "/^(feature|fix|hotfix|refactor|release)\\/(PRE|MAG|SYL|SMP)-\\d+(-[a-z0-9]+)*$/"
}
},
{
Expand Down
19 changes: 12 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,17 @@
}
],
"require": {
"php": ">=8.4",
"php": ">=8.1",
"captainhook/captainhook": "^5.28",
"payplug/payplug-php": "^4.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.0",
"mockery/mockery": "^1.6",
"phpstan/phpstan": "^2.0",
"phpunit/phpunit": "^11.0",
"phpstan/phpstan-mockery": "*",
"phpstan/phpstan-phpunit": "*",
"phpunit/phpunit": "^10.0",
"rector/rector": "^2.0"
},
"autoload": {
Expand All @@ -28,20 +31,22 @@
},
"autoload-dev": {
"psr-4": {
"PayplugPluginCore\\tests\\": "tests/"
"PayplugPluginCore\\Tests\\": "tests/"
}
},
"scripts": {
"post-install-cmd": "vendor/bin/captainhook install --force --skip-existing",
"post-update-cmd": "vendor/bin/captainhook install --force --skip-existing",
"test": "vendor/bin/phpunit",
"test": "vendor/bin/phpunit tests",
"test-unit": "vendor/bin/phpunit tests --group unit",
"test-inte": "vendor/bin/phpunit tests --group integration",
"stan": "vendor/bin/phpstan analyse --configuration=phpstan.neon",
"lint": "vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php --dry-run --diff",
"fix": "vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php",
"cs-lint": "vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php --dry-run --diff",
"cs-fix": "vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php",
"rector": "vendor/bin/rector process",
"rector-dry": "vendor/bin/rector process --dry-run",
"release": [
"rm -rf payplug-core && cp -r src payplug-core && cp -r tests payplug-core",
"rm -rf payplug-core && mkdir payplug-core && cp -r src payplug-core/ && cp -r tests payplug-core/",
"vendor/bin/rector process --config rector.php",
"php scripts/generate-release-composer.php"
]
Expand Down
Loading
Loading