Skip to content

Commit

Permalink
chore: go workspaces
Browse files Browse the repository at this point in the history
Signed-off-by: Valery Piashchynski <piashchynski.valery@gmail.com>
  • Loading branch information
rustatian committed Sep 25, 2023
1 parent 996da18 commit 0198fd7
Show file tree
Hide file tree
Showing 44 changed files with 11,182 additions and 12 deletions.
106 changes: 95 additions & 11 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
name: Linux
name: SQS

on:
push:
branches:
- master
tags-ignore:
- "**"
paths-ignore:
- "**.md"
- "**.yaml"
- "**.yml"
- stable
pull_request:
paths-ignore:
- "**.md"
- "**.yaml"
- "**.yml"
branches:
- master
- stable

jobs:
golang:
Expand Down Expand Up @@ -47,3 +41,93 @@ jobs:

- name: Run golang tests with coverage
run: make test

sqs_test:
name: SQS plugin (Go ${{ matrix.go }}, PHP ${{ matrix.php }}, OS ${{matrix.os}})
runs-on: ${{ matrix.os }}
timeout-minutes: 60
strategy:
matrix:
php: [ "8.2" ]
go: [ stable ]
os: [ "ubuntu-latest" ]
steps:
- name: Set up Go ${{ matrix.go }}
uses: actions/setup-go@v4 # action page: <https://github.com/actions/setup-go>
with:
go-version: ${{ matrix.go }}

- name: Set up PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2 # action page: <https://github.com/shivammathur/setup-php>
with:
php-version: ${{ matrix.php }}
extensions: sockets

- name: Check out code
uses: actions/checkout@v4

- name: Get Composer Cache Directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Init Composer Cache # Docs: <https://git.io/JfAKn#php---composer>
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ matrix.php }}-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install Composer dependencies
run: cd tests/php_test_files && composer update --prefer-dist --no-progress --ansi

- name: Init Go modules Cache # Docs: <https://git.io/JfAKn#go---modules>
uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-

- name: Install Go dependencies
run: go mod download

- name: Run golang tests with coverage
env:
RR_TEST_ENV: ${{ secrets.RR_TEST_ENV }}
RR_SQS_TEST_ENDPOINT: ${{ secrets.RR_SQS_TEST_ENDPOINT }}
RR_SQS_TEST_REGION: ${{ secrets.RR_SQS_TEST_REGION }}
RR_SQS_TEST_KEY: ${{ secrets.RR_SQS_TEST_KEY }}
RR_SQS_TEST_SECRET: ${{ secrets.RR_SQS_TEST_SECRET }}
run: |
cd tests
docker compose -f env/docker-compose-otel.yaml up -d
sleep 30
mkdir ./coverage-ci
go test -timeout 20m -v -race -cover -tags=debug -failfast -coverpkg=$(cat pkgs.txt) -coverprofile=./coverage-ci/sqs.out -covermode=atomic ./...
- name: Archive code coverage results
uses: actions/upload-artifact@v3
with:
name: coverage
path: ./tests/coverage-ci/sqs.out

codecov:
name: Upload codecov
runs-on: ubuntu-latest
needs:
- amqp_test

timeout-minutes: 60
steps:
- name: Download code coverage results
uses: actions/download-artifact@v3
- run: |
cd coverage
echo 'mode: atomic' > summary.txt
tail -q -n +2 *.out >> summary.txt
sed -i '2,${/roadrunner/!d}' summary.txt
- name: upload to codecov
uses: codecov/codecov-action@v3 # Docs: <https://github.com/codecov/codecov-action>
with:
file: ./coverage/summary.txt
fail_ci_if_error: false
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
*.out

# Dependency directories (remove the comment below to include it)
# vendor/
vendor/
.idea
6 changes: 6 additions & 0 deletions go.work
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
go 1.21.1

use (
.
./tests
)
564 changes: 564 additions & 0 deletions go.work.sum

Large diffs are not rendered by default.

42 changes: 42 additions & 0 deletions tests/configs/.rr-no-global.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
version: '3'

rpc:
listen: tcp://127.0.0.1:6001

server:
command: "php php_test_files/jobs/jobs_ok.php"
relay: "pipes"
relay_timeout: "20s"

logs:
level: debug
mode: development

jobs:
num_pollers: 10
pipeline_size: 100000
pool:
num_workers: 10
max_jobs: 0
allocate_timeout: 60s
destroy_timeout: 60s

pipelines:
test-1:
driver: sqs
config:
prefetch: 1000
visibility_timeout: 0
wait_time_seconds: 0
queue: default
attributes:
DelaySeconds: 0
MaximumMessageSize: 262144
MessageRetentionPeriod: 345600
ReceiveMessageWaitTimeSeconds: 0
VisibilityTimeout: 30
tags:
test: "tag"

consume: [ "test-1" ]

50 changes: 50 additions & 0 deletions tests/configs/.rr-sqs-attr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
version: '3'

rpc:
listen: tcp://127.0.0.1:6001

server:
command: "php php_test_files/jobs/jobs_ok.php"
relay: "pipes"
relay_timeout: "20s"

sqs:
key: api-key
secret: api-secret
region: us-west-1
endpoint: http://127.0.0.1:9324

logs:
level: debug
encoding: console
mode: development

jobs:
num_pollers: 10
pipeline_size: 100000
pool:
num_workers: 10
max_jobs: 0
allocate_timeout: 60s
destroy_timeout: 60s

pipelines:
test-1:
driver: sqs
config:
prefetch: 1000
visibility_timeout: 0
wait_time_seconds: 0
message_group_id: 'foo'
queue: default.fifo
attributes:
FifoQueue: 'true'
MaximumMessageSize: 262144
MessageRetentionPeriod: 345600
ReceiveMessageWaitTimeSeconds: 0
VisibilityTimeout: 30
ContentBasedDeduplication: 'true'
tags:
test: "tag"

consume: [ "test-1" ]
30 changes: 30 additions & 0 deletions tests/configs/.rr-sqs-declare.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
version: '3'

rpc:
listen: tcp://127.0.0.1:6001

server:
command: "php php_test_files/jobs/jobs_ok.php"
relay: "pipes"
relay_timeout: "20s"

# amazon sqs configuration
# General section
sqs:
key: api-key
secret: api-secret
region: us-west-1
endpoint: http://127.0.0.1:9324

logs:
level: debug
encoding: console
mode: development

jobs:
num_pollers: 1
pipeline_size: 100000
pool:
num_workers: 10
allocate_timeout: 60s
destroy_timeout: 60s
29 changes: 29 additions & 0 deletions tests/configs/.rr-sqs-declare_fifo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
version: '3'

rpc:
listen: tcp://127.0.0.1:6001

server:
command: "php php_test_files/jobs/jobs_ok.php"
relay: "pipes"
relay_timeout: "20s"

sqs:
key: api-key
secret: api-secret
region: us-west-1
endpoint: http://127.0.0.1:9324

logs:
level: debug
encoding: console
mode: development

jobs:
num_pollers: 1
pipeline_size: 100000
pool:
num_workers: 10
max_jobs: 0
allocate_timeout: 60s
destroy_timeout: 60s
58 changes: 58 additions & 0 deletions tests/configs/.rr-sqs-init-v27-br.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
version: '3'

rpc:
listen: tcp://127.0.0.1:6001

server:
command: "php php_test_files/jobs/jobs_bad_resp.php"
relay: "pipes"
relay_timeout: "20s"

sqs:
key: api-key
secret: api-secret
region: us-west-1
endpoint: http://127.0.0.1:9324

logs:
level: debug
encoding: console
mode: development

jobs:
num_pollers: 10
pipeline_size: 100000
pool:
num_workers: 10
max_jobs: 0
allocate_timeout: 60s
destroy_timeout: 60s

pipelines:
test-1:
driver: sqs
config:
prefetch: 1000
visibility_timeout: 0
wait_time_seconds: 0
queue: default
attributes:
DelaySeconds: 0
MaximumMessageSize: 262144
MessageRetentionPeriod: 345600
ReceiveMessageWaitTimeSeconds: 0
VisibilityTimeout: 30
tags:
test: "tag"

test-2:
driver: sqs
config:
prefetch: 1000
queue: default-2
attributes:
MessageRetentionPeriod: 86400
tags:
test: "tag"
consume: [ "test-1", "test-2" ]

Loading

0 comments on commit 0198fd7

Please sign in to comment.