Skip to content

Commit

Permalink
Resolve dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
s1lver committed Sep 18, 2023
1 parent 6767db5 commit 7f2aa6f
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 173 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [ 56, 70, 71, 72, 73, 74, 80 ]
php: [ 5.6, 7.0, 7.1, 7.2, 7.3, 7.4, 8.0 ]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: PHP Unit tests for PHP ${{ matrix.php }}
run: make test${{ matrix.php }}
run: make test v=${{ matrix.php }}
76 changes: 18 additions & 58 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,66 +1,26 @@
build:
help: ## Display help information
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'

build: ## Build an image from a docker-compose file. Params: {{ v=5.6 }}. Default latest PHP 5.6
@cp -n .env.example .env
docker-compose pull
docker-compose build --pull
PHP_VERSION=$(filter-out $@,$(v)) docker-compose up -d --build

test: test80 test74 test73 test72 test71 test70 test56
test80:
docker-compose build --pull php80
docker-compose run php80 vendor/bin/phpunit --colors=always -v --debug
docker-compose down
test74:
docker-compose build --pull php74
docker-compose run php74 vendor/bin/phpunit --colors=always -v --debug
docker-compose down
test73:
docker-compose build --pull php73
docker-compose run php73 vendor/bin/phpunit --colors=always -v --debug
docker-compose down
test72:
make clean
docker-compose build --no-cache --pull php72
docker-compose run php72 vendor/bin/phpunit --colors=always -v --debug
docker-compose down
test71:
docker-compose build --pull php71
docker-compose run php71 vendor/bin/phpunit --colors=always -v --debug
docker-compose down
test70:
make clean
docker-compose build --pull php70
docker-compose run php70 vendor/bin/phpunit --colors=always -v --debug
docker-compose down
test56:
docker-compose build --pull php56
docker-compose run php56 vendor/bin/phpunit --colors=always -v --debug
docker-compose down
test: ## Run tests. Params: {{ v=5.6 }}. Default latest PHP 5.6
PHP_VERSION=$(filter-out $@,$(v)) docker-compose build --pull yii2-queue-php
PHP_VERSION=$(filter-out $@,$(v)) docker-compose run yii2-queue-php vendor/bin/phpunit --colors=always -v --debug
make down

benchmark: benchmark74 benchmark73 benchmark72 benchmark71 benchmark70 benchmark56
benchmark74:
docker-compose build --pull php74
docker-compose run php74 tests/yii benchmark/waiting
docker-compose down
benchmark73:
docker-compose build --pull php73
docker-compose run php73 tests/yii benchmark/waiting
docker-compose down
benchmark72:
docker-compose build --pull php72
docker-compose run php72 tests/yii benchmark/waiting
docker-compose down
benchmark71:
docker-compose build --pull php71
docker-compose run php71 tests/yii benchmark/waiting
docker-compose down
benchmark70:
docker-compose build --pull php70
docker-compose run php70 tests/yii benchmark/waiting
docker-compose down
benchmark56:
docker-compose build --pull php56
docker-compose run php56 tests/yii benchmark/waiting
down: ## Stop and remove containers, networks
docker-compose down

benchmark: ## Run benchmark. Params: {{ v=5.6 }}. Default latest PHP 5.6
PHP_VERSION=$(filter-out $@,$(v)) docker-compose build --pull yii2-queue-php
PHP_VERSION=$(filter-out $@,$(v)) docker-compose run yii2-queue-php tests/yii benchmark/waiting
make down

sh: ## Enter the container with the application
docker exec -it yii2-queue-php bash

check-cs:
docker-compose build php72
docker-compose run php72 php-cs-fixer fix --diff --dry-run
Expand Down
14 changes: 5 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@
},
"require-dev": {
"yiisoft/yii2-redis": "~2.0.0",
"php-amqplib/php-amqplib": "*",
"enqueue/amqp-lib": "^0.8||^0.9.10",
"php-amqplib/php-amqplib": "^2.8.0||^3.0.0",
"enqueue/amqp-lib": "^0.8||^0.9.10||^0.10.0",
"pda/pheanstalk": "~3.2.1",
"opis/closure": "*",
"yiisoft/yii2-debug": "~2.1.0",
"yiisoft/yii2-gii": "~2.2.0",
"phpunit/phpunit": "~5.0",
"phpunit/phpunit": "4.8.34",
"aws/aws-sdk-php": ">=2.4",
"enqueue/stomp": "^0.8.39",
"enqueue/stomp": "^0.8.39||^0.10.0",
"cweagans/composer-patches": "^1.7"
},
"suggest": {
Expand Down Expand Up @@ -78,13 +78,9 @@
"phpunit/phpunit-mock-objects": {
"Fix PHP 7 and 8 compatibility": "https://yiisoft.github.io/phpunit-patches/phpunit_mock_objects.patch"
},
"phpunit/php-file-iterator": {
"Fix PHP 8.1 compatibility": "https://yiisoft.github.io/phpunit-patches/phpunit_path_file_iterator.patch"
},
"phpunit/phpunit": {
"Fix PHP 7 compatibility": "https://yiisoft.github.io/phpunit-patches/phpunit_php7.patch",
"Fix PHP 8 compatibility": "https://yiisoft.github.io/phpunit-patches/phpunit_php8.patch",
"Fix PHP 8.1 compatibility": "https://yiisoft.github.io/phpunit-patches/phpunit_php81.patch"
"Fix PHP 8 compatibility": "https://yiisoft.github.io/phpunit-patches/phpunit_php8.patch"
}
}
},
Expand Down
4 changes: 1 addition & 3 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@

namespace tests;

use PHPUnit\Framework\TestCase as BaseTestCase;

/**
* Base Test Case.
*
* @author Roman Zhuravlev <[email protected]>
*/
abstract class TestCase extends BaseTestCase
abstract class TestCase extends \PHPUnit_Framework_TestCase
{
}
88 changes: 11 additions & 77 deletions tests/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
version: "3.5"
services:

# https://docs.docker.com/samples/library/php/
php73:
# https://hub.docker.com/_/php/
yii2-queue-php:
container_name: yii2-queue-php
build:
context: ..
dockerfile: tests/docker/php/7.3/Dockerfile
dockerfile: tests/docker/php/${PHP_VERSION:-5.6}/Dockerfile
volumes:
- ./runtime/.composer73:/root/.composer
- ./runtime/.composer:/root/.composer
- ..:/code
dns: &php_dns
dns:
- 8.8.8.8
- 4.4.4.4
environment: &php_environment
environment:
MYSQL_HOST: mysql
MYSQL_USER: yii2_queue_test
MYSQL_PASSWORD: yii2_queue_test
Expand All @@ -38,7 +39,7 @@ services:
AWS_SQS_FIFO_ENABLED: ${AWS_SQS_FIFO_ENABLED}
AWS_SQS_FIFO_URL: ${AWS_SQS_FIFO_URL}
AWS_SQS_FIFO_MESSAGE_GROUP_ID: ${AWS_SQS_FIFO_MESSAGE_GROUP_ID}
depends_on: &php_depends_on
depends_on:
- mysql
- postgres
- redis
Expand All @@ -48,75 +49,8 @@ services:
- activemq
networks:
net: {}
php72:
build:
context: ..
dockerfile: tests/docker/php/7.2/Dockerfile
volumes:
- ./runtime/.composer72:/root/.composer
dns: *php_dns
environment: *php_environment
depends_on: *php_depends_on
networks:
net: {}
php71:
build:
context: ..
dockerfile: tests/docker/php/7.1/Dockerfile
volumes:
- ./runtime/.composer71:/root/.composer
dns: *php_dns
environment: *php_environment
depends_on: *php_depends_on
networks:
net: {}
php70:
build:
context: ..
dockerfile: tests/docker/php/7.0/Dockerfile
volumes:
- ./runtime/.composer70:/root/.composer
dns: *php_dns
environment: *php_environment
depends_on: *php_depends_on
networks:
net: {}
php56:
build:
context: ..
dockerfile: tests/docker/php/5.6/Dockerfile
volumes:
- ./runtime/.composer56:/root/.composer
- ..:/code
dns: *php_dns
environment: *php_environment
depends_on: *php_depends_on
networks:
net: {}
php74:
build:
context: ..
dockerfile: tests/docker/php/7.4/Dockerfile
volumes:
- ./runtime/.composer74:/root/.composer
dns: *php_dns
environment: *php_environment
depends_on: *php_depends_on
networks:
net: { }
php80:
build:
context: ..
dockerfile: tests/docker/php/8.0/Dockerfile
volumes:
- ./runtime/.composer80:/root/.composer
dns: *php_dns
environment: *php_environment
depends_on: *php_depends_on
networks:
net: { }

# https://docs.docker.com/samples/library/mysql/
# https://hub.docker.com/_/mysql/
mysql:
image: mysql:5.7
ports:
Expand All @@ -129,7 +63,7 @@ services:
networks:
net: {}

# https://docs.docker.com/samples/library/postgres/
# https://hub.docker.com/_/postgres/
postgres:
image: postgres:10.4
ports:
Expand All @@ -141,7 +75,7 @@ services:
networks:
net: {}

# https://docs.docker.com/samples/library/redis/
# https://hub.docker.com/_/redis/
redis:
image: redis:4.0
ports:
Expand Down
13 changes: 5 additions & 8 deletions tests/docker/php/8.0/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
FROM --platform=linux/amd64 php:8.0.28-cli-alpine
FROM --platform=linux/amd64 php:8.0.28-cli

RUN echo https://dl-cdn.alpinelinux.org/alpine/edge/main >> /etc/apk/repositories \
&& echo https://dl-cdn.alpinelinux.org/alpine/edge/community >> /etc/apk/repositories \
&& echo https://dl-cdn.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories \
&& apk update
RUN apk add bash unzip zlib-dev libzip-dev icu-dev libpq-dev gearman-dev autoconf g++ make musl
RUN apt-get update \
&& apt-get install -y unzip curl zlib1g-dev libzip-dev libicu-dev libpq-dev libgearman-dev

RUN docker-php-ext-install zip intl pcntl bcmath pdo_mysql pdo_pgsql
RUN docker-php-ext-install zip intl pcntl bcmath pdo_mysql pdo_pgsql sockets
RUN pecl install igbinary gearman
RUN docker-php-ext-enable igbinary gearman

Expand All @@ -16,5 +13,5 @@ COPY --from=cytopia/php-cs-fixer:latest /usr/bin/php-cs-fixer /usr/local/bin/php
COPY . /code
WORKDIR /code

ENTRYPOINT ["tests/docker/php/entrypoint-php80.sh"]
ENTRYPOINT ["tests/docker/php/entrypoint.sh"]
CMD ["sleep", "infinity"]
16 changes: 0 additions & 16 deletions tests/docker/php/entrypoint-php80.sh

This file was deleted.

0 comments on commit 7f2aa6f

Please sign in to comment.