Skip to content

Commit

Permalink
Merge pull request #1 from KaririCode-Framework/develop
Browse files Browse the repository at this point in the history
feat: structured project base for KaririCode Sanitizer
  • Loading branch information
walmir-silva authored Oct 13, 2024
2 parents 1f0c0d3 + 2fbbfd8 commit a775f9a
Show file tree
Hide file tree
Showing 22 changed files with 5,805 additions and 1 deletion.
25 changes: 25 additions & 0 deletions .docker/php/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
ARG PHP_VERSION=8.3

FROM php:${PHP_VERSION}-alpine

# Install system dependencies
RUN apk update && apk add --no-cache \
$PHPIZE_DEPS \
linux-headers \
zlib-dev \
libmemcached-dev \
cyrus-sasl-dev

RUN pecl install xdebug redis memcached \
&& docker-php-ext-enable xdebug redis memcached

# Copy custom PHP configuration
COPY .docker/php/kariricode-php.ini /usr/local/etc/php/conf.d/

# Instalação do Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

RUN apk del --purge $PHPIZE_DEPS && rm -rf /var/cache/apk/*

# Mantém o contêiner ativo sem fazer nada
CMD tail -f /dev/null
14 changes: 14 additions & 0 deletions .docker/php/kariricode-php.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[PHP]
memory_limit = 256M
upload_max_filesize = 50M
post_max_size = 50M
date.timezone = America/Sao_Paulo

[Xdebug]
; zend_extension=xdebug.so
xdebug.mode=debug
xdebug.start_with_request=yes
xdebug.client_host=host.docker.internal
xdebug.client_port=9003
xdebug.log=/tmp/xdebug.log
xdebug.idekey=VSCODE
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
KARIRI_APP_ENV=develop
KARIRI_PHP_VERSION=8.3
KARIRI_PHP_PORT=9003
17 changes: 17 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/.docker export-ignore
/.github export-ignore
/.vscode export-ignore
/tests export-ignore
/vendor export-ignore
/.env export-ignore
/.env.example export-ignore
/.gitignore export-ignore
/.php-cs-fixer.php export-ignore
/.phpcs-cache export-ignore
/docker-compose.yml export-ignore
/phpcs.xml export-ignore
/phpinsights.php export-ignore
/phpstan.neon export-ignore
/phpunit.xml export-ignore
/psalm.xml export-ignore
/Makefile export-ignore
72 changes: 72 additions & 0 deletions .github/workflows/kariri-ci-cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Kariri CI Pipeline

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

jobs:
setup-and-lint:
runs-on: ubuntu-latest
strategy:
matrix:
php: ["8.3"]

steps:
- uses: actions/checkout@v3

- name: Cache Composer dependencies
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Set up PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mbstring, xml
tools: composer:v2, php-cs-fixer, phpunit

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

- name: Validate composer.json
run: composer validate

- name: Coding Standards Check
run: vendor/bin/php-cs-fixer fix --dry-run --diff

unit-tests:
needs: setup-and-lint
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Download Composer Cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Set up PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mbstring, xml
tools: composer:v2, php-cs-fixer, phpunit

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

- name: Run PHPUnit Tests
run: XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-text

- name: Security Check
run: vendor/bin/security-checker security:check
66 changes: 66 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Arquivos de configuração do sistema
/.idea/
*.sublime-project
*.sublime-workspace
/.phpunit.result.cache
/.php_cs.cache
/.php_cs.dist.cache
/phpstan.neon.dist
/phpstan.neon.cache
/.phpstan.result.cache
/.phpcs-cache

# Dependências
/vendor/
/node_modules/

# Arquivos específicos do sistema operacional
.DS_Store
Thumbs.db

# Arquivos de build e compilação
/build/
/dist/
*.log
*.tlog
*.tmp
*.temp

# Arquivos e pastas de ambientes virtuais
.env

# Arquivos de cache
/cache/
*.cache
*.class

# Arquivos de log
*.log
*.sql
*.sqlite

# Pasta de testes que não devem ser incluídas no repositório
coverage/
coverage*

# Arquivos de pacotes
*.jar
*.war
*.ear
*.zip
*.tar.gz
*.rar

# Outros arquivos e pastas
*.swp
*~
._*
temp/
tmp/
.vscode/launch.json
.vscode/extensions.json
tests/lista_de_arquivos.php
tests/lista_de_arquivos_test.php
lista_de_arquivos.txt
lista_de_arquivos_tests.txt
add_static_to_providers.php
69 changes: 69 additions & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?php

$finder = PhpCsFixer\Finder::create()
->in(__DIR__ . '/src')
->in(__DIR__ . '/tests')
->exclude('var')
->exclude('config')
->exclude('vendor');

return (new PhpCsFixer\Config())
->setParallelConfig(new PhpCsFixer\Runner\Parallel\ParallelConfig(4, 20))
->setRules([
'@PSR12' => true,
'@Symfony' => true,
'full_opening_tag' => false,
'phpdoc_var_without_name' => false,
'phpdoc_to_comment' => false,
'array_syntax' => ['syntax' => 'short'],
'concat_space' => ['spacing' => 'one'],
'binary_operator_spaces' => [
'default' => 'single_space',
'operators' => [
'=' => 'single_space',
'=>' => 'single_space',
],
],
'blank_line_before_statement' => [
'statements' => ['return']
],
'cast_spaces' => ['space' => 'single'],
'class_attributes_separation' => [
'elements' => [
'const' => 'none',
'method' => 'one',
'property' => 'none'
]
],
'declare_equal_normalize' => ['space' => 'none'],
'function_typehint_space' => true,
'lowercase_cast' => true,
'no_unused_imports' => true,
'not_operator_with_successor_space' => true,
'ordered_imports' => true,
'phpdoc_align' => ['align' => 'left'],
'phpdoc_no_alias_tag' => ['replacements' => ['type' => 'var', 'link' => 'see']],
'phpdoc_order' => true,
'phpdoc_scalar' => true,
'single_quote' => true,
'standardize_not_equals' => true,
'trailing_comma_in_multiline' => ['elements' => ['arrays']],
'trim_array_spaces' => true,
'space_after_semicolon' => true,
'no_spaces_inside_parenthesis' => true,
'no_whitespace_before_comma_in_array' => true,
'whitespace_after_comma_in_array' => true,
'visibility_required' => ['elements' => ['const', 'method', 'property']],
'multiline_whitespace_before_semicolons' => [
'strategy' => 'no_multi_line',
],
'method_chaining_indentation' => true,
'class_definition' => [
'single_item_single_line' => false,
'multi_line_extends_each_single_line' => true,
],
'not_operator_with_successor_space' => false
])
->setRiskyAllowed(true)
->setFinder($finder)
->setUsingCache(false);
10 changes: 10 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"[php]": {
"editor.defaultFormatter": "junstyle.php-cs-fixer"
},
"php-cs-fixer.executablePath": "${workspaceFolder}/vendor/bin/php-cs-fixer",
"php-cs-fixer.onsave": true,
"php-cs-fixer.rules": "@PSR12",
"php-cs-fixer.config": ".php_cs.dist",
"php-cs-fixer.formatHtml": true
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 KaririCode Framework

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.
1 change: 0 additions & 1 deletion LICENSE.md

This file was deleted.

Loading

0 comments on commit a775f9a

Please sign in to comment.