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
28 changes: 20 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ orbs:
wait-for: cobli/wait-for@0.0.2
jobs:
build:
parameters:
php-version:
type: string
environment:
CC_TEST_REPORTER_ID: ac6b0ffb95381a6e67239f27805263c12cdb85bc1b8f3bc295173a8cb12ae2b1
working_directory: ~/messenger-kafka
docker:
- image: circleci/php:7.4.4
- image: cimg/php:<< parameters.php-version >>
- image: lensesio/fast-data-dev
environment:
SAMPLEDATA: 0
Expand All @@ -17,9 +20,9 @@ jobs:
steps:
- checkout

- run: sudo apt update # PHP CircleCI 2.0 Configuration File# PHP CircleCI 2.0 Configuration File sudo apt install zlib1g-dev libsqlite3-dev
- run: sudo apt update
- run: sudo apt install librdkafka1 librdkafka-dev kafkacat netcat
- run: sudo docker-php-ext-install zip && sudo pecl install rdkafka && sudo docker-php-ext-enable rdkafka
- run: sudo pecl install rdkafka xdebug

# Download and cache dependencies
- restore_cache:
Expand Down Expand Up @@ -55,13 +58,22 @@ jobs:
- run:
name: PHPUnit
command: |
mkdir results && mkdir results/tests
./cc-test-reporter before-build
./vendor/bin/simple-phpunit --log-junit results/tests/junit.xml --coverage-html results/coverage-report --coverage-clover clover.xml
XDEBUG_MODE=coverage ./vendor/bin/simple-phpunit --log-junit junit.xml --coverage-clover clover.xml
./cc-test-reporter after-build --coverage-input-type clover --exit-code $?

- store_test_results:
path: ~/messenger-kafka/results/tests
path: ~/messenger-kafka/junit.xml

- store_artifacts:
path: ~/messenger-kafka/results/coverage-report
- store_test_results:
path: ~/messenger-kafka/clover.xml

workflows:
all-versions:
jobs:
- build:
name: "php-7.4"
php-version: "7.4"
- build:
name: "php-8.1"
php-version: "8.1"
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "composer" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"
78 changes: 78 additions & 0 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Tests

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ['8.3', '8.4', '8.5']
symfony: ['^6.4', '^7.3', '^7.4', '^8.0']
exclude:
- php: '8.3'
symfony: '^8.0'
- php: '8.3'
symfony: '^7.4'

services:
kafka:
image: lensesio/fast-data-dev
env:
ADV_HOST: 127.0.0.1
SAMPLEDATA: 0
RUNTESTS: 0
FORWARDLOGS: 0
ports:
- 9092:9092
- 8081:8081
- 8082:8082
- 8083:8083
- 2181:2181

steps:
- uses: actions/checkout@v2

- name: Validate composer.json and composer.lock
run: composer validate

- name: Install rdkafka
run:
sudo add-apt-repository universe && sudo apt update && sudo apt install netcat-traditional librdkafka1 librdkafka-dev

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php }}"
coverage: xdebug
tools: pecl, phpunit
extensions: rdkafka
ini-values: post_max_size=256M, short_open_tag=On

- name: check if rdkafka is there
run: php -v && php --ri rdkafka

- name: Install dependencies
run: |
composer global require --no-progress --no-scripts --no-plugins "symfony/flex:^2.4"
composer global config --no-plugins allow-plugins.symfony/flex true
composer config extra.symfony.require "${{ matrix.symfony }}"
composer update --prefer-dist --no-progress

- name: Wait for Kafka
run: .github/workflows/wait-for-kafka.sh

- name: Unit Tests
run: ./vendor/bin/simple-phpunit --log-junit results/tests/junit.xml

#- name: try to produce
# run: echo "test" > testfile.json && kafkacat -b 0.0.0.0:9092 -t kafkacat_test -P testfile.json

# Docs: https://getcomposer.org/doc/articles/scripts.md
#- name: Run test suite
# run: phpunit --log-junit results/tests/junit.xml --coverage-html results/coverage-report --coverage-clover clover.xml
11 changes: 11 additions & 0 deletions .github/workflows/wait-for-kafka.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#! /bin/bash
end=$((SECONDS+60))

while [ $SECONDS -lt $end ]; do
if echo dump | nc localhost 2181 | grep broker ; then
exit 0
else
echo "Kafka didn't start in time"
fi
sleep 1
done
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ composer.lock
/var
/coverage
.DS_Store
/results
/.php-cs-fixer.cache
28 changes: 28 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

declare(strict_types=1);

$finder = PhpCsFixer\Finder::create()
->in(__DIR__)
->exclude('var')
->notPath('config/bundles.php')
->notPath('config/preload.php')
;

$config = new PhpCsFixer\Config();
$config
->setRiskyAllowed(true)
->setRules([
'@Symfony' => true,
'@Symfony:risky' => true,
'@PhpCsFixer:risky' => true,
'array_syntax' => ['syntax' => 'short'],
'yoda_style' => false,
'single_import_per_statement' => false,
'concat_space' => ['spacing' => 'one'],
'declare_strict_types' => true,
])
->setFinder($finder)
;

return $config;
25 changes: 0 additions & 25 deletions .php_cs.dist

This file was deleted.

Loading