Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
imanghafoori1 committed Jul 10, 2024
2 parents 1726983 + f1880ae commit 818f688
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 5 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/code_coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Code Coverage

# Controls when the workflow will run
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

# 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
env:
XDEBUG_MODE: coverage

#- name: Make code coverage badge
# uses: timkrase/[email protected]
# 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
36 changes: 36 additions & 0 deletions .github/workflows/imports.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Check Imports

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

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 && composer require imanghafoori/php-imports-analyzer

- name: Check Imports
run: ./vendor/bin/check_imports
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 }}
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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)


Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion tests/CastTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use Imanghafoori\SearchReplace\Searcher;

class Cast extends BaseTestClass
class CastTest extends BaseTestClass
{
/** @test */
public function number_matching()
Expand Down

0 comments on commit 818f688

Please sign in to comment.