Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinDev committed Feb 24, 2022
0 parents commit e19d96f
Show file tree
Hide file tree
Showing 32 changed files with 1,937 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/CONTRIBUTING.md
@@ -0,0 +1,4 @@
# Contributing

- Test `composer test`
- Format `composer format`
3 changes: 3 additions & 0 deletions .github/SECURITY.md
@@ -0,0 +1,3 @@
# Security Policy

If you discover any security related issues, please email contact@piedweb.com instead of using the issue tracker.
60 changes: 60 additions & 0 deletions .github/workflows/psalm.yml
@@ -0,0 +1,60 @@
name: 'Static Code Analysis'

on: [push, pull_request]

jobs:
phpstan:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
php: [8.0]
stability: [prefer-stable] #prefer-lowest,

name: PHPStan - P${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }}

steps:
- name: Checkout
uses: actions/checkout@v2

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

- name: Install Composer dependencies (highest)
uses: ramsey/composer-install@v1
with:
dependency-versions: highest
composer-options: --prefer-dist --${{ matrix.stability }} --no-interaction

- name: PHPStan
run: vendor/bin/phpstan --memory-limit=1G analyse --error-format=github --debug

psalm:
name: psalm
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.0"
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
coverage: none

- name: Cache composer dependencies
uses: actions/cache@v2
with:
path: vendor
key: composer-${{ hashFiles('composer.lock') }}

- name: Run composer install
run: composer install -n --prefer-dist

- name: Run psalm
run: ./vendor/bin/psalm --output-format=github --shepherd
49 changes: 49 additions & 0 deletions .github/workflows/run-tests.yml
@@ -0,0 +1,49 @@
name: Tests

on: [push, pull_request]

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest]
php: [8.0, 8.1]
stability: [prefer-stable] #prefer-lowest,

name: P${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }}

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: pecl
extensions: dom, curl, libxml, mbstring, zip, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo, xdebug
#coverage: none

- 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 update --${{ matrix.stability }} --prefer-dist --no-interaction

#- name: Install browsers
# run: vendor/bin/bdi detect drivers

- name: Execute tests
run: vendor/bin/phpunit --coverage-clover coverage.xml


- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
verbose: true
60 changes: 60 additions & 0 deletions .github/workflows/split-monorepo.yaml
@@ -0,0 +1,60 @@
name: Split Monorepo

on: push

jobs:
provide_packages_json:
# see json juggling: https://docs.github.com/en/free-pro-team@latest/actions/reference/context-and-expression-syntax-for-github-actions#example-6
# see https://stackoverflow.com/a/62953566/1348344
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

# required for matrix of packages set
- uses: shivammathur/setup-php@v2
with:
php-version: 8.0
coverage: none

- run: composer install --no-progress --ansi

# get package json list
- id: output_data
run: echo "::set-output name=matrix::$(vendor/bin/monorepo-builder packages-json)"

# this step is needed, so the output gets to the next defined job
outputs:
matrix: ${{ steps.output_data.outputs.matrix }}

split_monorepo:
needs: provide_packages_json

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
package:
- curl

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- # get git previous tag
id: previous_tag
uses: 'WyriHaximus/github-action-get-previous-tag@master'

- # Uses an action in the root directory
name: Monorepo Split of ${{ matrix.package }}
uses: symplify/github-action-monorepo-split@1.1
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
with:
package-directory: 'packages/${{ matrix.package }}'
split-repository-organization: 'piedweb'
split-repository-name: '${{ matrix.package }}'
tag: ${{ steps.previous_tag.outputs.tag }}
user-name: 'RobinDev'
user-email: 'contact@piedweb.com'
30 changes: 30 additions & 0 deletions .gitignore
@@ -0,0 +1,30 @@
# composer
/vendor
composer.lock

# node
/node_modules
node_modules/
/packages/core/node_modules
**/package-lock.json
**/yarn.lock

# dev tool
.phpunit.result.cache
.php_cs.cache
.php-cs-fixer.cache
coverage
coverage.xml
/debug
/debug-container
/drivers
.vs-code

# Future packages
related-pages
bootstrap5-theme

# Ignore assets copied from packages and files generated by tests/docs/dev env
!.gitkeep

Draft.md
46 changes: 46 additions & 0 deletions .php-cs-fixer.dist.php
@@ -0,0 +1,46 @@
<?php

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

return (new PhpCsFixer\Config())
->setRules([
'@PSR12' => true,
'@PSR2' => true,
'@DoctrineAnnotation' => true,
'@Symfony' => true,
'@Symfony:risky' => true,
'array_syntax' => ['syntax' => 'short'],
'array_indentation' => true,
'trim_array_spaces' => true,
'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' => ['const' => 'one','method' => 'one','property' => 'one'],
],
'method_argument_space' => [
'on_multiline' => 'ensure_fully_multiline',
'keep_multiple_spaces_after_comma' => true,
],
'single_trait_insert_per_statement' => true,
'modernize_types_casting' => false, // PHPStan...*
'phpdoc_to_comment' => false, // see here to add use to structural element https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/402b34d4ab33146eaab0f17d60c928eaa7e332b9/src/Tokenizer/Analyzer/CommentsAnalyzer.php#L155
])
->setRiskyAllowed(true)
->setFinder($finder);
4 changes: 4 additions & 0 deletions .prettierrc
@@ -0,0 +1,4 @@
{
"printWidth": 100,
"singleQuote": true
}
47 changes: 47 additions & 0 deletions .scrutinizer.yml
@@ -0,0 +1,47 @@
build:
tests:
override:
- true

nodes:
tests:
environment:
php:
version: 8.0.2
pecl_extensions:
- zip
analysis:
environment:
php:
version: 8.0.2
pecl_extensions:
- zip
tests:
override: [php-scrutinizer-run]
filter:
excluded_paths:
- "*/tests/*"
- "docs/*"
- "packages/skeleton/*"
- "packages/docs/*"

checks:
php:
remove_extra_empty_lines: true
remove_php_closing_tag: true
remove_trailing_whitespace: true
fix_use_statements:
remove_unused: true
preserve_multiple: false
preserve_blanklines: true
order_alphabetically: true
fix_php_opening_tag: true
fix_linefeed: true
fix_line_ending: true
fix_identation_4spaces: true
fix_doc_comments: true

tools:
external_code_coverage:
timeout: 600
runs: 3
21 changes: 21 additions & 0 deletions LICENSE
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 Robin@PiedWeb https://piedweb.com

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
26 changes: 26 additions & 0 deletions README.md
@@ -0,0 +1,26 @@
# PiedWeb's Monorepo

[![Latest Version](https://img.shields.io/github/tag/PiedWeb/PiedWeb.svg?style=flat&label=release)](https://github.com/PiedWeb/PiedWeb/tags)
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat)](LICENSE)
[![GitHub Tests Action Status](https://img.shields.io/github/workflow/status/PiedWeb/PiedWeb/Tests?label=tests)](https://github.com/PiedWeb/PiedWeb/actions)
[![Quality Score](https://img.shields.io/scrutinizer/g/PiedWeb/PiedWeb.svg?style=flat)](https://scrutinizer-ci.com/g/PiedWeb/PiedWeb)
[![Code Coverage](https://codecov.io/gh/PiedWeb/PiedWeb/branch/main/graph/badge.svg)](https://codecov.io/gh/PiedWeb/PiedWeb/branch/main)
[![Type Coverage](https://shepherd.dev/github/PiedWeb/PiedWeb/coverage.svg)](https://shepherd.dev/github/PiedWeb/PiedWeb)
[![Total Downloads](https://img.shields.io/packagist/dt/piedweb/curl.svg?style=flat)](https://packagist.org/packages/piedweb/curl)

## Documentation

- [Curl](packages/curl/src/README.md)

## Credits

- [PiedWeb](https://piedweb.com)
- [All Contributors](https://github.com/PiedWeb/PiedWeb/graphs/contributors)

## License

The MIT License (MIT). Please see [License File](LICENSE) for more information.

<p align="center"><a href="https://dev.piedweb.com" rel="dofollow">
<img src="https://raw.githubusercontent.com/PiedWeb/PiedWeb/f5021f4c5d5d3ab3f2858ec2e4bdd70818806c6a/packages/admin/src/Resources/assets/logo.svg" width="200" height="200" alt="PHP Packages Open Source" />
</a></p>

0 comments on commit e19d96f

Please sign in to comment.