Skip to content

Commit

Permalink
Merge pull request #24 from XetaIO/github-actions
Browse files Browse the repository at this point in the history
Test adding github action to the repository
  • Loading branch information
Xety authored Mar 22, 2022
2 parents a45d96d + 662a5d9 commit 90f0b9e
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 33 deletions.
49 changes: 27 additions & 22 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,41 @@
name: PHP Composer
name: Unit Tests

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:

PHPUnit:
runs-on: ubuntu-latest
strategy:
matrix:
php:
- 8.1
- 8.0
- 7.4
- 7.3

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@develop
with:
php-version: ${{ matrix.php }}

- name: Validate composer.json and composer.lock
run: composer validate --strict
- run: php -v

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
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: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Create Database
run: |
touch tests/vendor/temp/database.sqlite
chmod 775 tests/vendor/temp/database.sqlite
# Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit"
# Docs: https://getcomposer.org/doc/articles/scripts.md
- name: Run tests
run: vendor/bin/phpunit --coverage-clover tests/vendor/temp/coverage.xml

- name: Run tests
run: vendor/bin/phpunit
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
files: tests/vendor/temp/coverage.xml
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
> <h1 align="center">Xetaravel Mentions</h1>
>
> |Travis|Coverage|Stable Version|Downloads|Laravel|License|
> |Unit Tests|Coverage|Stable Version|Downloads|Laravel|License|
> |:-------:|:------:|:-------:|:------:|:-------:|:-------:|
> |[![Build Status](https://img.shields.io/travis/XetaIO/Xetaravel-Mentions.svg?style=flat-square)](https://travis-ci.org/XetaIO/Xetaravel-Mentions)|[![Coverage Status](https://img.shields.io/coveralls/XetaIO/Xetaravel-Mentions/master.svg?style=flat-square)](https://coveralls.io/r/XetaIO/Xetaravel-Mentions)|[![Latest Stable Version](https://img.shields.io/packagist/v/XetaIO/Xetaravel-Mentions.svg?style=flat-square)](https://packagist.org/packages/xetaio/xetaravel-mentions)|[![Total Downloads](https://img.shields.io/packagist/dt/xetaio/xetaravel-mentions.svg?style=flat-square)](https://packagist.org/packages/xetaio/xetaravel-mentions)|[![Laravel 8.0](https://img.shields.io/badge/Laravel->=8.0-f4645f.svg?style=flat-square)](http://laravel.com)|[![License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](https://github.com/XetaIO/Xetaravel-Mentions/blob/master/LICENSE)|
> |[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/XetaIO/Xetaravel-Mentions/Unit%20Tests?style=flat-square)](https://github.com/XetaIO/Xetaravel-Mentions/actions/workflows/tests.yml)|[![Coverage Status](https://img.shields.io/codecov/c/github/XetaIO/Xetaravel-Mentions?style=flat-square)](https://app.codecov.io/gh/XetaIO/Xetaravel-Mentions)|[![Latest Stable Version](https://img.shields.io/packagist/v/XetaIO/Xetaravel-Mentions.svg?style=flat-square)](https://packagist.org/packages/xetaio/xetaravel-mentions)|[![Total Downloads](https://img.shields.io/packagist/dt/xetaio/xetaravel-mentions.svg?style=flat-square)](https://packagist.org/packages/xetaio/xetaravel-mentions)|[![Laravel 8.0](https://img.shields.io/badge/Laravel->=8.0-f4645f.svg?style=flat-square)](http://laravel.com)|[![License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](https://github.com/XetaIO/Xetaravel-Mentions/blob/master/LICENSE)|
>
> A package to parse `@mentions` from a text and mention the user with a notification.
>
> **By default** this package is configured to parse any text type and it will replace any matched `@mention` with a markdown link (`[@Mention](/users/profile/@Mention)`) if the mentionned user exist in the database. It will also send a notification with the Laravel `Notifiable` trait to all mentionned users. (Inspired from the [laravel-mentions](https://github.com/jameslkingsley/laravel-mentions) package.)
>
>![Codecov](https://img.shields.io/codecov/c/github/XetaIO/Xetaravel-Mentions?style=flat-square)
> Quick example :
>
> **Input** text :
Expand Down
4 changes: 4 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
stopOnFailure="false"
verbose="true"
>
<php>
<ini name="xdebug.mode" value="coverage" />
<env name="XDEBUG_MODE" value="coverage" />
</php>
<testsuites>
<testsuite name="Xetaravel Mentions Test Suite">
<directory suffix=".php">./tests/</directory>
Expand Down
9 changes: 1 addition & 8 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,6 @@ protected function getEnvironmentSetUp($app)
protected function setupDatabase()
{
$databasePath = __DIR__.'/vendor/temp/database.sqlite';

if (file_exists($databasePath)) {
@unlink($databasePath);
}

if (!file_exists($databasePath)) {
file_put_contents($databasePath, '');
}
file_put_contents($databasePath, '');
}
}

0 comments on commit 90f0b9e

Please sign in to comment.