Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Módulo de relatório do Produto Mapas compatível com os requisitos do portal Transferegov.br #577

Open
wants to merge 49 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
eabbe45
feat: cria estrutura mínima do módulo de plano de trabalho
vicmagpac Oct 16, 2024
0429280
feat: refatora e atualiza escopo nome dos metadados
vicmagpac Oct 25, 2024
3c67692
feat: atualiza configurações do plano de trabalho no gerenciamento da…
vicmagpac Nov 1, 2024
8ef8364
feat: inicia criação do componente de cadastro do plano de trabalho n…
vicmagpac Nov 1, 2024
4e56931
feat: define estrutura mínima das metas na inscrição
vicmagpac Nov 4, 2024
f86a8f7
feat: adiciona novo campo de segmento cultural no plano de trabalho e…
vicmagpac Nov 4, 2024
078df46
feat: adiciona fluxo inicial de entregas nas metas
vicmagpac Nov 4, 2024
35045b6
feat: adiciona gerenciamento de entregas para as metas
vicmagpac Nov 4, 2024
9a7a146
feat: configura fields quando moeda nas metas e entregas
vicmagpac Nov 4, 2024
9148c49
feat: configura css das metas e entregas
vicmagpac Nov 4, 2024
ea6e8f4
feat: reimplementa formulário de configuração do plano de trabalho na…
vicmagpac Nov 4, 2024
47e8765
feat: limpa campos quando entregas vinculadas a meta são desativadas
vicmagpac Nov 4, 2024
a822f73
feat: adiciona collapse para plano de trabalho
vicmagpac Nov 5, 2024
cc3a630
feat: add estrutura minima com doctrine
vicmagpac Nov 5, 2024
8755423
feat: add crud básico para plano, metas e entregas
vicmagpac Nov 7, 2024
a7d2c34
Move configuraçoẽs de dependências nodejs para raiz
lpirola Oct 8, 2024
107dd99
Organiza os serviços no docker compose por processo: web, execute-job…
lpirola Oct 8, 2024
af2d243
Adiciona Nix Pack como padrão de iamgem docker para nginx, php e nodejs
lpirola Oct 8, 2024
a4196b6
feat: cria db updates do plano de trabalho
vicmagpac Nov 7, 2024
f329e61
feat: muda estrutura das entidades e metadados
vicmagpac Nov 7, 2024
4445589
feat: adiciona fluxo nos controladores
vicmagpac Nov 7, 2024
06ad0ec
feat: cria metadados das novas entidades
vicmagpac Nov 7, 2024
1d2363a
feat: deixa permanente diretório assets do module
vicmagpac Nov 7, 2024
c8764ee
feat: limpa classes não usadas e renomeia entidades
vicmagpac Nov 8, 2024
727536c
feat: configura limitação máxima do projeto para a meta
vicmagpac Nov 9, 2024
a42c815
feat: aplica regra etapa fazer cultural, valor da meta e limitar nume…
vicmagpac Nov 9, 2024
6fae6c0
feat: aplica regras de configuração do plano na configuração da oport…
vicmagpac Nov 9, 2024
4b6261d
feat: add validação plano de trabalho, metas e entregas
vicmagpac Nov 9, 2024
1976720
feat: add fluxo gerenciamento de plano de trabalho na inscrição
vicmagpac Nov 11, 2024
ccd2def
feat: ajusta nome do hook vazio entity registration na validação
vicmagpac Nov 11, 2024
7c70b9d
feat: add validação do plano de trabalho e metas quando enviado a reg…
vicmagpac Nov 11, 2024
ad0c9e6
feat: add form abaixo do de inscrição e remove validação de entrega q…
vicmagpac Nov 11, 2024
6648064
feat: carrega options dos campos selects vindo dos matadados
vicmagpac Nov 12, 2024
6427cdc
feat: melhora mensagens de validação
vicmagpac Nov 12, 2024
86b0c16
feat: adiciona cascade nas dependências da tabela registration
vicmagpac Nov 12, 2024
5a07b98
feat: add hook registration view detalhes
vicmagpac Nov 18, 2024
e89c8b8
feat: adiciona acompanhamento do plano de trabalho nos detalhes da in…
vicmagpac Nov 18, 2024
307b614
Adiciona comandos make como atalhos para devops
lpirola Oct 10, 2024
135417f
feat: valida entregas no backend quando habilitada na oportunidade
vicmagpac Nov 19, 2024
64c1bb6
feat: implementa toggle collapse para as metas na inscrição
vicmagpac Nov 19, 2024
8c3ab20
feat: atualiza options da etapa do fazer cultural
vicmagpac Nov 20, 2024
0aa544f
Adiciona teste básico com phpunit no App
lpirola Nov 12, 2024
b290549
Adiciona teste básico com phpunit no Theme
lpirola Nov 13, 2024
25d6698
Melhora a cobertura de testes com phpunit
lpirola Nov 14, 2024
7348d9f
Adiciona suporte ao github actions e packages
lpirola Nov 20, 2024
da83213
Corrige os testes funcionais no phpunit
lpirola Nov 22, 2024
58a06f9
Merge branch 'feature/plano-de-trabalho-doctrine' into feature/docker…
lpirola Nov 22, 2024
58c138d
Adiciona atalho para importar plano de trabalho
lpirola Nov 22, 2024
58a9ca4
Adiciona plugin para sincronização dos planos de ação do transferegov
lpirola Nov 22, 2024
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
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
dev
var/*/*
node_modules
vendor
38 changes: 38 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
PORT=80
BUILD_ASSETS=0
DATABASE_URL=postgresql://mapas:mapas@database:5432/mapas?serverVersion=14&charset=utf8
DATADIR=/opt/postgres/data
GOOGLE_RECAPTCHA_SECRET=6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe
GOOGLE_RECAPTCHA_SITEKEY=6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI
JOBS_INTERVAL=5
MAILER_FROM=sysadmin@localhost
MAILER_TRANSPORT=smtp://mailhog:1025
MC_UPDATES_PROCESSES=1
NUM_PROCESSES=1
PENDING_PCACHE_RECREATION_INTERVAL=5
POSTGRES_DB=mapas
POSTGRES_PASSWORD=mapas
POSTGRES_USER=mapas
PWA_UPSTREAM=pwa:3000
#REDIS_CACHE=redis://redis:6379
SERVER_NAME=http://
SESSIONS_SAVE_PATH=/app/var/sessions
TRUSTED_HOSTS=^${SERVER_NAME:-example\.com|localhost} | php$$
TRUSTED_PROXIES=127.0.0.0/8,10.0.0.0/8,172.17.0.0/12,192.168.0.0/16
DB_HOST=database
APP_ENV=development
XDEBUG_MODE=off
APP_MODE=development
# APP_RUNTIME=Runtime\\FrankenPhpSymfony\\Runtime
NIXPACKS_PHP_ROOT_DIR=/app/public
NIXPACKS_PHP_FALLBACK_PATH=/index.php

SITE_NAME=Mapas v7
SITE_DESCRIPTION=Mapas Culturais é uma plataforma colaborativa que reúne informações sobre agentes, espaços, eventos e projetos culturais, fornecendo ao poder público uma radiografia da área de cultura e ao cidadão um mapa de espaços e eventos culturais da região. A plataforma está alinhada ao Sistema Nacional de Informação e Indicadores Culturais do Ministério da Cultura (SNIIC) e contribui para a realização de alguns dos objetivos do Plano Nacional de Cultura.
LOGO_TITLE=
LOGO_SUBTITLE=
LOGO_IMAGE=
AUTH_EMAIL_IMAGE=
AUTH_LOGIN_ON_REGISTER=true
STATUS_CREATE_AGENT=1
AUTH_LOGIN_BY_CPF=false
177 changes: 155 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
name: ci

on:
push:
branches:
- "master"
- "develop"
- "feature*"
tags:
- "v*.*.*"
pull_request:
branches:
- "develop"
workflow_dispatch:

permissions:
contents: read
packages: write
id-token: write
security-events: write
actions: read
checks: read
statuses: read

jobs:
docker:
CODE_PUBLISH:
runs-on: ubuntu-latest
steps:
-
Expand All @@ -23,44 +31,169 @@ jobs:
id: meta
uses: docker/metadata-action@v4
with:
# list of Docker images to use as base name for tags
images: |
docker.io/hacklab/mapasculturais
# ghcr.io/username/app
# generate Docker tags based on the following events/attributes
ghcr.io/redemapas/mapas
tags: |
type=raw,value=latest,enable=${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}
type=ref,event=branch
type=raw,value=pr-${{ github.event.pull_request.number }}
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# -
# name: Login to GHCR
# name: Login to Docker Hub
# if: github.event_name != 'pull_request'
# uses: docker/login-action@v2
# with:
# registry: ghcr.io
# username: ${{ github.repository_owner }}
# password: ${{ secrets.GITHUB_TOKEN }}
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Login to GHCR
# if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Build and push
uses: docker/build-push-action@v4
with:
file: ./docker/Dockerfile
context: .
push: ${{ github.event_name != 'pull_request' }}
file: .nixpacks/Dockerfile
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

CODE_STYLE_FIXER:
name: CODE STYLE CS FIXER
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Run PHP-CS-Fixer
uses: erkenes/php-cs-fixer-action@main
with:
args: '--dry-run --diff -vvv'

CODE_STYLE_PSALM:
name: CODE SECURITY
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Run Psalm
uses: docker://ghcr.io/psalm/psalm-github-actions
with:
composer_require_dev: true
composer_ignore_platform_reqs: true
security_analysis: true
report_file: results.sarif
- name: Upload Security Analysis results to GitHub
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: results.sarif

CODE_TESTS:
name: CODE TESTS
timeout-minutes: 15
runs-on: ubuntu-latest
steps:
- name: Baixando codigo
uses: actions/checkout@v4
with:
submodules: recursive
# See https://github.com/pnpm/action-setup
- name: Install pnpm
uses: pnpm/action-setup@v4
# See https://github.com/actions/setup-node
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
# cache-dependency-path: ./pnpm-lock.yaml
- run: pnpm i
- run: pnpm run build
- name: Configuração de valores padrões
run: |
cp .env.sample .env

- uses: hoverkraft-tech/[email protected]
with:
compose-file: |
docker-compose.yml
docker-compose.dev.yml
services: "backend"
up-flags: "-d --wait"
down-flags: "-v"

- name: Atualização da estrutura do banco de dados
run: |
make db-restore
make init
make init_dev
make db-migrations
env:
APP_MODE: development

- name: Testes Unitários com PhpUnit
run: |
make test-backend

- name: Upload to Codecov
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
verbose: true

# - name: Testes de integração com Cypress
# uses: cypress-io/github-action@v6
# with:
# config: '{"e2e":{"viewportWidth":375,"viewportHeight":667}}'
# wait-on: "http://localhost:4242"
# wait-on-timeout: 120
# browser: chrome
# # record: false
# # parallel: true
# # group: "UI - Chrome - Mobile"
# config-file: cypress/cypress.config.js
# env:
# # CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID }}
# # CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
# # Recommended: pass the GitHub token lets this action correctly
# # determine the unique run id necessary to re-run the checks
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
#
# - name: Save build folder
# uses: actions/upload-artifact@v4
# with:
# name: screenshots
# if-no-files-found: error
# path: src/cypress/screenshots
# - name: Install composer and dependencies
# uses: php-actions/composer@v6
# with:
# php_extensions: pdo_pgsql zip intl gd mbstring curl xml

# - name: PHPUnit Tests Mapas
# uses: php-actions/phpunit@v3
# env:
# XDEBUG_MODE: coverage
# with:
# version: 10.5
# php_version: 8.2
# configuration: phpunit.xml
# php_extensions: pdo_pgsql zip intl gd mbstring curl xml
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ src/themes/BaseV1/assets/css/main.css
src/themes/BaseV1/assets/css/main.css.map
**/.env
!/dev/.env
.phpunit*
*.phar
*.php-cs-fixer.cache
*coverage.xml
35 changes: 35 additions & 0 deletions .nixpacks/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
FROM ghcr.io/railwayapp/nixpacks:ubuntu-1727136237

ENTRYPOINT ["/bin/bash", "-l", "-c"]
WORKDIR /app/


COPY .nixpacks/nixpkgs-dbc4f15b899ac77a8d408d8e0f89fa9c0c5f2b78.nix .nixpacks/nixpkgs-dbc4f15b899ac77a8d408d8e0f89fa9c0c5f2b78.nix
RUN nix-env -if .nixpacks/nixpkgs-dbc4f15b899ac77a8d408d8e0f89fa9c0c5f2b78.nix && nix-collect-garbage -d

COPY .nixpacks/assets /assets/
ARG NIXPACKS_METADATA NIXPACKS_PHP_FALLBACK_PATH NIXPACKS_PHP_ROOT_DIR PORT POST_MAX_SIZE UPLOAD_MAX_FILESIZE
ENV NIXPACKS_METADATA=$NIXPACKS_METADATA NIXPACKS_PHP_FALLBACK_PATH=$NIXPACKS_PHP_FALLBACK_PATH NIXPACKS_PHP_ROOT_DIR=$NIXPACKS_PHP_ROOT_DIR PORT=$PORT POST_MAX_SIZE=$POST_MAX_SIZE UPLOAD_MAX_FILESIZE=$UPLOAD_MAX_FILESIZE

# setup phase
COPY . /app/.
RUN PHP_INI_PATH=$(php --ini | grep "Additional .ini files parsed:" | cut -d: -f2 | tr -d " "); echo "PHP_INI_PATH is $PHP_INI_PATH"; echo "upload_max_filesize=128M" >> $PHP_INI_PATH; echo "post_max_size=128M" >> $PHP_INI_PATH; echo "Content of php.ini below:"; cat "$PHP_INI_PATH"

# install phase
COPY . /app/.
RUN mkdir -p /var/log/nginx && mkdir -p /var/cache/nginx
RUN composer install --ignore-platform-reqs
RUN pnpm i --frozen-lockfile

# build phase
COPY . /app/.
RUN pnpm run build





# start
COPY . /app
CMD ["node /assets/scripts/prestart.mjs /assets/nginx.template.conf /nginx.conf && (php-fpm -y /assets/php-fpm.conf & nginx -c /nginx.conf)"]

73 changes: 73 additions & 0 deletions .nixpacks/assets/nginx.template.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
worker_processes 5;
daemon off;

worker_rlimit_nofile 8192;

events {
worker_connections 4096; # Default: 1024
}

http {
include $!{nginx}/conf/mime.types;
index index.html index.htm index.php;

default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] $status '
'"$request" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /dev/stdout;
error_log /dev/stdout;
sendfile on;
tcp_nopush on;
server_names_hash_bucket_size 128; # this seems to be required for some vhosts
client_max_body_size 128M;

server {
listen ${PORT};
listen [::]:${PORT};
server_name localhost;

$if(NIXPACKS_PHP_ROOT_DIR) (
root ${NIXPACKS_PHP_ROOT_DIR};
) else (
root /app;
)

add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";

index index.php;

charset utf-8;

$if(IS_LARAVEL) (
location / {
try_files $uri $uri/ /index.php?$query_string;
}
) else ()

$if(NIXPACKS_PHP_FALLBACK_PATH) (
location / {
try_files $uri $uri/ ${NIXPACKS_PHP_FALLBACK_PATH}?$query_string;
}
) else ()

location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }

$if(IS_LARAVEL) (
error_page 404 /index.php;
) else ()

location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include $!{nginx}/conf/fastcgi_params;
include $!{nginx}/conf/fastcgi.conf;
}

location ~ /\.(?!well-known).* {
deny all;
}
}
}
10 changes: 10 additions & 0 deletions .nixpacks/assets/php-fpm.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[www]
listen = 127.0.0.1:9000
user = nobody
pm = dynamic
pm.max_children = 50
pm.min_spare_servers = 4
pm.max_spare_servers = 32
pm.start_servers = 18
clear_env = no
catch_workers_output = yes
Loading
Loading