Skip to content
Merged
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
3 changes: 1 addition & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
tests export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.php_cs.dist export-ignore
.scrutinizer.yml export-ignore
.php-cs-fixer.dist.php export-ignore
dockerfile.sh export-ignore
phpunit.xml.dist export-ignore
psalm.xml export-ignore
133 changes: 89 additions & 44 deletions .github/workflows/qa.yml
Original file line number Diff line number Diff line change
@@ -1,70 +1,115 @@
name: QA
on:
push:
branches:
- master
pull_request:
workflow_dispatch:
schedule:
- cron: '40 2 * * *'

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
tests:
permissions:
actions: read
contents: read
env:
TNT_IMAGE: tarantool/tarantool:2.11
PHP_IMAGE: php:8.2-cli
TNT_LISTEN_URI: localhost:3301
strategy:
fail-fast: false
max-parallel: 10
matrix:
operating-system: [ubuntu-latest]
env:
- PHP_IMAGE: php:7.2-cli

- PHP_IMAGE: php:7.3-cli
QA: 1

- PHP_IMAGE: php:7.4-cli
COVERAGE_FILE: coverage.clover

- PHP_IMAGE: php:8.0-cli
- PHP_IMAGE: php:8.1-cli

- TNT_IMAGE: tarantool/tarantool:1.7
- TNT_IMAGE: tarantool/tarantool:1.9
- TNT_IMAGE: tarantool/tarantool:1
- TNT_IMAGE: tarantool/tarantool:2.1
- TNT_IMAGE: tarantool/tarantool:2.3
- TNT_IMAGE: tarantool/tarantool:2.4
- TNT_IMAGE: tarantool/tarantool:2.5
- TNT_IMAGE: tarantool/tarantool:2.6
- TNT_IMAGE: tarantool/tarantool:2.7
- TNT_IMAGE: tarantool/tarantool:2.8
- TNT_IMAGE: tarantool/tarantool:2.10
operating-system: [ubuntu-24.04]
tarantool-release: ['2', '3']
php-version: ['8.2', '8.3', '8.4', '8.5']
include:
- php-version: '8.2'
tarantool-release: '3'
QA: true
- php-version: '8.3'
tarantool-release: '3'
COVERAGE: true

name: PHP ${{ matrix.php-version }}, Tarantool ${{ matrix.tarantool-release }}${{ matrix.QA && ', qa' || '' }}${{ matrix.COVERAGE && ', coverage' || '' }}
runs-on: ${{ matrix.operating-system }}
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v7

- name: Install Tarantool and tt
env:
TNT_RELEASE: ${{ matrix.tarantool-release }}
run: |
curl -L "https://tarantool.io/release/$TNT_RELEASE/installer.sh" | sudo bash
sudo apt-get install -y tarantool tarantool-dev tt
tarantool --version
tt version

- name: Build docker image
env: ${{ matrix.env }}
- name: Install the tarantool/queue module
run: tt rocks install queue

- name: Build PHP image
env:
PHP_IMAGE: php:${{ matrix.php-version }}-cli
TNT_LISTEN_URI: localhost:3301
COVERAGE_FILE: ${{ matrix.COVERAGE && 'coverage.xml' || '' }}
run: ./dockerfile.sh | tee /dev/tty | docker build -t queue -

- name: Test
env: ${{ matrix.env }}
run: |
docker network create tarantool-php
docker run --net=tarantool-php --rm $TNT_IMAGE /usr/local/bin/tarantool --version
docker run -d --net=tarantool-php --name=tarantool -v `pwd`:/queue -e TNT_LISTEN_URI=$TNT_LISTEN_URI ${TNT_IMAGE} tarantool /queue/tests/Integration/queues.lua
docker run --rm --net=tarantool-php -v `pwd`:/queue -w /queue queue
tarantool ./tests/Integration/queues.lua > tarantool.log 2>&1 &
for attempt in $(seq 1 30); do
if bash -c 'echo > /dev/tcp/127.0.0.1/3301' 2>/dev/null; then
ready=1
break
fi
sleep 1
done
if [ "${ready:-}" != 1 ]; then
cat tarantool.log
exit 1
fi
docker run --rm --network=host -v "$PWD:/queue" -w /queue queue

- name: Check code quality
env: ${{ matrix.env }}
if: ${{ env.QA }}
if: ${{ matrix.QA }}
run: |
docker run --net=tarantool-php --rm -v $PWD:/queue -w /queue queue php vendor/bin/php-cs-fixer fix --dry-run --diff --verbose .
docker run --net=tarantool-php --rm -v $PWD:/queue -w /queue queue php vendor/bin/psalm
docker run --rm --network=host -v "$PWD:/queue" -w /queue queue php vendor/bin/php-cs-fixer fix --dry-run --diff --verbose .
docker run --rm --network=host -v "$PWD:/queue" -w /queue queue php vendor/bin/psalm

- name: Upload code coverage to Scrutinizer
env: ${{ matrix.env }}
if: ${{ env.COVERAGE_FILE }}
run: |
curl -sSOL https://scrutinizer-ci.com/ocular.phar
docker run --rm -v $(pwd):/queue -w /queue queue php ocular.phar code-coverage:upload --format=php-clover "$COVERAGE_FILE"
- name: Upload code coverage report
if: ${{ matrix.COVERAGE }}
uses: actions/upload-artifact@v7
with:
name: coverage-${{ strategy.job-index }}
path: coverage.xml

coverage:
needs: tests
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
statuses: write
steps:
- name: Checkout
uses: actions/checkout@v7

- name: Download coverage reports
uses: actions/download-artifact@v8
with:
pattern: coverage-*
path: coverage-reports

- name: Add combined code coverage report to workflow summary
uses: getsentry/coverage-action@0.3.8
with:
token: ${{ secrets.GITHUB_TOKEN }}
directory: coverage-reports
coverage-format: cobertura
enable-tests: false
name: full-test-matrix
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/vendor/
/.phpunit.result.cache
/.phpunit.cache/
/composer.lock
/coverage*
/phpunit.xml
29 changes: 23 additions & 6 deletions .php_cs.dist → .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,34 @@
namespace Tarantool\Queue;

use PhpCsFixer\Config;
use PhpCsFixer\Fixer\ConfigurableFixerInterface;
use PhpCsFixer\Fixer\ConstantNotation\NativeConstantInvocationFixer;
use PhpCsFixer\Fixer\FixerInterface;
use PhpCsFixer\Fixer\FunctionNotation\NativeFunctionInvocationFixer;
use PhpCsFixer\FixerConfiguration\FixerConfigurationResolverInterface;
use PhpCsFixer\FixerDefinition\FixerDefinitionInterface;
use PhpCsFixer\Tokenizer\Tokens;

final class FilterableFixer implements FixerInterface
final class FilterableFixer implements ConfigurableFixerInterface
{
private $fixer;
private $pathRegex;
private ConfigurableFixerInterface $fixer;
private string $pathRegex;

public function __construct(FixerInterface $fixer, string $pathRegex)
public function __construct(ConfigurableFixerInterface $fixer, string $pathRegex)
{
$this->fixer = $fixer;
$this->pathRegex = $pathRegex;
}

public function configure(array $configuration) : void
{
$this->fixer->configure($configuration);
}

public function getConfigurationDefinition() : FixerConfigurationResolverInterface
{
return $this->fixer->getConfigurationDefinition();
}

public function isCandidate(Tokens $tokens) : bool
{
return $this->fixer->isCandidate($tokens);
Expand All @@ -36,6 +48,11 @@ public function fix(\SplFileInfo $file, Tokens $tokens) : void
$this->fixer->fix($file, $tokens);
}

public function getDefinition() : FixerDefinitionInterface
{
return $this->fixer->getDefinition();
}

public function getName() : string
{
return (new \ReflectionClass($this))->getShortName().'/'.$this->fixer->getName();
Expand Down Expand Up @@ -65,7 +82,7 @@ public function supports(\SplFileInfo $file) : bool
file that was distributed with this source code.
EOF;

return Config::create()
return (new Config())
->setUsingCache(false)
->setRiskyAllowed(true)
->registerCustomFixers([
Expand Down
22 changes: 0 additions & 22 deletions .scrutinizer.yml

This file was deleted.

Loading
Loading