Skip to content

Commit

Permalink
Merge pull request #45 from fga-eps-mds/dev
Browse files Browse the repository at this point in the history
Deploy to main
  • Loading branch information
DaviMatheus authored Sep 9, 2024
2 parents f744eba + 5dea10f commit 356f763
Show file tree
Hide file tree
Showing 128 changed files with 7,386 additions and 699 deletions.
9 changes: 0 additions & 9 deletions .env.dev

This file was deleted.

3 changes: 3 additions & 0 deletions .env.dev.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
NEXT_PUBLIC_API_URL=
NEXTAUTH_URL=
NEXTAUTH_SECRET=
5 changes: 3 additions & 2 deletions .github/workflows/code-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ name: Análise de Código
on:
push:
branches:
- dev
- main
- master
pull_request:

branches:
- dev
- main
- master

Expand All @@ -15,7 +16,7 @@ jobs:
name: SonarCloud
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/deploy-vm-azure.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Deploy App in Azure

# Dispara o workflow para push e pull request na branch 'dev'
on:
push:
branches:
- dev


jobs:
run-script:
runs-on: ubuntu-latest

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

- name: executing remote ssh commands using password
uses: appleboy/[email protected]
with:
host: ${{ secrets.IP_VM_AZURE_DEV }}
username: ${{ secrets.USER_VM_AZURE_DEV }}
password: ${{ secrets.USER_VM_AZURE_DEV }}
port: 22
request_pty: true
script: |
ls -alt
cd /home/Calculus-admin1/app
pwd
sudo ./manage_process_front.sh
echo "Starting deploy Front"
sudo ./deploy_front.sh
8 changes: 3 additions & 5 deletions .github/workflows/metrics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@ name: Metrics and Release
on:
pull_request:
branches:
- main
- dev
- master
types: [closed]
push:
branches:
- main
- master
types: [closed]


jobs:
release:
Expand Down
8 changes: 2 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ yarn-error.log*
*.tsbuildinfo
next-env.d.ts

package-lock.json
/package-lock.json

reports/*

reports

report
/reports/*.xml
7 changes: 1 addition & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,12 @@ FROM node:18

WORKDIR /src


COPY package*.json ./

RUN npm install nodemon --save-dev

RUN npm install

COPY . .

RUN npm run build

EXPOSE 4000

CMD ["npm", "run", "start"]
CMD ["npm", "run", "dev"]
17 changes: 17 additions & 0 deletions components.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "default",
"rsc": true,
"tsx": true,
"tailwind": {
"config": "tailwind.config.ts",
"css": "src/app/globals.css",
"baseColor": "slate",
"cssVariables": false,
"prefix": ""
},
"aliases": {
"components": "@/components",
"utils": "@/lib/utils"
}
}
8 changes: 7 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,10 @@ services:
- ./src:/app/src
env_file:
- .env

networks:
- calculus-network


networks:
calculus-network:
driver: bridge
18 changes: 8 additions & 10 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
import type { Config } from 'jest';
import nextJest from 'next/jest';

import nextJest from 'next/jest.js'

const createJestConfig = nextJest({
dir: './src',
})
dir: './',
});

const config: Config = {
coverageProvider: 'v8',
testEnvironment: 'jsdom',
preset: 'ts-jest',
moduleNameMapper: {
// ...
'^@/components/(.*)$': '<rootDir>/src/app/components/$1',
'^@/(.*)$': '<rootDir>/src/$1',
'\\.(css|less|scss|sass)$': 'identity-obj-proxy',
},
reporters: [
'default',
Expand All @@ -25,7 +23,7 @@ const config: Config = {
},
],
],
testMatch: ['<rootDir>/test/**/*.(test|spec).ts?(x)'],
};

}

export default createJestConfig(config)
export default createJestConfig(config);
8 changes: 8 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// next.config.js

/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
}

module.exports = nextConfig
8 changes: 0 additions & 8 deletions next.congif.js

This file was deleted.

27 changes: 24 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"start": "next start -p 4000",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
"test": "jest --passWithNoTests --no-cache --runInBand",
"test:all": "npm run test -- --coverage --config jest.config.ts"
"test:all": "npm run test -- --coverage --config jest.config.ts",
"coverage": "jest --coverage"
},
"dependencies": {
"@emotion/react": "^11.13.0",
Expand All @@ -20,29 +21,49 @@
"@hookform/resolvers": "^3.9.0",
"@mui/icons-material": "^5.16.5",
"@mui/material": "^5.16.5",
"@radix-ui/react-dropdown-menu": "^2.1.1",
"@radix-ui/react-slot": "^1.1.0",
"@tanstack/react-query": "^5.51.11",
"@tanstack/react-table": "^8.20.1",
"axios": "^1.7.2",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"cookie": "^0.6.0",
"dotenv": "^16.4.5",
"glob": "^9.3.5",
"jsonwebtoken": "^9.0.2",
"lucide-react": "^0.428.0",
"material-react-table": "^2.13.1",
"next": "^14.2.5",
"next-auth": "^4.24.7",
"next-safe-action": "^7.4.3",
"react": "^18.3.1",
"react-beautiful-dnd": "^13.1.1",
"react-dom": "^18.3.1",
"react-hook-form": "^7.52.1",
"react-markdown": "^9.0.1",
"react-table": "^7.8.0",
"react-multi-carousel": "^2.8.5",
"react-toastify": "^10.0.5",
"rehype-katex": "^7.0.0",
"rehype-raw": "^7.0.0",
"remark-gfm": "^4.0.0",
"remark-math": "^6.0.0",
"sonner": "^1.5.0",
"tailwind-merge": "^2.5.2",
"tailwindcss-animate": "^1.0.7",
"zod": "^3.23.8"
},
"devDependencies": {
"@testing-library/jest-dom": "^6.4.8",
"@tanstack/react-query-devtools": "^5.51.21",
"@testing-library/jest-dom": "^6.5.0",
"@testing-library/react": "^16.0.0",
"@types/cookie": "^0.6.0",
"@types/jest": "^29.5.12",
"@types/jsonwebtoken": "^9.0.6",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"@types/tough-cookie": "^4.0.5",
"autoprefixer": "^10.4.19",
"eslint": "^8",
"eslint-config-next": "14.2.5",
Expand Down
59 changes: 59 additions & 0 deletions scripts/deploy/deploy_front.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/bin/bash

SESSION_NAME="npm_run_session"
ENV="dev"
DIR1="/home/Calculus-admin1/app/2024.1-CALCULUS-Frontend"

# Comandos renomeados para refletir a ordem de execução
CMD1="git fetch"
CMD2="git checkout $ENV"
CMD3="git pull origin $ENV"
CMD4="npm install"
CMD5="npm run dev &"
CMD6="echo Starting Deploy Front"

# Função para iniciar a sessão tmux e executar comandos
start_tmux_session() {
# Criar uma nova sessão tmux
tmux kill-session -t $SESSION_NAME 2>/dev/null
tmux new-session -d -s $SESSION_NAME

# Executar os comandos na pasta do frontend
tmux send-keys -t $SESSION_NAME "cd $DIR1" C-m
tmux send-keys -t $SESSION_NAME "$CMD1" C-m
tmux send-keys -t $SESSION_NAME "$CMD2" C-m
tmux send-keys -t $SESSION_NAME "$CMD3" C-m
tmux send-keys -t $SESSION_NAME "$CMD4" C-m
tmux send-keys -t $SESSION_NAME "$CMD5" C-m
tmux send-keys -t $SESSION_NAME "$CMD6" C-m

# Anexar à sessão tmux para visualizar os comandos em execução
}

# Função para executar o health check
run_healthcheck() {
PORT=4000
CHECK_INTERVAL=5

echo "Iniciando health check para a porta $PORT..."

while true; do
# Executa o comando para verificar se a porta está em uso
OUTPUT=$(ss -tuln | grep ":$PORT")

# Verifica se há algum resultado
if [ -n "$OUTPUT" ]; then
echo "A porta $PORT está em uso. Encerrando o health check."
break
else
echo "A porta $PORT não está em uso. Verificando novamente em $CHECK_INTERVAL segundos..."
sleep $CHECK_INTERVAL
fi
done
}

# Iniciar a sessão tmux e executar os comandos
start_tmux_session

# Após a execução do tmux, iniciar o health check
run_healthcheck
31 changes: 26 additions & 5 deletions src/app/(auth)/login/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'use client';

import { Box } from '@mui/material';
import { Box, Grid, Link } from '@mui/material';
import Image from 'next/image';
import calcuclusLogo from '@/public/calculus-logo.svg';
import LoginComponent from '@/app/components/login.component';
import { GoogleAuthButton } from '@/components/ui/buttons/googleAuth.button';
import { MicrosoftAuthButton } from '@/components/ui/buttons/microsoftAuth.button';
import { SingInForm } from '@/components/forms/signInForm';

export default function LoginPage() {
return (
Expand All @@ -19,7 +19,28 @@ export default function LoginPage() {
/>
<p className="text-[32px] font-bold">Login</p>
</Box>
<LoginComponent />
<Grid
container
spacing={1}
justifyContent="center"
className="mt-2 mb-2"
>
<Grid item>
<GoogleAuthButton />
</Grid>
<Grid item>
<MicrosoftAuthButton />
</Grid>
</Grid>

<SingInForm />

<p className="text-[18px] font-light">
Novo Usuário?
<Link href="/register" className="text-indigo-700 block">
Cadastre-se
</Link>
</p>
</Box>
</Box>
);
Expand Down
Loading

0 comments on commit 356f763

Please sign in to comment.