Skip to content

Commit 9531b88

Browse files
authored
Merge branch 'main' into bump-meilisearch-v0.25.0
2 parents 0c4aff3 + 6ae16d7 commit 9531b88

File tree

31 files changed

+6164
-34
lines changed

31 files changed

+6164
-34
lines changed

.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module.exports = {
55
/*
66
* REACT
77
*/
8-
files: ['playgrounds/react/**/*.js'],
8+
files: ['playgrounds/react/**/*.js', 'tests/env/react/**/*.js'],
99
env: {
1010
es2020: true,
1111
commonjs: true, // Needed to avoid import is reserved error
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
# Testing the code base against the MeiliSearch pre-releases
2+
name: Pre-Release Tests
3+
4+
# Will only run for PRs and pushes to bump-meilisearch-v*
5+
on:
6+
push:
7+
branches: [bump-meilisearch-v*]
8+
pull_request:
9+
branches: [bump-meilisearch-v*]
10+
11+
jobs:
12+
cypress-run:
13+
runs-on: ubuntu-latest
14+
# Only test on Google Chrome
15+
container: cypress/browsers:node12.18.3-chrome87-ff82
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v2
19+
- name: Cache dependencies
20+
uses: actions/cache@v2
21+
with:
22+
path: |
23+
./node_modules
24+
key: ${{ hashFiles('yarn.lock') }}
25+
- name: Setup node
26+
uses: actions/setup-node@v2
27+
with:
28+
node-version: "14.x"
29+
- name: Install dependencies
30+
run: yarn --dev && yarn --cwd ./tests/env/react
31+
- name: Grep latest version of MeiliSearch
32+
run: |
33+
echo "MEILISEARCH_LATEST=$(curl https://raw.githubusercontent.com/meilisearch/integration-guides/main/scripts/get-latest-meilisearch-rc.sh | sh)" >> $GITHUB_ENV
34+
- name: Download MeiliSearch
35+
run: |
36+
curl https://github.com/meilisearch/MeiliSearch/releases/download/${{ env.MEILISEARCH_LATEST }}/meilisearch-linux-amd64 --output meilisearch --location
37+
chmod +x meilisearch
38+
- name: Run MeiliSearch
39+
run: |
40+
./meilisearch --master-key=masterKey --no-analytics true &
41+
- name: Setup MeiliSearch Index
42+
run: yarn local:env:setup
43+
- name: Run local browser tests
44+
uses: cypress-io/github-action@v2
45+
with:
46+
# Tests are only done on one playground to avoid long testing time
47+
start: yarn local:env:react
48+
env: playground=reactlocal
49+
spec: cypress/integration/local-ui.spec.js
50+
- uses: actions/upload-artifact@v2
51+
if: failure()
52+
with:
53+
name: cypress-screenshots
54+
path: cypress/screenshots
55+
- uses: actions/upload-artifact@v2
56+
if: failure()
57+
with:
58+
name: cypress-videos
59+
path: cypress/videos
60+
61+
tests:
62+
runs-on: ubuntu-latest
63+
strategy:
64+
fail-fast: false
65+
matrix:
66+
node: ["12", "14", "16"]
67+
name: integration-tests (Node.js ${{ matrix.node }})
68+
steps:
69+
- uses: actions/checkout@v2
70+
- name: Cache dependencies
71+
uses: actions/cache@v2
72+
with:
73+
path: |
74+
./node_modules
75+
key: ${{ hashFiles('yarn.lock') }}
76+
- name: Get the latest MeiliSearch RC
77+
run: echo "MEILISEARCH_VERSION=$(curl https://raw.githubusercontent.com/meilisearch/integration-guides/main/scripts/get-latest-meilisearch-rc.sh | bash)" >> $GITHUB_ENV
78+
- name: MeiliSearch (${{ env.MEILISEARCH_VERSION }}) setup with Docker
79+
run: docker run -d -p 7700:7700 getmeili/meilisearch:${{ env.MEILISEARCH_VERSION }} ./meilisearch --master-key=masterKey --no-analytics=true
80+
- name: Install dependencies
81+
run: yarn install
82+
- name: Run tests
83+
run: yarn test
84+
- name: Build project
85+
run: yarn build
86+
87+
style:
88+
name: style-check
89+
runs-on: ubuntu-latest
90+
91+
steps:
92+
- uses: actions/checkout@v2
93+
- name: Cache dependencies
94+
uses: actions/cache@v2
95+
with:
96+
path: |
97+
./node_modules
98+
key: ${{ hashFiles('yarn.lock') }}
99+
- name: Install dependencies
100+
run: yarn install
101+
- name: Tests style
102+
run: yarn lint
103+
- name: Yaml Style
104+
uses: ibiqlik/action-yamllint@v3
105+
with:
106+
config_file: .yamllint.yml
107+
types_test:
108+
runs-on: ubuntu-latest
109+
name: types-check
110+
steps:
111+
- uses: actions/checkout@v2
112+
- name: Cache dependencies
113+
uses: actions/cache@v2
114+
with:
115+
path: |
116+
./node_modules
117+
key: ${{ hashFiles('yarn.lock') }}
118+
- name: Setup node
119+
uses: actions/setup-node@v2
120+
- name: Install dependencies
121+
run: yarn --dev
122+
- name: Build project
123+
run: yarn build
124+
- name: Run types check
125+
run: yarn types

.github/workflows/publish.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
name: Publish to npm
22
on:
3-
push:
4-
tags:
5-
- v*
3+
release:
4+
types: [published]
65

76
jobs:
87
publish-npm:
@@ -17,9 +16,15 @@ jobs:
1716
run: sh .github/scripts/check-release.sh
1817
- name: Install dependencies
1918
run: yarn install
20-
- name: Build
19+
- name: Build instant-meilisearch
2120
run: yarn build
22-
- name: Publish
21+
- name: Publish with latest tag
22+
if: "!github.event.release.prerelease"
2323
run: npm publish .
2424
env:
2525
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
26+
- name: Publish with beta tag
27+
if: "github.event.release.prerelease"
28+
run: npm publish . --tag beta
29+
env:
30+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

.github/workflows/test.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ on:
1111

1212
jobs:
1313
cypress-run:
14+
# Will not run if the event is a PR to bump-meilisearch-v* (so a pre-release PR)
15+
# Will still run for each push to bump-meilisearch-v*
16+
if: github.event_name != 'pull_request' || !startsWith(github.base_ref, 'bump-meilisearch-v')
1417
runs-on: ubuntu-latest
1518
# Only test on Google Chrome
1619
container: cypress/browsers:node12.18.3-chrome87-ff82
@@ -35,6 +38,7 @@ jobs:
3538
# Tests are only done on one playground to avoid long testing time
3639
start: yarn playground:vue
3740
env: playground=vue
41+
spec: cypress/integration/search-ui.spec.js
3842
- uses: actions/upload-artifact@v2
3943
if: failure()
4044
with:
@@ -45,8 +49,10 @@ jobs:
4549
with:
4650
name: cypress-videos
4751
path: cypress/videos
48-
4952
tests:
53+
# Will not run if the event is a PR to bump-meilisearch-v* (so a pre-release PR)
54+
# Will still run for each push to bump-meilisearch-v*
55+
if: github.event_name != 'pull_request' || !startsWith(github.base_ref, 'bump-meilisearch-v')
5056
runs-on: ubuntu-latest
5157
strategy:
5258
fail-fast: false
@@ -69,8 +75,10 @@ jobs:
6975
run: yarn test
7076
- name: Build project
7177
run: yarn build
72-
7378
style:
79+
# Will not run if the event is a PR to bump-meilisearch-v* (so a pre-release PR)
80+
# Will still run for each push to bump-meilisearch-v*
81+
if: github.event_name != 'pull_request' || !startsWith(github.base_ref, 'bump-meilisearch-v')
7482
name: style-check
7583
runs-on: ubuntu-latest
7684

@@ -91,6 +99,9 @@ jobs:
9199
with:
92100
config_file: .yamllint.yml
93101
types_test:
102+
# Will not run if the event is a PR to bump-meilisearch-v* (so a pre-release PR)
103+
# Will still run for each push to bump-meilisearch-v*
104+
if: github.event_name != 'pull_request' || !startsWith(github.base_ref, 'bump-meilisearch-v')
94105
runs-on: ubuntu-latest
95106
name: types-check
96107
steps:

CONTRIBUTING.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,39 @@ Once the version is available on npm, please update the instant-meilisearch vers
149149

150150
If you don't have the access to do it, please request it internally.
151151

152+
#### Release a `beta` Version
153+
154+
Here are the steps to release a beta version of this package:
155+
156+
- Create a new branch originating the branch containing the "beta" changes. For example, if during the MeiliSearch pre-release, create a branch originating `bump-meilisearch-v*.*.*`.<br>
157+
`vX.X.X` is the next version of the package, NOT the version of MeiliSearch!
158+
159+
```bash
160+
git checkout bump-meilisearch-v*.*.*
161+
git pull origin bump-meilisearch-v*.*.*
162+
git checkout -b vX.X.X-beta.0
163+
```
164+
165+
- Change the version in `package.json` by `vX.X.X-beta.0` and commit it to the `vX.X.X-beta.0` branch
166+
167+
- Go to the [GitHub interface for releasing](https://github.com/meilisearch/instant-meilisearch/releases): on this page, click on `Draft a new release`.
168+
169+
- Create a GitHub pre-release:
170+
- Fill the description with the detailed changelogs
171+
- Fill the title with `vX.X.X-beta.0`
172+
- Fill the tag with `vX.X.X-beta.0`
173+
- ⚠️ Select the `vX.X.X-beta.0` branch and NOT `main`
174+
- ⚠️ Click on the "This is a pre-release" checkbox
175+
- Click on "Publish release"
176+
177+
GitHub Actions will be triggered and push the beta version to [npm](https://www.npmjs.com/package/@meilisearch/instant-meilisearch).
178+
179+
💡 If you need to release a new beta for the same version (i.e. `vX.X.X-beta.1`):
180+
- merge the change into `bump-meilisearch-v*.*.*`
181+
- rebase the `vX.X.X-beta.0` branch
182+
- change the version name in `package.json`
183+
- creata a pre-release via the GitHub interface
184+
152185
<hr>
153186

154187
Thank you again for reading this through, we can not wait to begin to work with you if you made your way through this contributing guide ❤️

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ yarn add @meilisearch/instant-meilisearch
5858
```
5959

6060
InstantMeiliSearch is a client for `instantsearch.js`. It does not create any UI component by itself.<br>
61-
To be able to create a search interface, you'll need to [install `instantsearch.js`](https://www.algolia.com/doc/guides/building-search-ui/installation/js/) as well.
61+
To be able to create a search interface, you'll need to [install `instantsearch.js`](https://www.algolia.com/doc/guides/building-search-ui/installation/js/) as well.
6262

6363
## Usage
6464

@@ -68,7 +68,7 @@ To be able to create a search interface, you'll need to [install `instantsearch.
6868
import { instantMeiliSearch } from '@meilisearch/instant-meilisearch'
6969

7070
const searchClient = instantMeiliSearch(
71-
'https://demos.meilisearch.com',
71+
'https://integration-demos.meilisearch.com',
7272
'dc3fedaf922de8937fdea01f0a7d59557f1fd31832cb8440ce94231cfdde7f25'
7373
)
7474
```
@@ -79,7 +79,7 @@ const searchClient = instantMeiliSearch(
7979
import { instantMeiliSearch } from '@meilisearch/instant-meilisearch'
8080

8181
const searchClient = instantMeiliSearch(
82-
'https://demos.meilisearch.com',
82+
'https://integration-demos.meilisearch.com',
8383
'dc3fedaf922de8937fdea01f0a7d59557f1fd31832cb8440ce94231cfdde7f25',
8484
{
8585
paginationTotalHits: 30, // default: 200.
@@ -132,7 +132,7 @@ In `app.js`:
132132
const search = instantsearch({
133133
indexName: 'steam-video-games',
134134
searchClient: instantMeiliSearch(
135-
'https://demos.meilisearch.com',
135+
'https://integration-demos.meilisearch.com',
136136
'dc3fedaf922de8937fdea01f0a7d59557f1fd31832cb8440ce94231cfdde7f25'
137137
),
138138
})
@@ -253,7 +253,7 @@ List of all the components that are available in [instantSearch](https://github.
253253
const search = instantsearch({
254254
indexName: 'instant_search',
255255
searchClient: instantMeiliSearch(
256-
'https://demos.meilisearch.com',
256+
'https://integration-demos.meilisearch.com',
257257
'dc3fedaf922de8937fdea01f0a7d59557f1fd31832cb8440ce94231cfdde7f25',
258258
{
259259
// ... InstantMeiliSearch options

cypress.env.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,8 @@
1010
},
1111
"javascript": {
1212
"host": "http://localhost:2222"
13+
},
14+
"reactlocal": {
15+
"host": "http://localhost:9999"
1316
}
1417
}
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
const {
2+
playground,
3+
[playground]: { host },
4+
} = Cypress.env()
5+
6+
const HIT_ITEM_CLASS =
7+
playground === 'react' || playground === 'reactlocal'
8+
? '.ais-InfiniteHits-item'
9+
: '.ais-Hits-item'
10+
11+
describe(`${playground} playground test`, () => {
12+
before(() => {
13+
cy.clearCookies()
14+
cy.visit(host)
15+
})
16+
17+
it('Should visit the dashboard', () => {
18+
cy.url().should('match', /http:\/\/localhost:/)
19+
})
20+
21+
it('Contains stats', () => {
22+
cy.contains('15 results')
23+
})
24+
25+
it('Contains filter clear', () => {
26+
cy.contains('Clear all filters')
27+
})
28+
29+
it('Contains Genres', () => {
30+
cy.contains('Action')
31+
})
32+
33+
it('Contains searchBar', () => {
34+
cy.get('.ais-SearchBox-input').should('have.value', '')
35+
})
36+
37+
it('Contains Hits', () => {
38+
cy.get(HIT_ITEM_CLASS).eq(0).contains('Counter-Strike')
39+
cy.get(HIT_ITEM_CLASS).eq(0).contains('9.99 $')
40+
})
41+
42+
it('Sort by recommendationCound ascending', () => {
43+
const select = `.ais-SortBy-select`
44+
cy.get(select).select('steam-video-games:recommendationCount:asc')
45+
cy.wait(1000)
46+
cy.get(HIT_ITEM_CLASS).eq(0).contains('Deathmatch Classic')
47+
})
48+
49+
it('Sort by default relevancy', () => {
50+
const select = `.ais-SortBy-select`
51+
cy.get(select).select('steam-video-games')
52+
cy.wait(1000)
53+
cy.get(HIT_ITEM_CLASS).eq(0).contains('Counter-Strike')
54+
})
55+
56+
it('click on facets', () => {
57+
const checkbox = `.ais-RefinementList-list .ais-RefinementList-checkbox`
58+
cy.get(checkbox).eq(1).click()
59+
cy.get(HIT_ITEM_CLASS).eq(1).contains('Team Fortress Classic')
60+
cy.get(HIT_ITEM_CLASS).eq(1).contains('4.99 $')
61+
})
62+
63+
it('Search', () => {
64+
cy.get('.ais-SearchBox-input').type('Half-Life')
65+
cy.wait(1000)
66+
cy.get(HIT_ITEM_CLASS).eq(0).contains('Half-Life')
67+
})
68+
69+
it('Unclick on facets', () => {
70+
const checkbox = `.ais-RefinementList-list .ais-RefinementList-checkbox`
71+
cy.get(checkbox).eq(0).click()
72+
cy.get(HIT_ITEM_CLASS).eq(0).contains('Half-Life')
73+
})
74+
75+
it('Placeholder Search', () => {
76+
cy.get('.ais-SearchBox-input').clear()
77+
cy.wait(1000)
78+
cy.get(HIT_ITEM_CLASS).eq(0).contains('Counter-Strike')
79+
})
80+
81+
it('Paginate Search', () => {
82+
cy.get('.ais-InfiniteHits-loadMore').click()
83+
cy.get(HIT_ITEM_CLASS).should('have.length', 11)
84+
})
85+
})

0 commit comments

Comments
 (0)