Skip to content

Commit 5a3d4bc

Browse files
Merge #806
806: Add beta testing in CI r=bidoubiwa a=bidoubiwa Add automatic testing of the beta feature by gripping the correct docker image Co-authored-by: Charlotte Vermandel <[email protected]>
2 parents 4423e7c + 1eb5371 commit 5a3d4bc

File tree

2 files changed

+89
-0
lines changed

2 files changed

+89
-0
lines changed
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/workflows/beta-tests.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
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+
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: Grep beta version of Meilisearch
30+
run: echo "MEILISEARCH_IMAGE=$(sh .github/scripts/beta-docker-version.sh)" >> $GITHUB_ENV
31+
- name: Try version script
32+
run: sh .github/scripts/beta-docker-version.sh
33+
- name: Meilisearch (${{ env.MEILISEARCH_IMAGE }}) setup with Docker
34+
run: docker run -d -p 7700:7700 getmeili/meilisearch:${{ env.MEILISEARCH_IMAGE }} meilisearch --master-key=masterKey --no-analytics
35+
- name: Install dependencies
36+
run: yarn --dev && yarn --cwd ./tests/env/react
37+
- name: Setup Meilisearch Index
38+
run: yarn local:env:setup
39+
- name: Run local browser tests
40+
uses: cypress-io/github-action@v2
41+
with:
42+
# Tests are only done on one playground to avoid long testing time
43+
start: yarn local:env:react
44+
env: playground=local
45+
- uses: actions/upload-artifact@v2
46+
if: failure()
47+
with:
48+
name: cypress-screenshots
49+
path: cypress/screenshots
50+
- uses: actions/upload-artifact@v2
51+
if: failure()
52+
with:
53+
name: cypress-videos
54+
path: cypress/videos
55+
56+
tests:
57+
runs-on: ubuntu-latest
58+
strategy:
59+
fail-fast: false
60+
matrix:
61+
node: ['12', '14', '16']
62+
name: integration-tests (Node.js ${{ matrix.node }})
63+
steps:
64+
- uses: actions/checkout@v2
65+
- name: Cache dependencies
66+
uses: actions/cache@v2
67+
with:
68+
path: |
69+
./node_modules
70+
key: ${{ hashFiles('yarn.lock') }}
71+
- name: Get the latest Meilisearch RC
72+
run: echo "MEILISEARCH_VERSION=$(curl https://raw.githubusercontent.com/meilisearch/integration-guides/main/scripts/get-latest-meilisearch-rc.sh | bash)" >> $GITHUB_ENV
73+
- name: Meilisearch (${{ env.MEILISEARCH_VERSION }}) setup with Docker
74+
run: docker run -d -p 7700:7700 getmeili/meilisearch:${{ env.MEILISEARCH_VERSION }} meilisearch --master-key=masterKey --no-analytics
75+
- name: Install dependencies
76+
run: yarn install
77+
- name: Run tests
78+
run: yarn test
79+
- name: Build project
80+
run: yarn build

0 commit comments

Comments
 (0)