Skip to content

Commit

Permalink
feat: teste #20 CICD
Browse files Browse the repository at this point in the history
  • Loading branch information
LeohsPaixao committed Nov 25, 2024
1 parent 313d096 commit 2720235
Show file tree
Hide file tree
Showing 5 changed files with 130 additions and 57 deletions.
File renamed without changes.
16 changes: 7 additions & 9 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,17 @@ jobs:
- name: Checkout do repositório
uses: actions/checkout@v4

- name: Configurar e iniciar backend
- name: Configurar node
uses: actions/setup-node@v4
with:
node-version: 22
- run: |

- name: Instalar as dependências do Monorepo
run: yarn

- name: Iniciar backend
run: |
cd backend
yarn install
yarn prisma migrate dev
yarn prisma:seed
nohup yarn api > backend.log 2>&1 &
Expand All @@ -47,14 +51,8 @@ jobs:
- name: Configurar e iniciar frontend
run: |
cd frontend
yarn install
nohup yarn serve > frontend.log 2>&1 &
- name: Instalar dependências do Cypress
run: |
cd test/cypress
yarn install
- name: Executar os testes
run: |
cd test/cypress
Expand Down
120 changes: 98 additions & 22 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
name: Testes QA-Solar - Main
name: Testes QA-Solar - CI

on:
push:
branches:
- main
- feat/adiciona-ci-cd-no-projeto
pull_request:
branches:
- main
- feat/adiciona-ci-cd-no-projeto

jobs:
setup-environment:
name: Configurar Ambiente (PostgreSQL, Backend e Frontend)
cypress-tests:
name: Cypress Testes QA-Solar
runs-on: ubuntu-latest
services:
postgres:
Expand All @@ -35,9 +37,9 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 22

- name: Instalar as dependências do Monorepo
run: yarn
run: yarn

- name: Iniciar backend
run: |
Expand All @@ -53,12 +55,7 @@ jobs:
cd frontend
nohup yarn serve > frontend.log 2>&1 &
cypress-tests:
name: Executar Testes Cypress
needs: setup-environment
runs-on: ubuntu-latest
steps:
- name: Executar testes Cypress
- name: Executar os testes
run: |
cd test/cypress
yarn cy:run
Expand All @@ -68,43 +65,122 @@ jobs:
uses: actions/[email protected]
with:
name: cypress-artifacts
path: test/cypress/tests/e2e/misc/screenshots
path: tests/e2e/misc/screenshots

playwright-tests:
name: Executar Testes Playwright
needs: setup-environment
name: Playwright Testes QA-Solar
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15
ports:
- 5432:5432
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: tests_base
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout do repositório
uses: actions/checkout@v4

- name: Configurar node
uses: actions/setup-node@v4
with:
node-version: 22

- name: Instalar as dependências do Monorepo
run: yarn

- name: Iniciar backend
run: |
cd backend
yarn prisma migrate dev
yarn prisma:seed
nohup yarn api > backend.log 2>&1 &
env:
DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/tests_base?schema=public"

- name: Configurar e iniciar frontend
run: |
cd frontend
nohup yarn serve > frontend.log 2>&1 &
- name: Executar testes Playwright
run: |
cd test/playwright
yarn play:run
- name: Salvar artefatos do Playwright
if: ${{ failure() }}
- name: Upload de testes falhados
uses: actions/[email protected]
if: ${{ !cancelled() }}
with:
name: playwright-report
path: test/playwright/playwright-report
path: playwright-report/
retention-days: 30

robot-framework-tests:
name: Executar Testes Robot Framework
needs: setup-environment
name: Robot Framework Testes QA-Solar
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15
ports:
- 5432:5432
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: tests_base
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout do repositório
uses: actions/checkout@v4

- name: Configurar Python
uses: actions/setup-python@v4
with:
python-version: 3.11
check-latest: true

- name: Configurar node
uses: actions/setup-node@v4
with:
node-version: 22

- name: Instalar as dependências do Monorepo
run: yarn

- name: Iniciar backend
run: |
cd backend
yarn prisma migrate dev
yarn prisma:seed
nohup yarn api > backend.log 2>&1 &
env:
DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/tests_base?schema=public"

- name: Configurar e iniciar frontend
run: |
cd frontend
nohup yarn serve > frontend.log 2>&1 &
- name: Instalar dependências do sistema para Robot Framework
run: chmod +x .github/scripts/chrome.sh && .github/scripts/chrome.sh

- name: Criar ambiente virtual para Python
run: python -m venv venv
- name: Cria ambiente virtual do Python
run: python3.10 -m venv venv

- name: Instalar dependências do Robot Framework
- name: Instalar dependências
run: |
cd test/robot
source venv/bin/activate
Expand Down
16 changes: 7 additions & 9 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,17 @@ jobs:
- name: Checkout do repositório
uses: actions/checkout@v4

- name: Configurar e iniciar backend
- name: Configurar node
uses: actions/setup-node@v4
with:
node-version: 22
- run: |

- name: Instalar as dependências do Monorepo
run: yarn

- name: Iniciar backend
run: |
cd backend
yarn install
yarn prisma migrate dev
yarn prisma:seed
nohup yarn api > backend.log 2>&1 &
Expand All @@ -47,13 +51,7 @@ jobs:
- name: Configurar e iniciar frontend
run: |
cd frontend
yarn install
nohup yarn serve > frontend.log 2>&1 &
- name: Instalar dependências
run: |
cd test/playwright
yarn install
- name: Executar testes Playwright
run: |
Expand Down
35 changes: 18 additions & 17 deletions .github/workflows/robot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,30 +36,31 @@ jobs:
with:
python-version: 3.11
check-latest: true

- name: Configurar e iniciar backend
- name: Configurar node
uses: actions/setup-node@v4
with:
node-version: 22
- run: |
cd backend
yarn install
yarn prisma migrate dev
yarn prisma:seed
nohup yarn api > backend.log 2>&1 &
node-version: 22

- name: Instalar as dependências do Monorepo
run: yarn

- name: Iniciar backend
run: |
cd backend
yarn prisma migrate dev
yarn prisma:seed
nohup yarn api > backend.log 2>&1 &
env:
DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/tests_base?schema=public"
- name: Configurar e iniciar frontend
run: |
cd frontend
yarn install
nohup yarn serve > frontend.log 2>&1 &
cd frontend
nohup yarn serve > frontend.log 2>&1 &
- name: Instala as dependencias do Chrome
run: |
sudo apt-get update
sudo apt-get install -y wget unzip xvfb libxi6 libgconf-2-4
- name: Instalar dependências do sistema para Robot Framework
run: chmod +x .github/scripts/chrome.sh && .github/scripts/chrome.sh

- name: Cria ambiente virtual do Python
run: python3.10 -m venv venv
Expand Down

0 comments on commit 2720235

Please sign in to comment.