Skip to content

Kan 15 arch 005 implementar testes #44

Kan 15 arch 005 implementar testes

Kan 15 arch 005 implementar testes #44

Workflow file for this run

name: "CI pipeline"
on:
push:
branches:
- 'main'
pull_request:
branches:
- '**'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Set up Node.js
uses: actions/setup-node@v5
with:
node-version: "18"
cache: "npm"
- name: Install dependencies
run: npm ci --audit false
- name: Lint code
run: npm run lint
- name: Build application
run: npm run build
- name: Cache node_modules
uses: actions/cache@v4
with:
path: |
**/node_modules
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-modules-
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build
path: dist/
test:
runs-on: ubuntu-latest
needs: build
env:
DB_HOST: localhost
DB_PORT: 5432
DB_USERNAME: postgres
DB_PASSWORD: postgres
DB_DATABASE: payment_records
PORT: 3000
FRONTEND_URL: http://localhost:5173
SMTP_HOST: smtp.example.com
EMAIL_USER: email@gmail.com
EMAIL_PASS: your-email-password
ACCESS_SECRET: secret1
ACCESS_EXPIRE: 15m
REFRESH_SECRET: secret2
REFRESH_EXPIRE: 7d
RESET_SECRET: secret3
RESET_EXPIRE: 15m
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Set up Node.js
uses: actions/setup-node@v5
with:
node-version: "18"
cache: "npm"
- name: Install dependencies
run: npm ci --audit false
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: build
- name: Up docker services
run: docker compose up -d --build
- name: Wait for Database
run: |
until docker exec payment_records_db pg_isready; do
echo "Waiting for database..."
sleep 2
done
- name: 'Run unit tests'
run: npm run test:unit
- name: 'Run integration tests'
run: npm run test:integration
- name: Stop containers
if: always()
run: docker compose down