Skip to content

Commit 5398efe

Browse files
committed
Merge branch 'pr/38' into dev-main
2 parents 11caf29 + 1f7abdc commit 5398efe

File tree

6 files changed

+3609
-28
lines changed

6 files changed

+3609
-28
lines changed

.github/workflows/run-tests.yml

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
1-
name: run-tests
1+
name: 'Run Tests'
2+
3+
on: ['push', 'pull_request']
24

3-
on:
4-
push:
5-
branches:
6-
- main
7-
- github-actions
85
jobs:
9-
test:
10-
runs-on: ubuntu-22.04
6+
ci:
7+
runs-on: ${{ matrix.os }}
8+
strategy:
9+
fail-fast: true
10+
matrix:
11+
os: [ubuntu-latest]
12+
php: [8.2, 8.3]
13+
laravel: [10.*, 11.*]
14+
dependency-version: [prefer-stable]
15+
1116
env:
1217
BROADCAST_DRIVER: log
1318
CACHE_DRIVER: redis
@@ -37,25 +42,40 @@ jobs:
3742
- 6379/tcp
3843
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
3944

45+
name: Tests P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }}
4046
steps:
4147
- name: Checkout 🛎
4248
uses: actions/checkout@v4
4349

50+
- name: Cache dependencies 🍬
51+
uses: actions/cache@v1
52+
with:
53+
path: ~/.composer/cache/files
54+
key: dependencies-php-${{ matrix.php }}-L${{ matrix.laravel }}-${{ matrix.dependency-version }}-composer-${{ hashFiles('composer.json') }}
55+
4456
- name: Verify Elasticsearch connection 🧩
4557
run: |
4658
curl -X GET "localhost:${{ job.services.elasticsearch.ports['9200'] }}/_cluster/health?pretty=true"
4759
4860
- name: Setup PHP 🏗
4961
uses: shivammathur/setup-php@v2
5062
with:
51-
php-version: 8.2
63+
php-version: ${{ matrix.php }}
5264
tools: composer:v2
53-
coverage: xdebug
65+
coverage: none
5466
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo, mysql
5567

56-
- name: Install Project Dependencies 💻
57-
run: |
58-
composer install --no-interaction --prefer-dist --optimize-autoloader
68+
- name: Require Laravel Version ✈
69+
run: >
70+
composer require
71+
"illuminate/support:${{ matrix.laravel }}"
72+
"illuminate/container:${{ matrix.laravel }}"
73+
"illuminate/database:${{ matrix.laravel }}"
74+
"illuminate/events:${{ matrix.laravel }}"
75+
--no-interaction --no-update
76+
77+
- name: Install Composer dependencies 💻
78+
run: composer update --${{ matrix.dependency-version }} --no-interaction --prefer-dist --optimize-autoloader
5979

6080
- name: List Installed Dependencies 📦
6181
run: composer show -D
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: Test Coverage
2+
on:
3+
push:
4+
branches:
5+
- main
6+
7+
jobs:
8+
laravel-tests:
9+
runs-on: ${{ matrix.os }}
10+
strategy:
11+
matrix:
12+
os: [ubuntu-latest]
13+
php: [8.2]
14+
laravel: [11.*]
15+
dependency-version: [prefer-stable]
16+
17+
env:
18+
BROADCAST_DRIVER: log
19+
CACHE_DRIVER: redis
20+
QUEUE_CONNECTION: redis
21+
SESSION_DRIVER: redis
22+
DB_CONNECTION: testing
23+
APP_KEY: base64:2fl+Ktvkfl+Fuz3Qp/A76G2RTiGVA/ZjKZaz6fiiM10=
24+
APP_ENV: testing
25+
BCRYPT_ROUNDS: 10
26+
MAIL_MAILER: array
27+
TELESCOPE_ENABLED: false
28+
29+
# Docs: https://docs.github.com/en/actions/using-containerized-services
30+
services:
31+
elasticsearch:
32+
image: elasticsearch:7.17.3
33+
env:
34+
discovery.type: single-node
35+
ES_JAVA_OPTS: '-Xms512m -Xmx512m'
36+
ports:
37+
- 9200:9200
38+
options: --health-cmd="curl http://localhost:9200/_cluster/health" --health-interval=10s --health-timeout=5s --health-retries=5
39+
40+
redis:
41+
image: redis
42+
ports:
43+
- 6379/tcp
44+
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
45+
46+
name: Coverage P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }}
47+
48+
steps:
49+
- name: Checkout 🛎
50+
uses: actions/checkout@v4
51+
52+
- name: Verify Elasticsearch connection 🧩
53+
run: |
54+
curl -X GET "localhost:${{ job.services.elasticsearch.ports['9200'] }}/_cluster/health?pretty=true"
55+
56+
- name: Setup PHP 🏗
57+
uses: shivammathur/setup-php@v2
58+
with:
59+
php-version: ${{ matrix.php }}
60+
tools: composer:v2
61+
coverage: xdebug
62+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo, mysql
63+
64+
- name: Require Laravel Version ✈
65+
run: >
66+
composer require
67+
"illuminate/support:${{ matrix.laravel }}"
68+
"illuminate/container:${{ matrix.laravel }}"
69+
"illuminate/database:${{ matrix.laravel }}"
70+
"illuminate/events:${{ matrix.laravel }}"
71+
--no-interaction --no-update
72+
73+
- name: Install Composer dependencies 💻
74+
run: composer update --${{ matrix.dependency-version }} --no-interaction --prefer-dist --optimize-autoloader
75+
76+
- name: List Installed Dependencies 📦
77+
run: composer show -D
78+
79+
# Code quality
80+
81+
- name: Run tests with coverage 🧪
82+
run: |
83+
./vendor/bin/pest --version
84+
./vendor/bin/pest --coverage-clover clover.xml
85+
env:
86+
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
87+
ELASTICSEARCH_PORT: ${{ job.services.elasticsearch.ports['9200'] }}
88+
89+
- name: Generate test coverage badge 🖼
90+
uses: timkrase/phpunit-coverage-badge@v1.2.0
91+
with:
92+
coverage_badge_path: 'badge-coverage.svg'
93+
push_badge: true
94+
repo_token: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
# Laravel-Elasticsearch
44

55
[![Latest Stable Version](http://img.shields.io/github/release/pdphilip/laravel-elasticsearch.svg)](https://packagist.org/packages/pdphilip/elasticsearch)
6-
[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/pdphilip/laravel-elasticsearch/run-tests.yml?branch=main&label=tests&style=flat-square)](https://github.com/pdphilip/laravel-elasticsearch/actions/workflows/run-tests.yml?query=branch%3Amain)
6+
[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/pdphilip/laravel-elasticsearch/run-tests.yml?branch=main&label=tests&style=flat-square)](https://github.com/pdphilip/laravel-elasticsearch/actions/workflows/run-tests.yml?query=branch%3Amain)
7+
[![Test Coverage](badge-coverage.svg)](https://packagist.org/packages/pdphilip/elasticsearchy)
78
[![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/pdphilip/laravel-elasticsearch/phpstan.yml?branch=main&label=code%20style&style=flat-square)](https://github.com/pdphilip/laravel-elasticsearch/actions/workflows/phpstan.yml?query=branch%3Amain++)
89
[![Total Downloads](http://img.shields.io/packagist/dm/pdphilip/elasticsearch.svg)](https://packagist.org/packages/pdphilip/elasticsearch)
10+
911
### Laravel-Elasticsearch: An Elasticsearch implementation of Laravel's Eloquent ORM
1012

1113
This package extends Laravel's Eloquent model and query builder with seamless integration of Elasticsearch functionalities. Designed to feel native to Laravel, this package enables you to work with Eloquent models while leveraging the
@@ -38,10 +40,15 @@ $search = UserProfile::phrase('loves espressos')->highlight()->search();
3840
```
3941

4042
### Read the [Documentation](https://elasticsearch.pdphilip.com/)
43+
4144
---
45+
4246
> #### Using [OpenSearch](https://opensearch.pdphilip.com/)? [Github](https://github.com/pdphilip/laravel-opensearch)
47+
4348
---
49+
4450
> #### [Package Tests](https://github.com/pdphilip/laravel-elasticsearch-tests)
51+
4552
---
4653

4754
## Installation
@@ -55,26 +62,26 @@ composer require pdphilip/elasticsearch
5562
```
5663

5764
| Laravel Version | Command | Maintained |
58-
|-----------------|------------------------------------------------|------------|
59-
| Laravel 10 & 11 | `composer require pdphilip/elasticsearch:~4 ` | |
60-
| Laravel 9 | `composer require pdphilip/elasticsearch:~3.9` | |
61-
| Laravel 8 | `composer require pdphilip/elasticsearch:~3.8` | |
65+
| --------------- | ---------------------------------------------- | ---------- |
66+
| Laravel 10 & 11 | `composer require pdphilip/elasticsearch:~4 ` ||
67+
| Laravel 9 | `composer require pdphilip/elasticsearch:~3.9` ||
68+
| Laravel 8 | `composer require pdphilip/elasticsearch:~3.8` ||
6269

6370
### Unmaintained versions (Elasticsearch 8.x):
6471

6572
| Laravel Version | Command | Maintained |
66-
|-------------------|------------------------------------------------|------------|
67-
| Laravel 7.x | `composer require pdphilip/elasticsearch:~2.7` | |
68-
| Laravel 6.x (5.8) | `composer require pdphilip/elasticsearch:~2.6` | |
73+
| ----------------- | ---------------------------------------------- | ---------- |
74+
| Laravel 7.x | `composer require pdphilip/elasticsearch:~2.7` ||
75+
| Laravel 6.x (5.8) | `composer require pdphilip/elasticsearch:~2.6` ||
6976

7077
### Unmaintained versions (Elasticsearch 7.x):
7178

7279
| Laravel Version | Command | Maintained |
73-
|-------------------|------------------------------------------------|------------|
74-
| Laravel 9.x | `composer require pdphilip/elasticsearch:~1.9` | |
75-
| Laravel 8.x | `composer require pdphilip/elasticsearch:~1.8` | |
76-
| Laravel 7.x | `composer require pdphilip/elasticsearch:~1.7` | |
77-
| Laravel 6.x (5.8) | `composer require pdphilip/elasticsearch:~1.6` | |
80+
| ----------------- | ---------------------------------------------- | ---------- |
81+
| Laravel 9.x | `composer require pdphilip/elasticsearch:~1.9` ||
82+
| Laravel 8.x | `composer require pdphilip/elasticsearch:~1.8` ||
83+
| Laravel 7.x | `composer require pdphilip/elasticsearch:~1.7` ||
84+
| Laravel 6.x (5.8) | `composer require pdphilip/elasticsearch:~1.6` ||
7885

7986
## Configuration
8087

badge-coverage.svg

Lines changed: 16 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)