1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-01 10:50:21 +02:00

Build tweaks

This commit is contained in:
Jordi Boggiano
2020-12-09 16:54:31 +01:00
parent fd305da67b
commit ec146b38bd
7 changed files with 24 additions and 17 deletions

View File

@@ -40,18 +40,6 @@ jobs:
php-version: "${{ matrix.php-version }}" php-version: "${{ matrix.php-version }}"
extensions: mongodb, redis, amqp extensions: mongodb, redis, amqp
- name: Configure sysctl limits
run: |
sudo swapoff -a
sudo sysctl -w vm.swappiness=1
sudo sysctl -w fs.file-max=262144
sudo sysctl -w vm.max_map_count=262144
- name: Runs Elasticsearch
uses: elastic/elastic-github-actions/elasticsearch@master
with:
stack-version: 7.6.0
- name: Get composer cache directory - name: Get composer cache directory
id: composercache id: composercache
run: echo "::set-output name=dir::$(composer config cache-files-dir)" run: echo "::set-output name=dir::$(composer config cache-files-dir)"
@@ -63,6 +51,18 @@ jobs:
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer- restore-keys: ${{ runner.os }}-composer-
- name: Remove elasticsearch/elasticsearch on PHP 8
if: "startsWith(matrix.php-version, '8.')"
run: 'composer remove elasticsearch/elasticsearch --dev --no-update'
- name: Add require for mongodb/mongodb to make tests runnable
run: 'composer require ${{ env.COMPOSER_FLAGS }} mongodb/mongodb --dev --no-update'
# This does not affect runtime, only tests were fixed in psr/log 1.1.2 so it's
# ok to require this only when running tests
- name: Bump required version of psr/log for tests purposes to fix the --prefer-lowest builds
run: 'composer require ${{ env.COMPOSER_FLAGS }} psr/log:^1.1.2 --no-update'
- name: "Handle lowest dependencies update" - name: "Handle lowest dependencies update"
if: "contains(matrix.dependencies, 'lowest')" if: "contains(matrix.dependencies, 'lowest')"
run: "echo \"COMPOSER_FLAGS=$COMPOSER_FLAGS --prefer-lowest\" >> $GITHUB_ENV" run: "echo \"COMPOSER_FLAGS=$COMPOSER_FLAGS --prefer-lowest\" >> $GITHUB_ENV"

View File

@@ -27,6 +27,7 @@ jobs:
with: with:
coverage: "none" coverage: "none"
php-version: "${{ matrix.php-version }}" php-version: "${{ matrix.php-version }}"
extensions: mongodb, redis, amqp
- name: Get composer cache directory - name: Get composer cache directory
id: composercache id: composercache
@@ -39,8 +40,12 @@ jobs:
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer- restore-keys: ${{ runner.os }}-composer-
- name: Add require for mongodb/mongodb to make tests runnable
run: 'composer require ${{ env.COMPOSER_FLAGS }} mongodb/mongodb --dev --no-update'
- name: "Install latest dependencies" - name: "Install latest dependencies"
run: "composer update ${{ env.COMPOSER_FLAGS }}" # --ignore-platform-req=php here needed as long as elasticsearch/elasticsearch does not support php 8
run: "composer update ${{ env.COMPOSER_FLAGS }} --ignore-platform-req=php"
- name: Run PHPStan - name: Run PHPStan
run: composer phpstan run: composer phpstan

View File

@@ -19,7 +19,8 @@
"require-dev": { "require-dev": {
"aws/aws-sdk-php": "^2.4.9 || ^3.0", "aws/aws-sdk-php": "^2.4.9 || ^3.0",
"doctrine/couchdb": "~1.0@dev", "doctrine/couchdb": "~1.0@dev",
"elasticsearch/elasticsearch": "^6.0", "elasticsearch/elasticsearch": "^7",
"mongodb/mongodb": "^1.8",
"graylog2/gelf-php": "^1.4.2", "graylog2/gelf-php": "^1.4.2",
"php-amqplib/php-amqplib": "~2.4", "php-amqplib/php-amqplib": "~2.4",
"php-console/php-console": "^3.1.3", "php-console/php-console": "^3.1.3",

View File

@@ -2,6 +2,7 @@ parameters:
level: 5 level: 5
treatPhpDocTypesAsCertain: false treatPhpDocTypesAsCertain: false
reportUnmatchedIgnoredErrors: false
paths: paths:
- src/ - src/

View File

@@ -34,7 +34,7 @@ class MongoDBFormatter implements FormatterInterface
$this->maxNestingLevel = max($maxNestingLevel, 0); $this->maxNestingLevel = max($maxNestingLevel, 0);
$this->exceptionTraceAsString = $exceptionTraceAsString; $this->exceptionTraceAsString = $exceptionTraceAsString;
$this->isLegacyMongoExt = version_compare(phpversion('mongodb'), '1.1.9', '<='); $this->isLegacyMongoExt = extension_loaded('mongodb') && version_compare(phpversion('mongodb'), '1.1.9', '<=');
} }
/** /**

View File

@@ -49,7 +49,7 @@ class MongoDBFormatterTest extends \PHPUnit\Framework\TestCase
$reflTrace->setAccessible(true); $reflTrace->setAccessible(true);
$this->assertEquals($expectedTraceAsString, $reflTrace->getValue($formatter)); $this->assertEquals($expectedTraceAsString, $reflTrace->getValue($formatter));
$reflDepth = new\ReflectionProperty($formatter, 'maxNestingLevel'); $reflDepth = new \ReflectionProperty($formatter, 'maxNestingLevel');
$reflDepth->setAccessible(true); $reflDepth->setAccessible(true);
$this->assertEquals($expectedTraceDepth, $reflDepth->getValue($formatter)); $this->assertEquals($expectedTraceDepth, $reflDepth->getValue($formatter));
} }

View File

@@ -45,7 +45,7 @@ class MongoDBHandlerTest extends TestCase
$record = $this->getRecord(); $record = $this->getRecord();
$expected = $record; $expected = $record;
$expected['datetime'] = $record['datetime']->format(NormalizerFormatter::SIMPLE_DATE); $expected['datetime'] = new \MongoDB\BSON\UTCDateTime((int) floor(((float) $record['datetime']->format('U.u')) * 1000));
$collection->expects($this->once()) $collection->expects($this->once())
->method('insertOne') ->method('insertOne')