From e9188506689749100c80886ca2bbc8a3f667605d Mon Sep 17 00:00:00 2001 From: Paragon Initiative Enterprises Date: Sun, 18 Apr 2021 19:53:35 -0400 Subject: [PATCH 1/3] Migrate to Github Actions --- .github/workflows/ci.yml | 70 ++++++++++++++++++++++++++++++++++++++++ README.md | 4 +-- composer.json | 6 ++-- psalm.xml | 5 +-- src/QuillHandler.php | 2 ++ 5 files changed, 80 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..d612267 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,70 @@ +name: CI + +on: [push] + +jobs: + old: + name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }} + runs-on: ${{ matrix.operating-system }} + strategy: + matrix: + operating-system: ['ubuntu-latest'] + php-versions: ['7.1', '7.2', '7.3'] + phpunit-versions: ['latest'] + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + extensions: mbstring, intl, sodium + ini-values: post_max_size=256M, max_execution_time=180 + tools: psalm, phpunit:${{ matrix.phpunit-versions }} + + - name: Install dependencies + run: composer install + + - name: Modernize dependencies + run: composer require --dev "phpunit/phpunit:>=4" + + - name: PHPUnit tests + uses: php-actions/phpunit@v2 + timeout-minutes: 30 + with: + memory_limit: 256M + + - name: Static Analysis + run: vendor/bin/psalm + + modern: + name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }} + runs-on: ${{ matrix.operating-system }} + strategy: + matrix: + operating-system: ['ubuntu-latest'] + php-versions: ['7.4', '8.0'] + phpunit-versions: ['latest'] + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + extensions: mbstring, intl, sodium + ini-values: post_max_size=256M, max_execution_time=180 + tools: psalm, phpunit:${{ matrix.phpunit-versions }} + + - name: Install dependencies + run: composer install + - name: PHPUnit tests + uses: php-actions/phpunit@v2 + timeout-minutes: 30 + with: + memory_limit: 256M + + - name: Static Analysis + run: vendor/bin/psalm diff --git a/README.md b/README.md index 5899658..b642556 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # Monolog-Quill -[![Build Status](https://travis-ci.org/paragonie/monolog-quill.svg?branch=master)](https://travis-ci.org/paragonie/monolog-quill) +[![Build Status](https://github.com/paragonie/monolog-quill/actions/workflows/ci.yml/badge.svg)](https://github.com/monolog-quill/actions) [![Latest Stable Version](https://poser.pugx.org/paragonie/monolog-quill/v/stable)](https://packagist.org/packages/paragonie/monolog-quill) [![Latest Unstable Version](https://poser.pugx.org/paragonie/monolog-quill/v/unstable)](https://packagist.org/packages/paragonie/monolog-quill) [![License](https://poser.pugx.org/paragonie/monolog-quill/license)](https://packagist.org/packages/paragonie/monolog-quill) [![Downloads](https://img.shields.io/packagist/dt/paragonie/monolog-quill.svg)](https://packagist.org/packages/paragonie/monolog-quill) -**Requires PHP 7.** +**Requires PHP 7.1 or newer.** Want to use [Monolog](https://github.com/Seldaek/monolog) to write security events to a [Chronicle](https://github.com/paragonie/chronicle)? diff --git a/composer.json b/composer.json index af50208..417938e 100644 --- a/composer.json +++ b/composer.json @@ -10,9 +10,9 @@ } ], "require": { - "php": "^7", + "php": "^7.1|^8", "monolog/monolog": "^1", - "paragonie/quill": "^0|^1" + "paragonie/quill": "^0.6|^1" }, "autoload": { "psr-4": { @@ -20,7 +20,7 @@ } }, "require-dev": { - "vimeo/psalm": "^0|^1" + "vimeo/psalm": "^3|^4" }, "scripts": { "static-analysis": "psalm" diff --git a/psalm.xml b/psalm.xml index d180bea..086c936 100644 --- a/psalm.xml +++ b/psalm.xml @@ -1,11 +1,12 @@ + + + diff --git a/src/QuillHandler.php b/src/QuillHandler.php index 870c5b6..008cec6 100644 --- a/src/QuillHandler.php +++ b/src/QuillHandler.php @@ -40,6 +40,8 @@ class QuillHandler extends AbstractProcessingHandler * @param int $level * @param bool $bubble * @return self + * + * @psalm-suppress UnsafeInstantiation We want this to be subclassable */ public static function factory( string $url = '', From 0cb07c5837e5f27bc5b5ded1ff30c931c0653865 Mon Sep 17 00:00:00 2001 From: Paragon Initiative Enterprises Date: Sun, 18 Apr 2021 19:55:56 -0400 Subject: [PATCH 2/3] We only use Psalm --- .github/workflows/ci.yml | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d612267..1636f6e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,20 +21,11 @@ jobs: php-version: ${{ matrix.php-versions }} extensions: mbstring, intl, sodium ini-values: post_max_size=256M, max_execution_time=180 - tools: psalm, phpunit:${{ matrix.phpunit-versions }} + tools: psalm - name: Install dependencies run: composer install - - name: Modernize dependencies - run: composer require --dev "phpunit/phpunit:>=4" - - - name: PHPUnit tests - uses: php-actions/phpunit@v2 - timeout-minutes: 30 - with: - memory_limit: 256M - - name: Static Analysis run: vendor/bin/psalm @@ -56,15 +47,7 @@ jobs: php-version: ${{ matrix.php-versions }} extensions: mbstring, intl, sodium ini-values: post_max_size=256M, max_execution_time=180 - tools: psalm, phpunit:${{ matrix.phpunit-versions }} - - - name: Install dependencies - run: composer install - - name: PHPUnit tests - uses: php-actions/phpunit@v2 - timeout-minutes: 30 - with: - memory_limit: 256M + tools: psalm - name: Static Analysis run: vendor/bin/psalm From 26dcef5950d6bf6552b1b013255a764a8e1a7f97 Mon Sep 17 00:00:00 2001 From: Paragon Initiative Enterprises Date: Sun, 18 Apr 2021 20:04:00 -0400 Subject: [PATCH 3/3] Install deps --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1636f6e..81aff95 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,5 +49,8 @@ jobs: ini-values: post_max_size=256M, max_execution_time=180 tools: psalm + - name: Install dependencies + run: composer install + - name: Static Analysis run: vendor/bin/psalm