Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Laravel 11 support tests #3

Merged
merged 2 commits into from
Mar 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
150 changes: 97 additions & 53 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -1,53 +1,97 @@
name: run-tests

on:
push:
branches: [main, dev]
pull_request:
branches: [main]

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest]
php: [8.2, 8.1]
laravel: [10.*]
stability: [prefer-lowest, prefer-stable]
include:
- laravel: 10.*
testbench: 8.*
carbon: ^2.63

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- 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, fileinfo
coverage: none

- name: Setup problem matchers
run: |
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "nesbot/carbon:${{ matrix.carbon }}" --no-interaction --no-update
composer update --${{ matrix.stability }} --prefer-dist --no-interaction

- name: List Installed Dependencies
run: composer show -D

- name: Execute tests
run: vendor/bin/phpunit
env:
TEAMS_WEBHOOK_URL: ${{ secrets.TEAMS_WEBHOOK_URL }}
name: run-tests

on:
push:
branches: [main, dev]
pull_request:
branches: [main]

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest]
php: [8.1, 8.2, 8.3]
laravel: [10.*]
stability: [prefer-lowest, prefer-stable]
include:
- laravel: 10.*
testbench: 8.*
carbon: ^2.63

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- 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, fileinfo
coverage: none

- name: Setup problem matchers
run: |
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "nesbot/carbon:${{ matrix.carbon }}" --no-interaction --no-update
composer update --${{ matrix.stability }} --prefer-dist --no-interaction

- name: List Installed Dependencies
run: composer show -D

- name: Execute tests
run: vendor/bin/phpunit
env:
TEAMS_WEBHOOK_URL: ${{ secrets.TEAMS_WEBHOOK_URL }}
test2:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest]
php: [8.2, 8.3]
laravel: [11.*]
stability: [prefer-lowest, prefer-stable]
include:
- laravel: 11.*
testbench: 9.*
carbon: ^2.63

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- 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, fileinfo
coverage: none

- name: Setup problem matchers
run: |
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "nesbot/carbon:${{ matrix.carbon }}" --no-interaction --no-update
composer update --${{ matrix.stability }} --prefer-dist --no-interaction

- name: List Installed Dependencies
run: composer show -D

- name: Execute tests
run: vendor/bin/phpunit
env:
TEAMS_WEBHOOK_URL: ${{ secrets.TEAMS_WEBHOOK_URL }}
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
# Laravel Teams Logger
[![Latest Version on Packagist](https://img.shields.io/packagist/v/kopitar/laravel-teams-logger.svg?style=flat-square)](https://packagist.org/packages/kopitar/laravel-teams-logger)
[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/kopitar/laravel-teams-logger/run-tests.yml?branch=main&label=tests&style=flat-square)](https://github.com/kopitar/laravel-teams-logger/actions?query=workflow%3Arun-tests+branch%3Amain)
[![Total downloads](https://img.shields.io/packagist/dt/kopitar/laravel-teams-logger.svg?style=flat-square)](https://packagist.org/packages/kopitar/laravel-teams-logger)

Log handler for Laravel for sending log messages to Microsoft Teams with the [Teams Incoming Webhook Connector](https://learn.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/add-incoming-webhook).

**Tested on Laravel 10.x (PHP 8.2, 8.1)**
**Tested on:**
* Laravel 10.x (PHP 8.3, 8.2, 8.1)
* Laravel 11.x (PHP 8.3, 8.2)

# Features

* send simple styled log messages
* send card styled log messages
* send card styled **log* messages
* include facts in card log messages
* include actions in card log messages
* configurable content and visuals (colors, avatars)
Expand Down Expand Up @@ -64,7 +67,7 @@ To change colors or avatar images you need to replace the values found for each
To send a simple style log message to Teams use the following code (assuming `type` is configured to `simple`):

```php
Log::channel('teams')->debug('Neque porro quisquam est qui dolorem!');
Log::channel('teams')->info('Neque porro quisquam est qui dolorem!');
```

**Result:**
Expand All @@ -77,7 +80,7 @@ Log::channel('teams')->debug('Neque porro quisquam est qui dolorem!');
To send a card style log message to Teams use the following code (assuming `type` is configured to `card` and `use_avatar` is set to `true`):

```php
Log::channel('teams')->info('Neque porro quisquam est qui dolorem!');
Log::channel('teams')->debug('Neque porro quisquam est qui dolorem!');
```

**Result:**
Expand Down Expand Up @@ -208,4 +211,4 @@ Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed re

# License

This laravel-teams-logging package is available under the MIT license. See [LICENSE.md](LICENSE.md) file for more info.
This laravel-teams-logging package is available under the MIT license. See [LICENSE.md](LICENSE.md) file for more info.
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
"monolog/monolog": "^3.0"
},
"require-dev": {
"illuminate/support": "^10.0",
"orchestra/testbench": "^8.0",
"illuminate/support": "^10.0|^11.0",
"orchestra/testbench": "^8.0|^9.0",
"phpunit/phpunit": "^10.3.1"
},
"autoload": {
Expand All @@ -46,4 +46,4 @@
"./vendor/bin/phpunit ./tests"
]
}
}
}