Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
32 changes: 32 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Servidor
PORT=3001
LANG=en_US
RACK_ENV=development
RAILS_ENV=development

# Sidekiq
SIDEKIQ_USERNAME=sidekiq
SIDEKIQ_PASSWORD=1234
SIDEKIQ_CONSUMERS_QUEUES=default

#postgre
POSTGRES_DB=ecommerce_db
POSTGRES_USER=postgres
POSTGRES_PASSWORD=password
POSTGRES_HOST=db
POSTGRES_PORT=5432
DATABASE_NAME=ecommerce_db

# Redis
REDIS_HOST=redis://redis
REDIS_PORT=6379
REDIS_PASSWORD=

# RabbitMQ
RABBITMQ_URL=amqp://guest:guest@rabbitmq:5672
EXCHANGE=transactions

# APIs
FIDELITY_API_URL=http://localhost:3000/api/v1/fidelity
STORE_API_URL=http://localhost:3000/api/v1/store
EXCHANGE_API_URL=http://localhost:3000/api/v1/exchange
49 changes: 41 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,36 @@ jobs:
test:
runs-on: ubuntu-latest

# services:
# redis:
# image: redis
# ports:
# - 6379:6379
# options: --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5
services:
# rabbitmq:
# image: rabbitmq:3-management
# ports:
# - 5672:5672
# - 15672:15672
# options: --health-cmd "rabbitmq-diagnostics ping" --health-interval 10s --health-timeout 5s --health-retries 5
# postgres:
# image: postgres:13
# ports:
# - 5432:5432
# env:
# POSTGRES_USER: postgres
# POSTGRES_PASSWORD: password
# POSTGRES_DB: ecommerce_db
# options: --health-cmd "pg_isready -U postgres" --health-interval 10s --health-timeout 5s --health-retries 5

steps:
- name: Install packages
run: sudo apt-get update && sudo apt-get install --no-install-recommends -y google-chrome-stable curl libjemalloc2 libvips sqlite3
- name: Set up Docker
run: |
sudo apt-get update
sudo apt-get install -y docker.io
sudo systemctl start docker
sudo systemctl enable docker
sudo curl -L "https://github.com/docker/compose/releases/download/v2.14.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version

- name: Install dependencies
run: sudo apt-get update && sudo apt-get install --no-install-recommends -y google-chrome-stable curl libjemalloc2 libvips sqlite3 netcat-openbsd

- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -59,6 +80,18 @@ jobs:
ruby-version: .ruby-version
bundler-cache: true

# Etapa para construir os containers Docker
- name: Build Docker containers
run: |
docker-compose -f docker-compose.yml build

- name: Start Docker containers
run: |
docker-compose -f docker-compose.yml up -d

- name: Run tests
run: bundle exec rails test

- name: Keep screenshots from failed system tests
uses: actions/upload-artifact@v4
if: failure()
Expand Down
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ gem "sidekiq-unique-jobs"
gem "devise"
gem "oj"
gem "pg"

# Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis]
# gem "kredis"

Expand Down