From f762fe3cfc7d24ea8bf6eb007c81b97730743681 Mon Sep 17 00:00:00 2001 From: Ismo Vuorinen Date: Fri, 11 Feb 2022 15:35:44 +0200 Subject: [PATCH] GitHub Workflows, and now available for PHP 8 --- .github/workflows/composer-diff.yml | 32 ++++++++++++++++++ .github/workflows/php.yml | 50 +++++++++++++++++++++++++++++ .travis.yml | 27 ---------------- composer.json | 31 ++++++++++++------ 4 files changed, 104 insertions(+), 36 deletions(-) create mode 100644 .github/workflows/composer-diff.yml create mode 100644 .github/workflows/php.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/composer-diff.yml b/.github/workflows/composer-diff.yml new file mode 100644 index 0000000..c0514e5 --- /dev/null +++ b/.github/workflows/composer-diff.yml @@ -0,0 +1,32 @@ +name: Composer Diff +on: + pull_request: + paths: + - 'composer.lock' +jobs: + composer-diff: + name: Composer Diff + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 # Required to make it possible to compare with PR base branch + + - name: Generate composer diff + id: composer_diff # To reference the output in comment + uses: IonBazan/composer-diff-action@v1 + + - uses: marocchino/sticky-pull-request-comment@v2 + # An empty diff result will break this action. + if: ${{ steps.composer_diff.outputs.composer_diff_exit_code != 0 }} + with: + header: composer-diff # Creates a collapsed comment with the report + message: | +
+ Composer package changes + + ${{ steps.composer_diff.outputs.composer_diff }} + +
+ diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml new file mode 100644 index 0000000..85a337b --- /dev/null +++ b/.github/workflows/php.yml @@ -0,0 +1,50 @@ +name: PHP Composer + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + runs-on: ${{ matrix.operating-system }} + continue-on-error: true + + strategy: + matrix: + operating-system: ['ubuntu-latest'] + php-versions: ['7.4', '8.0', '8.1'] + phpunit-versions: ['latest'] + + steps: + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + extensions: mbstring, intl, fileinfo + ini-values: post_max_size=256M, max_execution_time=180 + coverage: xdebug + tools: php-cs-fixer, phpunit:${{ matrix.phpunit-versions }} + + - uses: actions/checkout@v2 + + - name: Validate composer.json and composer.lock + run: composer validate + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v2 + with: + path: vendor + key: ${{ runner.os }}-php-${{ matrix.php-versions }}-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php-${{ matrix.php-versions }}- + ${{ runner.os }}-php- + + - name: Install dependencies + run: composer install --prefer-dist --no-progress + + - name: Run test suite + run: composer test + diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 3748f1b..0000000 --- a/.travis.yml +++ /dev/null @@ -1,27 +0,0 @@ -language: php - -env: - global: - - setup=stable - -matrix: - fast_finish: true - include: - - php: 7.1 - - php: 7.1 - env: setup=lowest - - php: 7.2 - - php: 7.2 - env: setup=lowest - -sudo: false - -cache: - directories: - - $HOME/.composer/cache - -install: -- if [[ $setup = 'stable' ]]; then travis_retry composer update --prefer-dist --no-interaction --prefer-stable --no-suggest; fi -- if [[ $setup = 'lowest' ]]; then travis_retry composer update --prefer-dist --no-interaction --prefer-lowest --prefer-stable --no-suggest; fi - -script: vendor/bin/phpunit diff --git a/composer.json b/composer.json index 1a0df0a..dca8f98 100644 --- a/composer.json +++ b/composer.json @@ -1,28 +1,30 @@ { "name": "ivuorinen/curly", "description": "HTTP Curl client capable of NTLM authentication", + "license": "MIT", + "type": "project", "keywords": [ "http", "curl", "ntlm" ], - "license": "MIT", "authors": [ { "name": "Ismo Vuorinen", "email": "ismo@ivuorinen.net" } ], - "type": "project", "require": { - "php": ">=7.1", - "league/uri": "6.5.0", + "php": ">=7.1 || ^8", "ext-curl": "*", - "ext-zlib": "*" + "ext-zlib": "*", + "league/uri": "6.5.0" }, "require-dev": { - "phpunit/phpunit": "6.5.14", - "phpstan/phpstan": "1.4.6" + "ergebnis/composer-normalize": "2.23.1", + "phpstan/phpstan": "1.4.6", + "phpunit/phpunit": "8.5.23", + "roave/security-advisories": "dev-latest" }, "autoload": { "psr-4": { @@ -34,8 +36,19 @@ "ivuorinen\\Curly\\Tests\\": "tests/" } }, + "config": { + "allow-plugins": { + "ergebnis/composer-normalize": true + } + }, "scripts": { - "test": "vendor/bin/phpunit --colors --verbose", - "check": "vendor/bin/phpstan analyse src tests --level=7" + "post-update-cmd": [ + "@composer normalize" + ], + "post-package-install": [ + "@composer normalize" + ], + "check": "vendor/bin/phpstan analyse src tests --level=7", + "test": "vendor/bin/phpunit --colors --verbose" } }