Skip to content

Commit

Permalink
Up spiral/goridge version (#1)
Browse files Browse the repository at this point in the history
* Up spiral/goridge version
* update gh actions
* Up phpunit, psalm version, add roadrunner-php/roadrunner-api-dto
  • Loading branch information
msmakouz authored Apr 13, 2023
1 parent b02d4e7 commit 59a54c2
Show file tree
Hide file tree
Showing 15 changed files with 213 additions and 106 deletions.
12 changes: 12 additions & 0 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Code of Conduct

The Spiral code of conduct is derived from the Ruby code of conduct.
Any violations of the code of conduct may be reported by email `wolfy-j[at]spiralscout.com`.

- Participants will be tolerant of opposing views.

- Participants must ensure that their language and actions are free of personal attacks and disparaging personal remarks.

- When interpreting the words and actions of others, participants should always assume good intentions.

- Behavior which can be reasonably considered harassment will not be tolerated.
6 changes: 6 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Contributing

Feel free to contribute to the development of the Framework or its components.

For more information on contributing rules you can find on the documentation
page at https://spiral.dev/docs/about-contributing
3 changes: 3 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# These are supported funding model platforms

github: roadrunner-server
23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/1_Bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: 🐛 Bug Report
about: Report errors and problems
labels: Bug

---
### Description

<!-- A clear and concise description of the problem. -->

### How To Reproduce

<!-- Code and/or config needed to reproduce the problem. -->

### Additional Info

| Q | A
|------------------| ---
| Package Version | x.y.z <!-- Please set the package version -->
| PHP version | x.y.z <!-- Please set the PHP version -->
| Operating system | Linux <!-- Please set your OS -->

<!-- Optional: any other context about the problem: log messages, screenshots, etc. -->
14 changes: 14 additions & 0 deletions .github/ISSUE_TEMPLATE/2_Feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
name: 🚀 Feature Request
about: RFC and ideas for new features and improvements
labels: Feature

---
## Description

<!-- A clear and concise description of the new feature. -->

## Example

<!-- A simple example of the new feature in action (include PHP code, YAML config, etc.)
If the new feature changes an existing feature, include a simple before/after comparison. -->
15 changes: 15 additions & 0 deletions .github/ISSUE_TEMPLATE/3_Support_question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
name: ❓ Question
about: Use if you have problems and don't know how to formulate them
labels: Question

---

<!--
We use GitHub issues only to discuss Spiral bugs and new features. In the
case that you have a general question, please use the chat:
- Discord: https://discord.gg/kmmfk7M
Thanks!
-->
10 changes: 10 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
| Q | A
| ------------- | ---
| Bugfix? | ✔️/❌
| Breaks BC? | ✔️/❌
| New feature? | ✔️/❌
| Issues | #... <!-- prefix each issue number with "#" symbol, no need to create an issue if none exist, explain below instead -->
| Docs PR | spiral/docs#... <!-- prefix each issue number with "spiral/docs#", required only for new features -->

<!-- Please, replace this notice by a short description of your feature/bugfix.
This will help people understand your PR and can be used as a start for the documentation. -->
11 changes: 11 additions & 0 deletions .github/SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Security Policy
===============

If you found something which shouldn't be there or a bug which opens a security
hole, please let me know immediately by email `wolfy-j[at]spiralscout.com`.

DO NOT PUBLISH SECURITY REPORTS PUBLICLY.

The full [Security Policy][1] is described in the official documentation.

[1]: https://spiral.dev/docs/about-contributing#critical-security-issues
12 changes: 0 additions & 12 deletions .github/dependabot.yml

This file was deleted.

1 change: 1 addition & 0 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
on:
pull_request: null
push:
branches:
- master
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/psalm.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
on:
pull_request: null
push:
branches:
- master
Expand Down
120 changes: 74 additions & 46 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,48 +1,76 @@
{
"name": "roadrunner-php/lock",
"description": "This package provides a PHP integration package for the RoadRunner Lock plugin, which allows for easy management of distributed locks in PHP applications. The plugin provides a fast, lightweight, and reliable way to acquire, release, and manage locks in a distributed environment, making it ideal for use in high-traffic web applications and microservices.",
"keywords": [
"roadrunner-php",
"spiral",
"lock"
],
"homepage": "https://github.com/roadrunner-php/lock",
"license": "MIT",
"authors": [
{
"name": "butschster",
"email": "[email protected]",
"role": "Developer"
}
],
"require": {
"php": "^8.1",
"ramsey/uuid": "^4.7",
"roadrunner-php/api": "^4.3.1",
"spiral/goridge": "^3.1"
},
"require-dev": {
"mockery/mockery": "^1.5",
"phpunit/phpunit": "^9.5",
"vimeo/psalm": "^4.9"
},
"autoload": {
"psr-4": {
"RoadRunner\\Lock\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"RoadRunner\\Lock\\Tests\\": "tests/src"
}
},
"scripts": {
"test": "vendor/bin/phpunit",
"psalm": "vendor/bin/psalm --config=psalm.xml ./src --show-info=true"
},
"config": {
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable": true
"name": "roadrunner-php/lock",
"type": "library",
"description": "This package provides a PHP integration package for the RoadRunner Lock plugin, which allows for easy management of distributed locks in PHP applications. The plugin provides a fast, lightweight, and reliable way to acquire, release, and manage locks in a distributed environment, making it ideal for use in high-traffic web applications and microservices.",
"keywords": [
"roadrunner-php",
"spiral",
"lock"
],
"homepage": "https://roadrunner.dev/",
"support": {
"docs": "https://roadrunner.dev/docs",
"issues": "https://github.com/roadrunner-server/roadrunner/issues",
"forum": "https://forum.roadrunner.dev/",
"chat": "https://discord.gg/V6EK4he"
},
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/roadrunner-server"
}
],
"license": "MIT",
"authors": [
{
"name": "Anton Titov (wolfy-j)",
"email": "[email protected]"
},
{
"name": "Pavel Buchnev (butschster)",
"email": "[email protected]"
},
{
"name": "Aleksei Gagarin (roxblnfk)",
"email": "[email protected]"
},
{
"name": "Maksim Smakouz (msmakouz)",
"email": "[email protected]"
},
{
"name": "RoadRunner Community",
"homepage": "https://github.com/spiral/roadrunner/graphs/contributors"
}
],
"require": {
"php": "^8.1",
"ramsey/uuid": "^4.7",
"roadrunner-php/roadrunner-api-dto": "^1.0",
"spiral/goridge": "^4.0"
},
"require-dev": {
"mockery/mockery": "^1.5",
"phpunit/phpunit": "^10.0",
"vimeo/psalm": "^5.9"
},
"autoload": {
"psr-4": {
"RoadRunner\\Lock\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"RoadRunner\\Lock\\Tests\\": "tests/src"
}
},
"scripts": {
"test": "vendor/bin/phpunit",
"psalm": "vendor/bin/psalm --config=psalm.xml ./src --show-info=true"
},
"config": {
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable": true
}
69 changes: 32 additions & 37 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,39 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
executionOrder="random"
failOnWarning="true"
failOnRisky="true"
failOnEmptyTestSuite="true"
beStrictAboutOutputDuringTests="true"
verbose="true"
>
<testsuites>
<testsuite name="Scheduler Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<coverage>
<include>
<directory suffix=".php">./src</directory>
</include>
<report>
<html outputDirectory="build/coverage"/>
<text outputFile="build/coverage.txt"/>
<clover outputFile="build/logs/clover.xml"/>
</report>
</coverage>
<logging>
<junit outputFile="build/report.junit.xml"/>
</logging>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd"
backupGlobals="false"
bootstrap="vendor/autoload.php"
colors="true"
processIsolation="false"
stopOnFailure="false"
executionOrder="random"
failOnWarning="true"
failOnRisky="true"
failOnEmptyTestSuite="true"
beStrictAboutOutputDuringTests="true"
cacheDirectory=".phpunit.cache"
backupStaticProperties="false">
<testsuites>
<testsuite name="Lock Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<coverage>
<include>
<directory suffix=".php">./src</directory>
</include>
<report>
<html outputDirectory="build/coverage"/>
<text outputFile="build/coverage.txt"/>
<clover outputFile="build/logs/clover.xml"/>
</report>
</coverage>
<logging>
<junit outputFile="build/report.junit.xml"/>
</logging>
</phpunit>
2 changes: 2 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
findUnusedBaselineEntry="true"
findUnusedCode="false"
>
<projectFiles>
<directory name="src" />
Expand Down
20 changes: 9 additions & 11 deletions tests/src/LockTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,9 @@ public function testExistsWithId(bool $result): void
$this->assertSame($result, $this->lock->exists('resource', 'some-id'));
}

public function lockTypeDataProvider(): \Generator
public static function lockTypeDataProvider(): \Generator
{
foreach ($this->lockDataProvider() as $name => $data) {
foreach (self::lockDataProvider() as $name => $data) {
foreach ([true, false] as $result) {
foreach (['id1', null] as $id) {
yield 'lock: ' . $name . ' | ' .$id. ' | ' . \var_export($result, true) => [
Expand All @@ -191,16 +191,16 @@ public function lockTypeDataProvider(): \Generator
}
}

public function updateTTLDataProvider()
public static function updateTTLDataProvider(): \Traversable
{
foreach ($this->lockDataProvider() as $name => $data) {
foreach (self::lockDataProvider() as $name => $data) {
foreach ([true, false] as $result) {
yield $name . ' | ' . \var_export($result, true) => [$data[0], $data[1], $result];
}
}
}

public function lockDataProvider(): \Generator
public static function lockDataProvider(): \Generator
{
yield 'int' => [10, 10, 8, 8,];

Expand All @@ -212,11 +212,9 @@ public function lockDataProvider(): \Generator
];
}

public function resultDataProvider()
public static function resultDataProvider(): \Traversable
{
return [
[true],
[false],
];
yield [true];
yield [false];
}
}
}

0 comments on commit 59a54c2

Please sign in to comment.