Skip to content

Commit 0830899

Browse files
authored
Merge branch 'main' into cleaning_in_tests
2 parents 26eb40e + cb88c64 commit 0830899

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1635
-1399
lines changed

.code-samples.meilisearch.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
landing_getting_started_1: |-
2+
<body>
3+
<div>
4+
<div id="searchbox"></div>
5+
<div id="hits"></div>
6+
</div>
7+
8+
<script src="https://cdn.jsdelivr.net/npm/@meilisearch/instant-meilisearch/dist/instant-meilisearch.umd.min.js"></script>
9+
<script src="https://cdn.jsdelivr.net/npm/instantsearch.js@4"></script>
10+
<script>
11+
const search = instantsearch({
12+
indexName: 'movies',
13+
searchClient: instantMeiliSearch(
14+
'http://localhost:7700',
15+
'searchKey'
16+
),
17+
})
18+
19+
search.addWidgets([
20+
instantsearch.widgets.searchBox({
21+
container: '#searchbox',
22+
}),
23+
instantsearch.widgets.hits({
24+
container: '#hits',
25+
templates: {
26+
item: `
27+
<div>
28+
<div class="hit-name">
29+
{{#helpers.highlight}}{ "attribute": "title" }{{/helpers.highlight}}
30+
</div>
31+
</div>
32+
`,
33+
},
34+
}),
35+
])
36+
search.start()
37+
</script>
38+
</body>

.github/dependabot.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,4 @@ updates:
2525
- dependency-name: "regenerator-runtime*"
2626
- dependency-name: "shx*"
2727
- dependency-name: "@vue/*"
28+
- dependency-name: "concurrently"
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/sh
2+
3+
package_json_version=$(grep '"version":' package.json | cut -d ':' -f 2- | tr -d ' ' | tr -d '"' | tr -d ',')
4+
beta_feature=$(echo $package_json_version | sed -r 's/[0-9]+.[0-9]+.[0-9]+-//')
5+
beta_feature=$(echo $beta_feature | sed -r 's/-beta\.[0-9]*$//')
6+
7+
docker_image=$(curl https://hub.docker.com/v2/repositories/getmeili/meilisearch/tags | jq | grep "$beta_feature" | head -1)
8+
docker_image=$(echo $docker_image | grep '"name":' | cut -d ':' -f 2- | tr -d ' ' | tr -d '"' | tr -d ',')
9+
echo $docker_image

.github/scripts/check-release.sh

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,16 @@
22

33
# Checking if current tag matches the package version
44
current_tag=$(echo $GITHUB_REF | cut -d '/' -f 3 | tr -d ' ',v)
5-
file_tag=$(grep '"version":' package.json | cut -d ':' -f 2- | tr -d ' ' | tr -d '"' | tr -d ',')
6-
if [ "$current_tag" != "$file_tag" ]; then
7-
echo "Error: the current tag does not match the version in package file(s)."
8-
echo "$current_tag vs $file_tag"
5+
6+
package_file_tag=$(grep '"version":' package.json | cut -d ':' -f 2- | tr -d ' ' | tr -d '"' | tr -d ',')
7+
package_file_name='package.json'
8+
version_file_tag=$(grep "PACKAGE_VERSION =" src/package-version.ts | cut -d "=" -f 2- | tr -d " " | tr -d "'")
9+
version_file_name='src/package-version.ts'
10+
11+
if [ "$current_tag" != "$package_file_tag" ] || [ "$current_tag" != "$version_file_tag" ]; then
12+
echo 'Error: the current tag does not match the version in package file(s).'
13+
echo "$package_file_name: $current_tag vs $package_file_tag"
14+
echo "$version_file_name: $current_tag vs $version_file_tag"
915
exit 1
1016
fi
1117

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/sh
2+
3+
# Checking if current tag matches the required formating
4+
is_pre_release=$1
5+
current_tag=$(echo $GITHUB_REF | cut -d '/' -f 3 | tr -d ' ',v)
6+
7+
if [ $is_pre_release = false ]; then
8+
# Works with the format vX.X.X
9+
#
10+
# Example of correct format:
11+
# v0.1.0
12+
echo "$current_tag" | grep -E "[0-9]*\.[0-9]*\.[0-9]*$"
13+
if [ $? != 0 ]; then
14+
echo "Error: Your tag: $current_tag is wrongly formatted."
15+
echo 'Please refer to the contributing guide for help.'
16+
exit 1
17+
fi
18+
exit 0
19+
elif [ $is_pre_release = true ]; then
20+
# Works with the format vX.X.X-xxx-beta.X
21+
# none or multiple -xxx are valid
22+
#
23+
# Examples of correct format:
24+
# v0.1.0-beta.0
25+
# v0.1.0-xxx-beta.0
26+
# v0.1.0-xxx-xxx-beta.0
27+
echo "$current_tag" | grep -E "[0-9]*\.[0-9]*\.[0-9]*-([a-z]*-)*beta\.[0-9]*$"
28+
29+
if [ $? != 0 ]; then
30+
echo "Error: Your beta tag: $current_tag is wrongly formatted."
31+
echo 'Please refer to the contributing guide for help.'
32+
exit 1
33+
fi
34+
exit 0
35+
fi
36+
37+
exit 0

.github/workflows/beta-tests.yml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# Testing the code base against a specific Meilisearch feature
2+
name: Beta tests
3+
4+
# Will only run for PRs and pushes to *-beta
5+
on:
6+
push:
7+
branches: ['!bump-meilisearch-v*.*.*-beta', '**-beta']
8+
pull_request:
9+
branches: ['!bump-meilisearch-v*.*.*-beta', '**-beta']
10+
11+
jobs:
12+
grep-docker-version:
13+
runs-on: ubuntu-latest
14+
outputs:
15+
docker-version: ${{ steps.grep-step.outputs.version }}
16+
steps:
17+
- uses: actions/checkout@v2
18+
- name: Grep docker beta version of Meilisearch
19+
id: grep-step
20+
run: |
21+
MEILISEARCH_IMAGE=$(sh .github/scripts/beta-docker-version.sh)
22+
echo $MEILISEARCH_IMAGE
23+
echo ::set-output name=version::$MEILISEARCH_IMAGE
24+
cypress-run:
25+
runs-on: ubuntu-latest
26+
needs: ['grep-docker-version']
27+
# Only test on Google Chrome
28+
container: cypress/browsers:node12.18.3-chrome87-ff82
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v2
32+
- name: Cache dependencies
33+
uses: actions/cache@v2
34+
with:
35+
path: |
36+
./node_modules
37+
key: ${{ hashFiles('yarn.lock') }}
38+
- name: Setup node
39+
uses: actions/setup-node@v2
40+
with:
41+
node-version: '14.x'
42+
- name: Meilisearch (${{ needs.grep-docker-version.outputs.docker-version }}) setup with Docker
43+
run: docker run -d -p 7700:7700 getmeili/meilisearch:${{ needs.grep-docker-version.outputs.docker-version }} meilisearch --master-key=masterKey --no-analytics
44+
- name: Install dependencies
45+
run: yarn --dev && yarn --cwd ./tests/env/react
46+
- name: Setup Meilisearch Index
47+
run: yarn local:env:setup
48+
- name: Run local browser tests
49+
uses: cypress-io/github-action@v2
50+
with:
51+
# Tests are only done on one playground to avoid long testing time
52+
start: yarn local:env:react
53+
env: playground=local
54+
- uses: actions/upload-artifact@v2
55+
if: failure()
56+
with:
57+
name: cypress-screenshots
58+
path: cypress/screenshots
59+
- uses: actions/upload-artifact@v2
60+
if: failure()
61+
with:
62+
name: cypress-videos
63+
path: cypress/videos
64+
65+
tests:
66+
runs-on: ubuntu-latest
67+
needs: ['grep-docker-version']
68+
strategy:
69+
fail-fast: false
70+
matrix:
71+
node: ['12', '14', '16']
72+
name: integration-tests (Node.js ${{ matrix.node }})
73+
steps:
74+
- uses: actions/checkout@v2
75+
- name: Cache dependencies
76+
uses: actions/cache@v2
77+
with:
78+
path: |
79+
./node_modules
80+
key: ${{ hashFiles('yarn.lock') }}
81+
- name: Setup node
82+
uses: actions/setup-node@v2
83+
with:
84+
node-version: '14.x'
85+
- name: Meilisearch (${{ needs.grep-docker-version.outputs.docker-version }}) setup with Docker
86+
run: docker run -d -p 7700:7700 getmeili/meilisearch:${{ needs.grep-docker-version.outputs.docker-version }} meilisearch --master-key=masterKey --no-analytics
87+
- name: Install dependencies
88+
run: yarn install
89+
- name: Run tests
90+
run: yarn test
91+
- name: Build project
92+
run: yarn build

.github/workflows/pre-release-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ jobs:
7575
- name: Get the latest Meilisearch RC
7676
run: echo "MEILISEARCH_VERSION=$(curl https://raw.githubusercontent.com/meilisearch/integration-guides/main/scripts/get-latest-meilisearch-rc.sh | bash)" >> $GITHUB_ENV
7777
- name: Meilisearch (${{ env.MEILISEARCH_VERSION }}) setup with Docker
78-
run: docker run -d -p 7700:7700 getmeili/meilisearch:${{ env.MEILISEARCH_VERSION }} ./meilisearch --master-key=masterKey --no-analytics
78+
run: docker run -d -p 7700:7700 getmeili/meilisearch:${{ env.MEILISEARCH_VERSION }} meilisearch --master-key=masterKey --no-analytics
7979
- name: Install dependencies
8080
run: yarn install
8181
- name: Run tests

.github/workflows/publish.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,19 @@ jobs:
1414
registry-url: https://registry.npmjs.org/
1515
- name: Check release validity
1616
run: sh .github/scripts/check-release.sh
17+
- name: Check tag format
18+
run: sh .github/scripts/check-tag-format.sh "${{ github.event.release.prerelease }}"
1719
- name: Install dependencies
1820
run: yarn install
1921
- name: Build instant-meilisearch
2022
run: yarn build
2123
- name: Publish with latest tag
22-
if: "!github.event.release.prerelease"
24+
if: "!github.event.release.prerelease && !contains(github.ref, 'beta')"
2325
run: npm publish .
2426
env:
2527
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
2628
- name: Publish with beta tag
27-
if: "github.event.release.prerelease"
29+
if: "github.event.release.prerelease && contains(github.ref, 'beta')"
2830
run: npm publish . --tag beta
2931
env:
3032
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ jobs:
7676
./node_modules
7777
key: ${{ hashFiles('yarn.lock') }}
7878
- name: Docker setup
79-
run: docker run -d -p 7700:7700 getmeili/meilisearch:latest ./meilisearch --no-analytics --master-key='masterKey'
79+
run: docker run -d -p 7700:7700 getmeili/meilisearch:latest meilisearch --no-analytics --master-key='masterKey'
8080
- name: Install dependencies
8181
run: yarn install
8282
- name: Run tests

CONTRIBUTING.md

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Each PR should pass the tests and the linter to be accepted.
3939
```bash
4040
# Tests with Jest
4141
docker pull getmeili/meilisearch:latest # Fetch the latest version of Meilisearch image from Docker Hub
42-
docker run -p 7700:7700 getmeili/meilisearch:latest ./meilisearch --master-key=masterKey --no-analytics
42+
docker run -p 7700:7700 getmeili/meilisearch:latest meilisearch --master-key=masterKey --no-analytics
4343
# Integration tests
4444
yarn test
4545
# End-to-end tests
@@ -131,10 +131,16 @@ _[Read more about this](https://github.com/meilisearch/integration-guides/blob/m
131131

132132
⚠️ Before doing anything, make sure you got through the guide about [Releasing an Integration](https://github.com/meilisearch/integration-guides/blob/main/resources/integration-release.md).
133133

134-
Make a PR modifying the file [`package.json`](/package.json) with the right version.
134+
Make a PR modifying the following files with the right version:
135135

136+
[`package.json`](/package.json):
136137
```javascript
137-
"version": "X.X.X"
138+
"version": "X.X.X",
139+
```
140+
141+
[`src/package-version`](/src/package-version.ts)
142+
```javascript
143+
export const PACKAGE_VERSION = 'X.X.X'
138144
```
139145

140146
Once the changes are merged on `main`, you can publish the current draft release via the [GitHub interface](https://github.com/meilisearch/instant-meilisearch/releases): on this page, click on `Edit` (related to the draft release) > update the description (be sure you apply [these recommandations](https://github.com/meilisearch/integration-guides/blob/main/resources/integration-release.md#writting-the-release-description)) > when you are ready, click on `Publish release`.
@@ -153,16 +159,25 @@ If you don't have the access to do it, please request it internally.
153159

154160
Here are the steps to release a beta version of this package:
155161

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
162+
- Create a new branch containing the "beta" changes with the following format `xxx-beta` where `xxx` explains the context.
163+
164+
For example:
165+
- When implementing a beta feature, create a branch `my-feature-beta` where you implement the feature.
166+
```bash
167+
git checkout -b my-feature-beta
168+
```
169+
- During the Meilisearch pre-release, create a branch originating from `bump-meilisearch-v*.*.*` named `bump-meilisearch-v*.*.*-beta`. <br>
170+
`v*.*.*` is the next version of the package, NOT the version of Meilisearch!
171+
172+
```bash
173+
git checkout bump-meilisearch-v*.*.*
174+
git pull origin bump-meilisearch-v*.*.*
175+
git checkout -b bump-meilisearch-v*.*.*-beta
176+
```
177+
178+
- Change the version in `package.json` with `*.*.*-xxx-beta.0` and commit it to the `v*.*.*-beta` branch. None or multiple `-xxx`are valid. Examples:
179+
- `v*.*.*-my-feature-beta.0`
180+
- `v*.*.*-beta.0`
166181

167182
- Go to the [GitHub interface for releasing](https://github.com/meilisearch/instant-meilisearch/releases): on this page, click on `Draft a new release`.
168183

0 commit comments

Comments
 (0)