From 8572b53b91725d1c2db290b24c75a857f34cbbcd Mon Sep 17 00:00:00 2001 From: Niels Date: Mon, 9 Nov 2020 15:39:54 +0100 Subject: [PATCH 1/6] add github actions for running CI tests --- .github/workflows/run-tests.yml | 50 +++++++++++++++++++++++++++++++++ composer.json | 4 +-- 2 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/run-tests.yml diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml new file mode 100644 index 0000000..5467fe4 --- /dev/null +++ b/.github/workflows/run-tests.yml @@ -0,0 +1,50 @@ +name: run-tests + +on: [push, pull_request] + +jobs: + test: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + php: [8.0, 7.4, 7.3, 7.2] + laravel: [8.*, 7.*, 6.*] + dependency-version: [prefer-lowest, prefer-stable] + include: + - laravel: 8.* + testbench: 6.* + - laravel: 7.* + testbench: 5.* + - laravel: 6.* + testbench: 4.* + exclude: + - laravel: 8.* + php: 7.2 + + name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} - ${{ matrix.os }} + + steps: + - name: Checkout code + uses: actions/checkout@v1 + + - name: Cache dependencies + uses: actions/cache@v1 + with: + path: ~/.composer/cache/files + key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }} + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick + coverage: none + + - name: Install dependencies + run: | + composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update + composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest + - name: Execute tests + run: vendor/bin/phpunit diff --git a/composer.json b/composer.json index 597aa5b..3c177b3 100644 --- a/composer.json +++ b/composer.json @@ -16,10 +16,10 @@ } ], "require": { - "php": "^7.2" + "php": "^7.2|^8.0" }, "require-dev": { - "phpunit/phpunit": "^8.0" + "phpunit/phpunit": "^8.0|^9.0" }, "autoload": { "psr-4": { From 855343de352183fd62f64535811d24772b761a7a Mon Sep 17 00:00:00 2001 From: Niels Date: Mon, 9 Nov 2020 15:40:57 +0100 Subject: [PATCH 2/6] delete scrutinizer, travis and styleci config --- .scrutinizer.yml | 19 ------------------- .styleci.yml | 1 - .travis.yml | 17 ----------------- composer.json | 1 + 4 files changed, 1 insertion(+), 37 deletions(-) delete mode 100644 .scrutinizer.yml delete mode 100644 .styleci.yml delete mode 100644 .travis.yml diff --git a/.scrutinizer.yml b/.scrutinizer.yml deleted file mode 100644 index df16b68..0000000 --- a/.scrutinizer.yml +++ /dev/null @@ -1,19 +0,0 @@ -filter: - excluded_paths: [tests/*] - -checks: - php: - remove_extra_empty_lines: true - remove_php_closing_tag: true - remove_trailing_whitespace: true - fix_use_statements: - remove_unused: true - preserve_multiple: false - preserve_blanklines: true - order_alphabetically: true - fix_php_opening_tag: true - fix_linefeed: true - fix_line_ending: true - fix_identation_4spaces: true - fix_doc_comments: true - diff --git a/.styleci.yml b/.styleci.yml deleted file mode 100644 index 0285f17..0000000 --- a/.styleci.yml +++ /dev/null @@ -1 +0,0 @@ -preset: laravel diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 6a8cfe7..0000000 --- a/.travis.yml +++ /dev/null @@ -1,17 +0,0 @@ -language: php - -php: - - 7.2 - - 7.3 - -env: - matrix: - - COMPOSER_FLAGS="--prefer-lowest" - - COMPOSER_FLAGS="" - -before_script: - - travis_retry composer self-update - - travis_retry composer update ${COMPOSER_FLAGS} --no-interaction --prefer-source - -script: - - phpunit --coverage-text --coverage-clover=coverage.clover diff --git a/composer.json b/composer.json index 3c177b3..e3fb914 100644 --- a/composer.json +++ b/composer.json @@ -3,6 +3,7 @@ "description": "Easily create, use and destroy temporary directories", "keywords": [ "spatie", + "php", "temporary-directory" ], "homepage": "https://github.com/spatie/temporary-directory", From 5f7d1c84e9fbe238c2c4b580445ae269e60ae296 Mon Sep 17 00:00:00 2001 From: Niels Date: Mon, 9 Nov 2020 16:10:32 +0100 Subject: [PATCH 3/6] add Github Action for code styling --- .github/workflows/php-cs-fixer.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/php-cs-fixer.yml diff --git a/.github/workflows/php-cs-fixer.yml b/.github/workflows/php-cs-fixer.yml new file mode 100644 index 0000000..84ab01a --- /dev/null +++ b/.github/workflows/php-cs-fixer.yml @@ -0,0 +1,29 @@ +name: Check & fix styling + +on: [push] + +jobs: + style: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Fix style + uses: docker://oskarstark/php-cs-fixer-ga + with: + args: --config=.php_cs --allow-risky=yes + + - name: Extract branch name + shell: bash + run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" + id: extract_branch + + - name: Commit changes + uses: stefanzweifel/git-auto-commit-action@v2.3.0 + with: + commit_message: Fix styling + branch: ${{ steps.extract_branch.outputs.branch }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 8a6dbaa1a445995961f44cbde044e9b4abbc1a8e Mon Sep 17 00:00:00 2001 From: Niels Date: Mon, 9 Nov 2020 16:20:25 +0100 Subject: [PATCH 4/6] add php_cs config file --- CONTRIBUTING.md => .github/CONTRIBUTING.md | 0 .github/workflows/php-cs-fixer.yml | 2 +- .php_cs.dist | 40 ++++++++++++++++++++++ README.md | 4 +-- 4 files changed, 43 insertions(+), 3 deletions(-) rename CONTRIBUTING.md => .github/CONTRIBUTING.md (100%) create mode 100644 .php_cs.dist diff --git a/CONTRIBUTING.md b/.github/CONTRIBUTING.md similarity index 100% rename from CONTRIBUTING.md rename to .github/CONTRIBUTING.md diff --git a/.github/workflows/php-cs-fixer.yml b/.github/workflows/php-cs-fixer.yml index 84ab01a..7c5f3ee 100644 --- a/.github/workflows/php-cs-fixer.yml +++ b/.github/workflows/php-cs-fixer.yml @@ -13,7 +13,7 @@ jobs: - name: Fix style uses: docker://oskarstark/php-cs-fixer-ga with: - args: --config=.php_cs --allow-risky=yes + args: --config=.php_cs.dist --allow-risky=yes - name: Extract branch name shell: bash diff --git a/.php_cs.dist b/.php_cs.dist new file mode 100644 index 0000000..ac127a7 --- /dev/null +++ b/.php_cs.dist @@ -0,0 +1,40 @@ +in([ + __DIR__ . '/src', + __DIR__ . '/tests', + ]) + ->name('*.php') + ->notName('*.blade.php') + ->ignoreDotFiles(true) + ->ignoreVCS(true); + +return PhpCsFixer\Config::create() + ->setRules([ + '@PSR2' => true, + 'array_syntax' => ['syntax' => 'short'], + 'ordered_imports' => ['sortAlgorithm' => 'alpha'], + 'no_unused_imports' => true, + 'not_operator_with_successor_space' => true, + 'trailing_comma_in_multiline_array' => true, + 'phpdoc_scalar' => true, + 'unary_operator_spaces' => true, + 'binary_operator_spaces' => true, + 'blank_line_before_statement' => [ + 'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'], + ], + 'phpdoc_single_line_var_spacing' => true, + 'phpdoc_var_without_name' => true, + 'class_attributes_separation' => [ + 'elements' => [ + 'method', + ], + ], + 'method_argument_space' => [ + 'on_multiline' => 'ensure_fully_multiline', + 'keep_multiple_spaces_after_comma' => true, + ], + 'single_trait_insert_per_statement' => true, + ]) + ->setFinder($finder); diff --git a/README.md b/README.md index e308fa6..822c741 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ # Quickly create, use and delete temporary directories [![Latest Version on Packagist](https://img.shields.io/packagist/v/spatie/temporary-directory.svg?style=flat-square)](https://packagist.org/packages/spatie/temporary-directory) +![Tests](https://github.com/spatie/temporary-directory/workflows/Tests/badge.svg) [![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md) [![Build Status](https://img.shields.io/travis/spatie/temporary-directory/master.svg?style=flat-square)](https://travis-ci.org/spatie/temporary-directory) [![Quality Score](https://img.shields.io/scrutinizer/g/spatie/temporary-directory.svg?style=flat-square)](https://scrutinizer-ci.com/g/spatie/temporary-directory) -[![StyleCI](https://styleci.io/repos/80403728/shield?branch=master)](https://styleci.io/repos/80403728) [![Total Downloads](https://img.shields.io/packagist/dt/spatie/temporary-directory.svg?style=flat-square)](https://packagist.org/packages/spatie/temporary-directory) This package allows you to quickly create, use and delete a temporary directory in the system's temporary directory. @@ -122,7 +122,7 @@ composer test ## Contributing -Please see [CONTRIBUTING](CONTRIBUTING.md) for details. +Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details. ## Security From 153e7f3a87bd69e642de788957325215e0995f86 Mon Sep 17 00:00:00 2001 From: Niels Date: Mon, 9 Nov 2020 16:24:15 +0100 Subject: [PATCH 5/6] remove badges --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 822c741..c6f1e96 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,6 @@ [![Latest Version on Packagist](https://img.shields.io/packagist/v/spatie/temporary-directory.svg?style=flat-square)](https://packagist.org/packages/spatie/temporary-directory) ![Tests](https://github.com/spatie/temporary-directory/workflows/Tests/badge.svg) [![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md) -[![Build Status](https://img.shields.io/travis/spatie/temporary-directory/master.svg?style=flat-square)](https://travis-ci.org/spatie/temporary-directory) -[![Quality Score](https://img.shields.io/scrutinizer/g/spatie/temporary-directory.svg?style=flat-square)](https://scrutinizer-ci.com/g/spatie/temporary-directory) [![Total Downloads](https://img.shields.io/packagist/dt/spatie/temporary-directory.svg?style=flat-square)](https://packagist.org/packages/spatie/temporary-directory) This package allows you to quickly create, use and delete a temporary directory in the system's temporary directory. From 960df397889700849a78c43f6163a3bd8e655743 Mon Sep 17 00:00:00 2001 From: Niels Date: Mon, 9 Nov 2020 16:27:15 +0100 Subject: [PATCH 6/6] update CHANGELOG.md --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 51457c7..9320256 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to `temporary-directory` will be documented in this file +## 1.3.0 - 2020-11-09 + +- support for PHP 8 (#44) + ## 1.2.4 - 2020-09-06 - force php garbage collection cycle (#40)