Skip to content

Commit

Permalink
Merge pull request #22 from ssi-anik/v2
Browse files Browse the repository at this point in the history
2.x
  • Loading branch information
ssi-anik committed Nov 3, 2021
2 parents 56b2a3b + f1eefdd commit 87b240b
Show file tree
Hide file tree
Showing 55 changed files with 4,554 additions and 1,006 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/sniffer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Code sniffer
on:
pull_request:
push:
branches:
- master

jobs:
sniff:
name: Sniff codebase
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install PHP Codesniffer
run: composer global require squizlabs/php_codesniffer

- name: Check against PSR12 standard
run: |
`composer global config bin-dir --absolute --quiet`/phpcs --standard=PSR12 ./src
56 changes: 56 additions & 0 deletions .github/workflows/test-coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Run tests and coverage
on:
pull_request:
push:
branches:
- master

jobs:
tests:
name: PHP ${{ matrix.php }}
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
php: [ 7.2, 7.3, 7.4, 8.0 ]

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}

- name: Install dependencies
run: composer install --no-interaction --prefer-dist

- name: Run tests
run: ./vendor/bin/phpunit --testdox --verbose

coverage:
needs: tests
name: Coverage
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- uses: shivammathur/setup-php@v2
with:
coverage: pcov
php-version: 8.0

- name: Install dependencies
run: composer install --no-interaction --prefer-dist

- name: Run tests for coverage
run: ./vendor/bin/phpunit --coverage-clover=coverage.xml

- name: Push to Codecov
run: bash <(curl -s https://codecov.io/bash)
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
.idea/
vendor/
composer.lock
docker-compose.yml
.phpunit.result.cache
coverage/
17 changes: 0 additions & 17 deletions Dockerfile

This file was deleted.

23 changes: 8 additions & 15 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,20 @@
],
"minimum-stability": "stable",
"require": {
"php": ">=7.0",
"php-amqplib/php-amqplib": "^2.9 !=2.12.0|^3.0",
"illuminate/container": "^5.8|^6.0|^7.0|^8.0",
"illuminate/pipeline": "^5.8|^6.0|^7.0|^8.0",
"illuminate/support": "^5.8|^6.0|^7.0|^8.0",
"laravel/helpers": "^1.2"
"php": "^7.2|^8.0",
"php-amqplib/php-amqplib": "^3.0"
},
"require-dev": {
"phpunit/phpunit": "^8.5|^9.5"
},
"require-dev": {},
"autoload": {
"psr-4": {
"Anik\\Amqp\\": "src/"
}
},
"extra": {
"laravel": {
"providers": [
"Anik\\Amqp\\ServiceProviders\\AmqpServiceProvider"
],
"aliases": {
"Amqp": "Anik\\Amqp\\Facades\\Amqp"
}
"autoload-dev": {
"psr-4": {
"Anik\\Amqp\\Tests\\": "tests/"
}
}
}
7 changes: 0 additions & 7 deletions docker-compose.yml

This file was deleted.

22 changes: 22 additions & 0 deletions docker-compose.yml.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: '3.8'

services:
php:
build:
dockerfile: docker/php.dockerfile
context: .
volumes:
- .:/app
links:
- rabbitmq

rabbitmq:
build:
dockerfile: docker/rabbitmq.dockerfile
context: .
hostname: rabbitmq-server
ports:
- 5672:5672
- 15672:15672
# volumes:
# - ${BACKUP_PATH}/rabbitmq/amqp-package:/var/lib/rabbitmq/mnesia/
6 changes: 6 additions & 0 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
( sleep 10 && \
rabbitmqctl add_user $RABBITMQ_USER $RABBITMQ_PASSWORD && \
rabbitmqctl set_user_tags $RABBITMQ_USER administrator && \
rabbitmqctl set_permissions -p / $RABBITMQ_USER ".*" ".*" ".*" ) & \
rabbitmq-server
13 changes: 13 additions & 0 deletions docker/php.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM sirajul/php:worker-74-latest

RUN apt-get update

RUN docker-php-ext-install bcmath

RUN docker-php-ext-install sockets

COPY ./docker/worker.conf /etc/supervisor/conf.d/worker.conf

RUN mkdir /app

WORKDIR /app
18 changes: 18 additions & 0 deletions docker/rabbitmq.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM rabbitmq:3.9-management

RUN apt-get update -y
RUN apt-get install -y nano curl

# https://stackoverflow.com/a/69217201/2190689
RUN curl -L https://github.com/rabbitmq/rabbitmq-delayed-message-exchange/releases/download/3.9.0/rabbitmq_delayed_message_exchange-3.9.0.ez > $RABBITMQ_HOME/plugins/rabbitmq_delayed_message_exchange-3.9.0.ez
RUN chown rabbitmq:rabbitmq $RABBITMQ_HOME/plugins/rabbitmq_delayed_message_exchange-3.9.0.ez
RUN rabbitmq-plugins enable rabbitmq_delayed_message_exchange

# https://stackoverflow.com/a/53403267/2190689
ENV RABBITMQ_USER user
ENV RABBITMQ_PASSWORD password

COPY ./docker/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

CMD ["/entrypoint.sh"]
2 changes: 2 additions & 0 deletions docker/worker.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[supervisord]
nodaemon=true
29 changes: 29 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http:https://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
backupGlobals="false"
backupStaticAttributes="false"
beStrictAboutTestsThatDoNotTestAnything="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
verbose="true">
<coverage>
<include>
<directory suffix=".php">src</directory>
</include>
</coverage>
<testsuites>
<testsuite name="unit">
<directory>tests/Unit</directory>
</testsuite>
<testsuite name="integration">
<directory>tests/Integration</directory>
</testsuite>
</testsuites>
</phpunit>
Loading

0 comments on commit 87b240b

Please sign in to comment.