Skip to content

Commit

Permalink
Adiciona roadrunner na applicação
Browse files Browse the repository at this point in the history
  • Loading branch information
lpirola committed May 15, 2024
1 parent f504c06 commit 5fc9288
Show file tree
Hide file tree
Showing 172 changed files with 93,615 additions and 10,735 deletions.
4 changes: 2 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
RR_VERSION=2024.1.0
PHP_IMAGE_VERSION=8.1-cli-alpine
RR_VERSION=2024.1.1
PHP_IMAGE_VERSION=8.3-cli-alpine

46 changes: 0 additions & 46 deletions .github/workflows/ci.yml

This file was deleted.

45 changes: 0 additions & 45 deletions .github/workflows/cicd-dev.yml

This file was deleted.

106 changes: 26 additions & 80 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,89 +1,35 @@
name: Testing
name: Test

on:
push:
branches:
- "master"
- "develop"
pull_request:
branches:
- "develop"
- main

jobs:
php:
strategy:
matrix:
operating-system: [ubuntu-latest]
php-versions: ['8.2']
runs-on: ${{ matrix.operating-system }}
build-test:
runs-on: ubuntu-latest

steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Composer Install
run: docker run --rm -v $PWD:/app composer:latest install
-
name: Docker Compose
uses: KengoTODA/actions-setup-docker-compose@v1
- name: Checkout Code
uses: actions/checkout@v2

- name: Install composer and dependencies
uses: php-actions/composer@v6
with:
version: '2.14.2' # the full version of `docker-compose` command
- run: docker compose up -d
-
name: Database Migrations
run: sleep 5 && docker compose run --rm migrations
-
name: Phpunit Coverage
run: docker compose exec backend ./vendor/bin/phpunit --coverage-text
# -
# name: deploy to cluster
# uses: steebchen/kubectl@v2.0.0
# with: # defaults to latest kubectl binary version
# config: ${{ secrets.KUBE_CONFIG_DATA }}
# command: set image --record deployment/mapasculturais -nredelivre-mapas-dev container=${{ github.repository }}:${{ github.sha }}
php_extensions: xdebug zip sockets pdo_pgsql intl opcache xml curl iconv xmlwriter simplexml
- name: PHPUnit Tests
uses: php-actions/phpunit@v3
env:
XDEBUG_MODE: coverage
with:
bootstrap: vendor/autoload.php
configuration: phpunit.xml
php_extensions: xdebug zip sockets pdo_pgsql intl opcache xml curl iconv xmlwriter simplexml
args: tests --coverage-clover ./coverage.xml

# Docs: https://github.com/shivammathur/setup-php
# -
# name: Setup PHP
# uses: shivammathur/setup-php@v2
# with:
# php-version: ${{ matrix.php-versions }}
# extensions: mbstring, dom, pdo_pgsql, gd, intl, zip, opcache, xml, curl, iconv, xmlwriter, simplexml
# coverage: none # xdebug
# tools: composer
# -
# name: Get composer cache directory
# id: composer-cache
# run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
# -
# name: Cache composer dependencies
# uses: actions/cache@v3
# with:
# path: ${{ steps.composer-cache.outputs.dir }}
# # Use composer.json for key, if composer.lock is not committed.
# # key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
# restore-keys: ${{ runner.os }}-composer-
# -
# name: Install dependencies
# run: composer install --no-progress --prefer-dist --optimize-autoloader
# -
# name: Add hosts to /etc/hosts
# run: |
# sudo echo "127.0.0.1 db redis" | sudo tee -a /etc/hosts
# -
# name: Docker compose up
# uses: isbang/compose-action@v1.5.1
# with:
# compose-file: "./docker-compose.yml"
# down-flags: "--volumes"
# services: |
# db
# redis
# migrations
# -
# name: Test with phpunit
# run: docker compose exec backend ls ./vendor/
# -
# name: Test with phpunit
# run: docker compose exec backend ./vendor/bin/phpunit --coverage-text
- name: Upload to Codecov
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODE_COV_TOKEN }}
files: ./coverage.xml
verbose: true
2 changes: 1 addition & 1 deletion .gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
# Learn more from ready-to-use templates: https://www.gitpod.io/docs/introduction/getting-started/quickstart

tasks:
- init: docker compose -f dev/docker-compose.yml up -d
- init: docker compose -f dev/docker-compose.yml up -d && cd src && pnpm i && pnpm run build
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ public function __construct(ResponseFactoryInterface $responseFactory)
$this->responseFactory = $responseFactory;
}

public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface {
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
try {
return $handler->handle($request);
} catch (HttpNotFoundException $e) {
Expand All @@ -34,4 +35,4 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
return $response;
}
}
}
}
12 changes: 9 additions & 3 deletions app/src/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@

declare(strict_types=1);


namespace App;

// use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\HttpKernel\Kernel as BaseKernel;

// use MicroKernelTrait;

use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Exception\MethodNotAllowedException;
Expand All @@ -12,15 +18,15 @@
use Symfony\Component\Routing\RequestContext;
use Symfony\Component\Routing\RouteCollection;

class Kernel
class Kernel extends BaseKernel
{
private string $url;
private RouteCollection $routes;

public function __construct()
{
$this->url = $this->getPathRequest();
$this->routes = require_once dirname(__DIR__).'/routes/routes.php';
$this->routes = require_once dirname(__DIR__) . '/routes/routes.php';
}

public function execute(): void
Expand All @@ -35,7 +41,7 @@ public function execute(): void
$this->dispatchAction($matcher);
} catch (MethodNotAllowedException $exception) {
(new JsonResponse([
'error' => 'Method not allowed: '.$_SERVER['REQUEST_METHOD'],
'error' => 'Method not allowed: ' . $_SERVER['REQUEST_METHOD'],
], status: Response::HTTP_METHOD_NOT_ALLOWED))->send();

exit;
Expand Down
Loading

0 comments on commit 5fc9288

Please sign in to comment.