Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
karam-mustafa committed Dec 30, 2021
1 parent 374c056 commit ca8bad5
Show file tree
Hide file tree
Showing 17 changed files with 322 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/ci-coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: CI-coverage

on: [push]

jobs:
build-test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- uses: php-actions/composer@v5

- name: PHPUnit Tests
uses: php-actions/phpunit@v2
with:
php_extensions: xdebug
bootstrap: vendor/autoload.php
configuration: test/phpunit.xml
args: --coverage-text
env:
XDEBUG_MODE: coverage
TEST_NAME: Scarlett
21 changes: 21 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: CI

on: [push,pull_request]

jobs:
build-test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- uses: php-actions/composer@v5

- name: PHPUnit Tests
uses: php-actions/phpunit@v2
env:
TEST_NAME: Scarlett
with:
bootstrap: vendor/autoload.php
configuration: test/phpunit.xml
args: --coverage-text
23 changes: 23 additions & 0 deletions .github/workflows/php-cs-fixer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Check & fix styling

on: [push,pull_request]

jobs:
php-cs-fixer:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}

- name: Run PHP Code Style Fixer
uses: docker://oskarstark/php-cs-fixer-ga
with:
args: --config=.php-cs-fixer.dist.php --allow-risky=yes

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Fix styling
29 changes: 29 additions & 0 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: PHP Composer

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Validate composer.json and composer.lock
run: composer validate --strict

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
run: composer install --prefer-dist --no-progress
28 changes: 28 additions & 0 deletions .github/workflows/update-changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: "Update Changelog"

on:
release:
types: [released]

jobs:
update:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: main

- name: Update Changelog
uses: stefanzweifel/changelog-updater-action@v1
with:
latest-version: ${{ github.event.release.name }}
release-notes: ${{ github.event.release.body }}

- name: Commit updated CHANGELOG
uses: stefanzweifel/git-auto-commit-action@v4
with:
branch: main
commit_message: Update CHANGELOG
file_pattern: CHANGELOG.md
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/vendor/
39 changes: 39 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

$finder = Symfony\Component\Finder\Finder::create()
->in([
__DIR__ . '/src',
__DIR__ . '/tests',
])
->name('*.php')
->ignoreDotFiles(true)
->ignoreVCS(true);

return (new PhpCsFixer\Config())
->setRules([
'@PSR12' => true,
'array_syntax' => ['syntax' => 'short'],
'ordered_imports' => ['sort_algorithm' => 'alpha'],
'no_unused_imports' => true,
'not_operator_with_successor_space' => true,
'trailing_comma_in_multiline' => true,
'phpdoc_scalar' => true,
'unary_operator_spaces' => true,
'binary_operator_spaces' => true,
'blank_line_before_statement' => [
'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'],
],
'phpdoc_single_line_var_spacing' => true,
'phpdoc_var_without_name' => true,
'class_attributes_separation' => [
'elements' => [
'method' => 'one',
],
],
'method_argument_space' => [
'on_multiline' => 'ensure_fully_multiline',
'keep_multiple_spaces_after_comma' => true,
],
'single_trait_insert_per_statement' => true,
])
->setFinder($finder);
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
v1.1.0
---------
* Some features.

v1.0.0
---------
* First release
Binary file added assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "syrian-open-source/php-package-template",
"description": "Package description",
"license": "MIT",
"keywords": [
"laravel",
"syrian open source"
],
"authors": [
{
"name": "Karam Mustafa",
"email": "[email protected]",
"homepage": "https://github.com/karam-mustafa",
"role": "Developer"
}
],
"require": {
"phpunit/phpunit": "^9.5",
"friendsofphp/php-cs-fixer": "^3.0"
},
"autoload" : {
"psr-4": {
"SOS\\LaravelPackageTemplate\\" : "src",
"SOS\\LaravelPackageTemplate\\Tests\\": "src/tests"
}
},
"scripts": {
"test": "vendor/bin/phpunit",
"test-coverage": "phpunit --coverage-html coverage",
"format": "vendor/bin/php-cs-fixer fix --allow-risky=yes"
},
"minimum-stability": "dev",
"prefer-stable": true
}
6 changes: 6 additions & 0 deletions docs/feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Usage
--------
We recommend that you code with clean principles and separate responsibilities as possible, to maintain quality documentation, use, maintenance and testing.
```php
// your php code
```
13 changes: 13 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false" backupStaticAttributes="false" colors="true" verbose="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage>
<include>
<directory suffix=".php">src/</directory>
</include>
</coverage>
<testsuites>
<testsuite name="Spatie Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
</phpunit>
7 changes: 7 additions & 0 deletions src/Abstracts/AbstractToBuild.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace SOS\LaravelPackageTemplate\Classes;

class AbstractToBuild
{
}
46 changes: 46 additions & 0 deletions src/Classes/ClassToBuild.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

namespace SOS\LaravelPackageTemplate\Classes;

/**
* Class ClassToBuild
*
* @author your name
* @package SOS\MultiProcess\Classes
*/
class ClassToBuild
{
/**
* description
*
* @author your name
* @var
*/
private $example;

/**
* description
*
* @return mixed
* @author your name
*/
public function getExample()
{
return $this->example;
}

/**
* description
*
* @param mixed $example
*
* @return ClassToBuild
* @author your name
*/
public function setExample($example)
{
$this->example = $example;

return $this;
}
}
7 changes: 7 additions & 0 deletions src/Interfaces/ClassToBuildInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace SOS\LaravelPackageTemplate\Interfaces;

interface ClassToBuildInterface
{
}
18 changes: 18 additions & 0 deletions tests/BaseTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace SOS\LaravelPackageTemplate\Tests;

use Orchestra\Testbench\TestCase as OrchestraTestCase;

class BaseTest extends OrchestraTestCase
{
/**
* description
*
* @author your name
*/
public function test_base_test()
{
$this->assertTrue(true);
}
}
20 changes: 20 additions & 0 deletions tests/Feature/ExampleTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace SOS\LaravelPackageTemplate\Tests\Feature;

use SOS\LaravelPackageTemplate\Tests\BaseTest;

class ExampleTest extends BaseTest
{
/**
* descriptions
*
* @return void
* @throws \Exception
*
*/
public function test_your_function_use_case()
{
$this->assertTrue(true);
}
}

0 comments on commit ca8bad5

Please sign in to comment.