Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
guille-sage committed Dec 19, 2023
1 parent d3b80f7 commit 5738218
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 28 deletions.
44 changes: 38 additions & 6 deletions .github/workflows/rspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,46 @@ jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
strategy:
matrix:
ruby: ['2.7', '3.0', '3.2']

services:
eventq_redis:
image: redis:alpine
ports:
- 6379:6379
rabbitmq:
image: rabbitmq:3.6.5
localstack:
# changes to multi region support after this version break tests
image: localstack/localstack:0.12.16
env:
SERVICES: sqs,sns
HOSTNAME: localstack
HOSTNAME_EXTERNAL: localstack
ports:
- "8085:8080"
- "4566:4566"

steps:
- uses: actions/checkout@v4
- name: Set up Ruby ${{ matrix.ruby }}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Bundle
run: bundle install
- name: Run tests
run: |
cd script
docker-compose up -d
docker exec testrunner bash -c "cd src && bundle install && bundle exec rspec && exit"
run: "bundle exec rspec"
env:
AWS_ACCESS_KEY_ID: mock_id
AWS_SECRET_ACCESS_KEY: mock_password
AWS_REGION: eu-west-1
AWS_SQS_ENDPOINT: http://localstack:4566
AWS_SNS_ENDPOINT: http://localstack:4566
RABBITMQ_ENDPOINT: localstack

- name: Code Coverage
uses: paambaati/codeclimate-action@v2.7.5
Expand Down
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM ruby:3.2-alpine3.18

RUN apk add --update ca-certificates bash && update-ca-certificates && rm -rf /var/cache/apk/*
RUN apk update && apk add --no-cache build-base

RUN set -ex \
&& apk add --no-cache --virtual .gem-builddeps \
ruby-dev build-base libressl-dev

COPY Gemfile .
COPY eventq.gemspec .
COPY EVENTQ_VERSION .

RUN bundle install --no-cache \
&& apk del .gem-builddeps
8 changes: 5 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
# frozen_string_literal: true

source 'https://rubygems.org'

# Specify your gem's dependencies in eventq.gemspec
gemspec


gem 'json', '~> 2'
gem 'redlock', '~> 1'

platforms :ruby do
gem 'oj', '3.6.10'
gem 'openssl', '2.1.2'
gem 'bunny'
gem 'oj'
gem 'openssl'
gem 'rexml'
end
5 changes: 3 additions & 2 deletions script/docker-compose.yml → docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@ services:
- rabbitmq
- localstack
volumes:
- ./container_loop.sh:/scripts/container_loop.sh
- ../:/src
- ./script/container_loop.sh:/scripts/container_loop.sh
- ./:/src
environment:
- AWS_ACCESS_KEY_ID=mock_id
- AWS_SECRET_ACCESS_KEY=mock_password
- AWS_REGION=eu-west-1
- AWS_SQS_ENDPOINT=http://localstack:4566
- AWS_SNS_ENDPOINT=http://localstack:4566
- RABBITMQ_ENDPOINT=rabbitmq
# env_file:
# - ../.aws.env

Expand Down
5 changes: 2 additions & 3 deletions lib/eventq.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'securerandom'
require 'redlock'
require 'class_kit'
Expand All @@ -22,6 +24,3 @@
require_relative 'eventq/eventq_base/signature_providers'
require_relative 'eventq/eventq_base/exceptions'
require_relative 'eventq/queue_worker'



13 changes: 0 additions & 13 deletions script/Dockerfile

This file was deleted.

2 changes: 1 addition & 1 deletion spec/eventq_rabbitmq/rabbitmq_queue_worker_v2_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
RSpec.describe EventQ::RabbitMq::QueueWorker do
let(:queue_worker) { EventQ::QueueWorker.new }

let(:client) { EventQ::RabbitMq::QueueClient.new({ endpoint: 'rabbitmq' }) }
let(:client) { EventQ::RabbitMq::QueueClient.new({ endpoint: ENV.fetch('RABBITMQ_ENDPOINT', 'rabbitmq') }) }

let(:connection) { client.get_connection }

Expand Down

0 comments on commit 5738218

Please sign in to comment.