Skip to content

Commit 42aed23

Browse files
authored
Merge branch 'master' into issue-103/reimport-command
2 parents 13428db + 1eb0bd7 commit 42aed23

22 files changed

+424
-73
lines changed

.circleci/config.yml

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# PHP CircleCI 2.0 configuration file
2+
#
3+
# Check https://circleci.com/docs/2.0/language-php/ for more details
4+
#
5+
version: 2.1
6+
7+
aliases:
8+
- &restore_cache
9+
name: restore Composer cache
10+
keys:
11+
- composer-deps-<<parameters.version>>-{{ checksum "composer.json" }}
12+
13+
- &install_dependencies
14+
name: Install Composer dependencies
15+
command: COMPOSER_MEMORY_LIMIT=-1 composer require "illuminate/contracts=<<parameters.laravel>>" --dev --prefer-dist --no-interaction
16+
17+
- &save_cache
18+
name: save Composer cache
19+
key: composer-deps-<<parameters.version>>-{{ checksum "composer.json" }}
20+
paths:
21+
- ./vendor
22+
23+
- &credentials
24+
name: Get API Key Dealer client
25+
command: wget https://alg.li/algolia-keys && chmod +x algolia-keys
26+
27+
- &test
28+
name: Run tests
29+
command: |
30+
export CI_BUILD_NUM=$CIRCLE_BUILD_NUM
31+
export COMPOSER_PROCESS_TIMEOUT=900
32+
if [ -z ${CIRCLE_PR_REPONAME+x} ]
33+
then
34+
composer test
35+
else
36+
export CI_PROJ_USERNAME=$CIRCLE_PROJECT_USERNAME
37+
export CI_PROJ_REPONAME=$CIRCLE_PROJECT_REPONAME
38+
export TRAVIS_REPO_SLUG="$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME"
39+
40+
eval $(./algolia-keys export) && composer test
41+
fi
42+
43+
executors:
44+
php-docker: # declares a reusable executor
45+
parameters:
46+
version:
47+
description: "PHP version tag"
48+
type: string
49+
docker:
50+
- image: circleci/php:<<parameters.version>>
51+
52+
jobs:
53+
test:
54+
parameters:
55+
version:
56+
description: "PHP version tag"
57+
type: string
58+
laravel:
59+
description: "Laravel version tag"
60+
type: string
61+
62+
executor:
63+
name: php-docker
64+
version: <<parameters.version>>
65+
66+
steps:
67+
- checkout
68+
69+
- run: sudo apt update
70+
- run: sudo docker-php-ext-install zip
71+
- restore_cache: *restore_cache
72+
- run: *install_dependencies
73+
- save_cache: *save_cache
74+
- run: *credentials
75+
- run: *test
76+
77+
workflows:
78+
workflow:
79+
jobs:
80+
- test:
81+
matrix:
82+
parameters:
83+
version: ['7.3', '7.4', '8.0']
84+
laravel: ['^6.0', '^7.0', '^8.0']

.dockerignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.idea/*
2+
.phpintel
3+
/vendor/
4+
.phpunit.result.cache

.github/ISSUE_TEMPLATE.md

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<!--
2+
Please use this issue tracker only for reporting bugs or feature requests.
3+
4+
If you need support, please use:
5+
6+
- our community forum
7+
http://discourse.algolia.com
8+
9+
- StackOverflow with the `algolia` tag
10+
https://stackoverflow.com/questions/tagged/algolia
11+
12+
-->
13+
14+
- Laravel version:
15+
- Algolia Scout Extended version:
16+
- Algolia Client Version: #.#.#
17+
- Language Version:
18+
19+
### Description
20+
21+
22+
### Steps To Reproduce

.github/PULL_REQUEST_TEMPLATE.md

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
| Q | A
2+
| ----------------- | ----------
3+
| Bug fix? | yes/no
4+
| New feature? | yes/no <!-- please update the /CHANGELOG.md file -->
5+
| BC breaks? | no
6+
| Related Issue | Fix #... <!-- will close issue automatically, if any -->
7+
| Need Doc update | yes/no
8+
9+
10+
## Describe your change
11+
12+
<!--
13+
Please describe your change, add as much detail as
14+
necessary to understand your code.
15+
-->
16+
17+
## What problem is this fixing?
18+
19+
<!--
20+
Please include everything needed to understand the problem,
21+
its context and consequences, and, if possible, how to recreate it.
22+
-->

.travis.yml

-20
This file was deleted.

CHANGELOG.md

+21-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,26 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
66

77
## [Unreleased]
88

9+
## [1.13.0](https://github.com/algolia/scout-extended/compare/v1.12.0...v1.13.0) - 2021-01-22
10+
### Fixed
11+
- Ignore import errors when scannig for searchables ([#262](https://github.com/algolia/scout-extended/pull/262))
12+
13+
14+
## [1.12.0](https://github.com/algolia/scout-extended/compare/v1.11.0...v1.12.0) - 2021-01-07
15+
### Added
16+
- Support for `SearchableFinder` to find `Searchable` classes outside of `app/` ([#175](https://github.com/algolia/scout-extended/pull/175))
17+
18+
## [1.11.0](https://github.com/algolia/scout-extended/compare/v1.10.2...v1.11.0) - 2021-01-04
19+
### Added
20+
- Support for PHP 8 ([#256](https://github.com/algolia/scout-extended/pull/256))
21+
22+
### Changed
23+
- Migrated from Travis CI to CircleCI ([#255](https://github.com/algolia/scout-extended/pull/255))
24+
25+
## [1.10.2](https://github.com/algolia/scout-extended/compare/v1.10.1...v1.10.2) - 2020-11-24
26+
### Chore
27+
- Containerize repo ([#252](https://github.com/algolia/scout-extended/pull/252))
28+
929
## [1.10.1](https://github.com/algolia/scout-extended/compare/v1.10.0...v1.10.1) - 2020-09-23
1030
### Added
1131
- Support for Laravel 6 & 7 for the latest versions ([#250](https://github.com/algolia/scout-extended/pull/250))
@@ -152,4 +172,4 @@ EngineManager
152172
### Added
153173
- Initial release
154174

155-
[Unreleased]: https://github.com/algolia/scout-extended/compare/v1.9.0...HEAD
175+
[Unreleased]: https://github.com/algolia/scout-extended/compare/v1.13.0...HEAD

DOCKER_README.MD

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
In this page you will find our recommended way of installing Docker on your machine.
2+
This guide is made for OSX users.
3+
4+
## Install Docker
5+
6+
First install Docker using [Homebrew](https://brew.sh/)
7+
```
8+
$ brew install docker
9+
```
10+
11+
You can then install [Docker Desktop](https://docs.docker.com/get-docker/) if you wish, or use `docker-machine`. As we prefer the second option, we will only document this one.
12+
13+
## Setup your Docker
14+
15+
Install `docker-machine`
16+
```
17+
$ brew install docker-machine
18+
```
19+
20+
Then install [VirtualBox](https://www.virtualbox.org/) with [Homebrew Cask](https://github.com/Homebrew/homebrew-cask) to get a driver for your Docker machine
21+
```
22+
$ brew cask install virtualbox
23+
```
24+
25+
You may need to enter your password and authorize the application in your `System Settings` > `Security & Privacy`.
26+
27+
Create now a new machine, set it up as default and connect your shell to it (here we use zsh. The commands should anyway be displayed in each steps' output)
28+
29+
```
30+
$ docker-machine create --driver virtualbox default
31+
$ docker-machine env default
32+
$ eval "$(docker-machine env default)"
33+
```
34+
35+
Now you're all setup to use our provided Docker image!
36+
37+
## Build the image
38+
39+
```bash
40+
docker build -t algolia-scout-extended .
41+
```
42+
43+
## Run the image
44+
45+
You need to provide few environment variables at runtime to be able to run the [Common Test Suite](https://github.com/algolia/algoliasearch-client-specs/tree/master/common-test-suite).
46+
You can set them up directly in the command:
47+
48+
```bash
49+
docker run -it --rm --env ALGOLIA_APP_ID=XXXXXX [...] -v $PWD:/app -w /app algolia-scout-extended bash
50+
```
51+
52+
However, we advise you to export them in your `.bashrc` or `.zshrc`. That way, you can use [Docker's shorten syntax](https://docs.docker.com/engine/reference/commandline/run/#set-environment-variables--e---env---env-file) to set your variables.
53+
54+
```bash
55+
docker run -it --rm --env ALGOLIA_APP_ID \
56+
--env ALGOLIA_SECRET \
57+
-v $PWD:/app -w /app algolia-scout-extended bash
58+
```
59+
60+
Once your container is running, any changes you make in your IDE are directly reflected in the container.
61+
62+
To launch the tests, you can use one of the following commands
63+
```shell script
64+
# run only the unit tests
65+
composer test
66+
67+
# run a single test
68+
./vendor/bin/phpunit --filter=nameOfYourTests
69+
```
70+
71+
You can find more commands in the `composer.json` file.
72+
73+
Feel free to contact us if you have any questions.

Dockerfile

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Dockerfile
2+
FROM php:7.4.1-fpm
3+
4+
RUN apt-get update -y \
5+
&& apt-get install -y --no-install-recommends \
6+
wget \
7+
zip \
8+
unzip \
9+
&& apt-get clean \
10+
&& rm -rf /var/lib/apt/lists/*
11+
12+
# Install Composer
13+
COPY --from=composer:1.9.0 /usr/bin/composer /usr/bin/composer
14+
15+
WORKDIR /app
16+
ADD . /app/
17+
18+
RUN composer install

README.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
</a>
55

66
<p align="center">
7-
<a href="https://travis-ci.org/algolia/scout-extended"><img src="https://img.shields.io/travis/algolia/scout-extended/master.svg" alt="Build Status"></img></a>
7+
<a href="https://circleci.com/gh/algolia/scout-extended"><img src="https://circleci.com/gh/algolia/scout-extended.svg?style=shield" alt="CircleCI" /></a>
88
<a href="https://scrutinizer-ci.com/g/algolia/scout-extended"><img src="https://img.shields.io/scrutinizer/g/algolia/scout-extended.svg" alt="Quality Score"></img></a>
99
<a href="https://scrutinizer-ci.com/g/algolia/scout-extended"><img src="https://scrutinizer-ci.com/g/algolia/scout-extended/badges/coverage.png?b=master" alt="Coverage"></img></a>
1010
<a href="https://packagist.org/packages/algolia/scout-extended"><img src="https://poser.pugx.org/algolia/scout-extended/d/total.svg" alt="Total Downloads"></a>
@@ -54,5 +54,9 @@ Because everyone should be able to build great search, you can use Algolia's bas
5454

5555
Encountering an issue? Before reaching out to support, we recommend heading to our [FAQ](https://www.algolia.com/doc/framework-integration/laravel/troubleshooting/faq/) where you will find answers for the most common issues and gotchas with the package.
5656

57+
## Use the Dockerfile
58+
59+
If you want to contribute to this project without installing all its dependencies, you can use our Docker image. Please check our [dedicated guide](DOCKER_README.MD) to learn more.
60+
5761
## 🆓 License
5862
Scout Extended is an open-sourced software licensed under the [MIT license](LICENSE.md).

composer.json

+8-7
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
}
1515
],
1616
"require": {
17-
"php": "^7.3",
17+
"php": "^7.3|^8.0",
1818
"ext-json": "*",
19-
"algolia/algoliasearch-client-php": "^2.5.1",
19+
"algolia/algoliasearch-client-php": "^2.7.3",
2020
"illuminate/console": "^6.0|^7.0|^8.0",
2121
"illuminate/contracts": "^6.0|^7.0|^8.0",
2222
"illuminate/database": "^6.0|^7.0|^8.0",
@@ -29,18 +29,19 @@
2929
"ext-dom": "Required to use the HTML Splitter."
3030
},
3131
"require-dev": {
32-
"fzaninotto/faker": "^1.8",
33-
"mockery/mockery": "^1.1",
32+
"fakerphp/faker": "^1.13",
33+
"mockery/mockery": "^1.4",
3434
"nunomaduro/larastan": "^0.6",
35-
"orchestra/testbench": "^4.0|^5.0|^6.0",
35+
"orchestra/testbench": "^4.9|^5.9|^6.6",
3636
"phpstan/phpstan": "^0.12.14",
3737
"phpunit/phpunit": "^8.0|^9.0",
38-
"laravel/legacy-factories": "^1.0"
38+
"laravel/legacy-factories": "^1.1"
3939
},
4040
"autoload-dev": {
4141
"psr-4": {
4242
"Tests\\": "tests/",
43-
"App\\": "tests/laravel/app"
43+
"App\\": "tests/laravel/app",
44+
"Modules\\": "tests/laravel/modules"
4445
},
4546
"files": [
4647
"vendor/mockery/mockery/library/helpers.php"

phpstan.neon.dist

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ parameters:
77
checkMissingIterableValueType: false
88
ignoreErrors:
99
- '#Illuminate\\Database\\Eloquent\\Model::searchableAs\(\)#'
10-
- '#Property Laravel\\Scout\\Builder::\$callback \(string\) does not accept Closure\(mixed, mixed, mixed\): mixed.#'
1110
- '#Algolia\\ScoutExtended\\ScoutExtendedServiceProvider::getModel\(\)#'
1211
- '#Cannot call static method create\(\) on string\|null#'
1312
- '#Unsafe usage of new static#'

phpunit.xml.dist

+11-26
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,13 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit backupGlobals="false"
3-
backupStaticAttributes="false"
4-
beStrictAboutTestsThatDoNotTestAnything="false"
5-
beStrictAboutOutputDuringTests="true"
6-
bootstrap="vendor/autoload.php"
7-
colors="true"
8-
convertErrorsToExceptions="true"
9-
convertNoticesToExceptions="true"
10-
convertWarningsToExceptions="true"
11-
failOnRisky="true"
12-
failOnWarning="true"
13-
processIsolation="false"
14-
stopOnError="false"
15-
stopOnFailure="false"
16-
verbose="true"
17-
>
18-
<testsuites>
19-
<testsuite name="Test Suite">
20-
<directory suffix="Test.php">./tests</directory>
21-
</testsuite>
22-
</testsuites>
23-
<filter>
24-
<whitelist processUncoveredFilesFromWhitelist="true">
25-
<directory suffix=".php">./src</directory>
26-
</whitelist>
27-
</filter>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" backupStaticAttributes="false" beStrictAboutTestsThatDoNotTestAnything="false" beStrictAboutOutputDuringTests="true" bootstrap="vendor/autoload.php" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" failOnRisky="true" failOnWarning="true" processIsolation="false" stopOnError="false" stopOnFailure="false" verbose="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
3+
<coverage processUncoveredFiles="true">
4+
<include>
5+
<directory suffix=".php">./src</directory>
6+
</include>
7+
</coverage>
8+
<testsuites>
9+
<testsuite name="Test Suite">
10+
<directory suffix="Test.php">./tests</directory>
11+
</testsuite>
12+
</testsuites>
2813
</phpunit>

0 commit comments

Comments
 (0)