From b3828e4628f225778b2646a4b6aa41413496e072 Mon Sep 17 00:00:00 2001 From: Iman Ghafoori Date: Thu, 23 Nov 2023 23:46:02 +0330 Subject: [PATCH 1/5] Installable on PHP v8.3.* --- .github/workflows/tests.yml | 2 +- composer.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 58c8df0..eebc553 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -16,7 +16,7 @@ jobs: strategy: fail-fast: true matrix: - php: ["8.2", "8.1", "8.0", "7.4", "7.3", "7.2"] + php: ["8.3", "8.2", "8.1", "8.0", "7.4", "7.3", "7.2"] dependency-version: [prefer-stable] name: P${{ matrix.php }} - ${{ matrix.dependency-version }} diff --git a/composer.json b/composer.json index 25636aa..ce2f720 100644 --- a/composer.json +++ b/composer.json @@ -15,10 +15,10 @@ } ], "require": { - "php": "^7.1.3|8.0.*|8.1.*|8.2.*" + "php": "^7.1.3|8.0.*|8.1.*|8.2.*|8.3.*" }, "require-dev": { - "phpunit/phpunit": "^8.0|^9.0", + "phpunit/phpunit": "^8.0|^9.0|^10.0", "symfony/var-dumper": "^5.3" }, "autoload": { From fc25855ad19052662af0e1000083df9635e8fd76 Mon Sep 17 00:00:00 2001 From: Iman Ghafoori Date: Sat, 15 Jun 2024 13:23:46 +0330 Subject: [PATCH 2/5] Add github actions --- .github/workflows/code_coverage.yml | 58 +++++++++++++++++++++++++++++ .github/workflows/imports.yml | 36 ++++++++++++++++++ tests/CastTest.php | 2 +- 3 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/code_coverage.yml create mode 100644 .github/workflows/imports.yml diff --git a/.github/workflows/code_coverage.yml b/.github/workflows/code_coverage.yml new file mode 100644 index 0000000..45ae243 --- /dev/null +++ b/.github/workflows/code_coverage.yml @@ -0,0 +1,58 @@ +name: Code Coverage + +# Controls when the workflow will run +on: + push: + branches: [master] + pull_request: + branches: [master] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + test: + # The type of runner that the job will run on + runs-on: ${{ matrix.os }} + strategy: + fail-fast: true + matrix: + os: [ubuntu-latest] + php: [8.3] + name: PHP ${{ matrix.php }} - OS ${{ matrix.os }} + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 3 + - name: Setup PHP v${{ matrix.php }} + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: mbstring, exif, iconv, tokenizer, fileinfo, xdebug + coverage: xdebug + + - name: Install dependencies + run: | + composer update --prefer-dist --no-interaction --no-progress + + - name: PHPUnit + run: | + ./vendor/bin/phpunit --stop-on-failure --coverage-clover ./clover.xml -c ./phpunit_conf/coverage.xml.dist + env: + XDEBUG_MODE: coverage + + #- name: Make code coverage badge + # uses: timkrase/phpunit-coverage-badge@v1.2.1 + # with: + # coverage_badge_path: output/coverage.svg + # repo_token: ${{ secrets.GITHUB_TOKEN }} + # push_badge: true + - name: Upload coverage results to Coveralls + env: + COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + composer global require php-coveralls/php-coveralls + php-coveralls --coverage_clover=./clover.xml --json_path=./coverall.xml -v diff --git a/.github/workflows/imports.yml b/.github/workflows/imports.yml new file mode 100644 index 0000000..b89c8ea --- /dev/null +++ b/.github/workflows/imports.yml @@ -0,0 +1,36 @@ +name: Check Imports + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +permissions: + contents: read + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Validate composer.json and composer.lock + run: composer validate --strict + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v3 + with: + path: vendor + key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php- + + - name: Install dependencies + run: composer install --prefer-dist --no-progress + + - name: Check Imports + run: ./vendor/bin/check_imports diff --git a/tests/CastTest.php b/tests/CastTest.php index 05ba694..8605337 100644 --- a/tests/CastTest.php +++ b/tests/CastTest.php @@ -4,7 +4,7 @@ use Imanghafoori\SearchReplace\Searcher; -class Cast extends BaseTestClass +class CastTest extends BaseTestClass { /** @test */ public function number_matching() From 81ab1ff0041ca821111b6098c282f5192c612e24 Mon Sep 17 00:00:00 2001 From: Iman Date: Sat, 15 Jun 2024 13:38:35 +0330 Subject: [PATCH 3/5] Update code_coverage.yml --- .github/workflows/code_coverage.yml | 6 +++--- .github/workflows/imports.yml | 4 ++-- .github/workflows/tests.yml | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/code_coverage.yml b/.github/workflows/code_coverage.yml index 45ae243..ee86cd3 100644 --- a/.github/workflows/code_coverage.yml +++ b/.github/workflows/code_coverage.yml @@ -3,9 +3,9 @@ name: Code Coverage # Controls when the workflow will run on: push: - branches: [master] + branches: [ "main" ] pull_request: - branches: [master] + branches: [ "main" ] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: @@ -40,7 +40,7 @@ jobs: - name: PHPUnit run: | - ./vendor/bin/phpunit --stop-on-failure --coverage-clover ./clover.xml -c ./phpunit_conf/coverage.xml.dist + ./vendor/bin/phpunit --stop-on-failure --coverage-clover ./clover.xml env: XDEBUG_MODE: coverage diff --git a/.github/workflows/imports.yml b/.github/workflows/imports.yml index b89c8ea..c9406c6 100644 --- a/.github/workflows/imports.yml +++ b/.github/workflows/imports.yml @@ -2,9 +2,9 @@ name: Check Imports on: push: - branches: [ "master" ] + branches: [ "main" ] pull_request: - branches: [ "master" ] + branches: [ "main" ] permissions: contents: read diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index eebc553..9eb7574 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -3,7 +3,7 @@ name: tests # Controls when the workflow will run on: pull_request: - branches: [ main ] + branches: [ "main" ] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: From 52e715104d873f481302abc273fc9cdcdb1e1e09 Mon Sep 17 00:00:00 2001 From: Iman Ghafoori Date: Sat, 15 Jun 2024 13:45:34 +0330 Subject: [PATCH 4/5] Update code_coverage.yml --- .github/workflows/imports.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/imports.yml b/.github/workflows/imports.yml index c9406c6..00cf970 100644 --- a/.github/workflows/imports.yml +++ b/.github/workflows/imports.yml @@ -30,7 +30,7 @@ jobs: ${{ runner.os }}-php- - name: Install dependencies - run: composer install --prefer-dist --no-progress + run: composer install --prefer-dist --no-progress && composer require imanghafoori/php-imports-analyzer - name: Check Imports run: ./vendor/bin/check_imports From f1880ae4a7dcbbf18cbd5c8d775c35af64b46a16 Mon Sep 17 00:00:00 2001 From: Iman Date: Sat, 15 Jun 2024 13:56:56 +0330 Subject: [PATCH 5/5] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 73a3ca3..d805f39 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,9 @@ # Php Smart Search/replace Functionality [![tests](https://github.com/imanghafoori1/php-smart-search-replace/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/imanghafoori1/php-smart-search-replace/actions/workflows/tests.yml) +[![Coverage Status](https://coveralls.io/repos/github/imanghafoori1/php-smart-search-replace/badge.svg?branch=main)](https://coveralls.io/github/imanghafoori1/php-smart-search-replace?branch=main) [![Total Downloads](https://img.shields.io/packagist/dt/imanghafoori/php-search-replace.svg?style=flat-square)](https://packagist.org/packages/imanghafoori/php-search-replace) [![Latest Stable Version](https://poser.pugx.org/imanghafoori/php-search-replace/v/stable?format=flat-square)](https://packagist.org/packages/imanghafoori/php-search-replace) +[![Check Imports](https://github.com/imanghafoori1/php-smart-search-replace/actions/workflows/imports.yml/badge.svg?branch=main)](https://github.com/imanghafoori1/php-smart-search-replace/actions/workflows/imports.yml) [![MIT Licensed](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)