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
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
30 changes: 30 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
KARIRI_APP_ENV=develop
KARIRI_APP_NAME=KaririCode

KARIRI_PHP_VERSION=8.3
KARIRI_PHP_PORT=9003

KARIRI_APP_DEBUG=false
KARIRI_APP_URL=https://kariricode.com


KARIRI_DB_CONNECTION=mysql
KARIRI_DB_HOST=127.0.0.1
KARIRI_DB_PORT=3306
KARIRI_DB_DATABASE=kariricode
KARIRI_DB_USERNAME=root
KARIRI_DB_PASSWORD=secret

KARIRI_CACHE_DRIVER=redis
KARIRI_SESSION_LIFETIME=120

KARIRI_MAIL_MAILER=smtp
KARIRI_MAIL_HOST=mailhog
KARIRI_MAIL_PORT=1025
KARIRI_MAIL_USERNAME=null
KARIRI_MAIL_PASSWORD=null
KARIRI_MAIL_ENCRYPTION=null
KARIRI_MAIL_FROM_ADDRESS=null
KARIRI_MAIL_FROM_NAME="${KARIRI_APP_NAME}"

KARIRI_JSON_CONFIG={"key": "value", "nested": {"subkey": "subvalue"}}
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
65 changes: 65 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# 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
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
}
Loading