Skip to content

Commit 6ae16d7

Browse files
bidoubiwameili-bot
andauthored
Add pre release process (#632)
* Update README.md * Change index creation and wait method in tests * Add types tests * Change index creation and wait method in tests (#629) * Add types tests (#630) * Change index creation and wait method in tests * Add types tests * Update meilisearch js * Create local e2e tests * Add pre release tests * Add pre-release publis * Add Beta publish in contributing * Add docker in CI * Change way to launch meilisearch in CI tests * Update script to fetch latest meilisearch * Remove vue from types tests * Only launch local tests on pre-release * Update playgrounds/angular/src/app/app.component.ts * Rollback meilisearch js version Co-authored-by: meili-bot <[email protected]>
1 parent 0687d81 commit 6ae16d7

25 files changed

+6171
-29
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: 32 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

@@ -90,3 +98,25 @@ jobs:
9098
uses: ibiqlik/action-yamllint@v3
9199
with:
92100
config_file: .yamllint.yml
101+
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')
105+
runs-on: ubuntu-latest
106+
name: types-check
107+
steps:
108+
- uses: actions/checkout@v2
109+
- name: Cache dependencies
110+
uses: actions/cache@v2
111+
with:
112+
path: |
113+
./node_modules
114+
key: ${{ hashFiles('yarn.lock') }}
115+
- name: Setup node
116+
uses: actions/setup-node@v2
117+
- name: Install dependencies
118+
run: yarn --dev
119+
- name: Build project
120+
run: yarn build
121+
- name: Run types check
122+
run: yarn types

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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ This package only guarantees the compatibility with the [version v4 of InstantSe
181181

182182
**Supported MeiliSearch versions**:
183183

184-
This package only guarantees the compatibility with the [version v0.24.0 of MeiliSearch](https://github.com/meilisearch/MeiliSearch/releases/tag/v0.24.0).
184+
This package only guarantees the compatibility with the [version v0.25.0 of MeiliSearch](https://github.com/meilisearch/MeiliSearch/releases/tag/v0.25.0).
185185

186186
**Node / NPM versions**:
187187

bors.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
status = [
22
'style-check',
3+
'types-check',
34
'integration-tests (Node.js 12)',
45
'integration-tests (Node.js 14)',
56
'cypress-run'

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)