Skip to content

Commit 4e8181a

Browse files
bors[bot]irevoirebrunoocasali
authored
Merge #286
286: Remove the wasm lib.rs from the manifest r=brunoocasali a=irevoire Having a link to the web_app `lib.rs` in the examples was making it try to compile as a dev dependencies which is a constraint we don’t want. I removed it and instead included ALL the examples in our workspace which means we’re now using THEIR cargo.toml instead of ours and meilisearch-rust is compiled as a normal dependency for these examples. I also added a `cargo check` for all the examples / tests / code in the repo. This should execute faster than the test and thus throw errors faster. This should unlock #254 Co-authored-by: Irevoire <[email protected]> Co-authored-by: Bruno Casali <[email protected]>
2 parents ea49968 + df94020 commit 4e8181a

File tree

3 files changed

+16
-20
lines changed

3 files changed

+16
-20
lines changed

.github/workflows/tests.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ jobs:
1717
# Will not run if the event is a PR to bump-meilisearch-v* (so a pre-release PR)
1818
# Will still run for each push to bump-meilisearch-v*
1919
if: github.event_name != 'pull_request' || !startsWith(github.base_ref, 'bump-meilisearch-v')
20-
name: integration-tests
2120
runs-on: ubuntu-latest
21+
name: integration-tests
2222
steps:
2323
- uses: actions/checkout@v2
2424
- name: Build
@@ -27,6 +27,11 @@ jobs:
2727
run: docker run -d -p 7700:7700 getmeili/meilisearch:latest ./meilisearch --no-analytics --master-key=masterKey
2828
- name: Run tests
2929
run: cargo test --verbose
30+
- name: Cargo check
31+
uses: actions-rs/cargo@v1
32+
with:
33+
command: check
34+
args: --workspace --all-targets --all
3035

3136
linter:
3237
name: clippy-check
@@ -55,4 +60,4 @@ jobs:
5560
- name: Build
5661
run: |
5762
rustup target add wasm32-unknown-unknown
58-
cargo check --example web_app --target wasm32-unknown-unknown --features=sync
63+
cargo check -p web_app --target wasm32-unknown-unknown --features=sync

Cargo.toml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ license = "MIT"
88
readme = "README.md"
99
repository = "https://github.com/meilisearch/meilisearch-sdk"
1010

11+
[workspace]
12+
members = ["examples/*"]
13+
1114
[dependencies]
1215
async-trait = "0.1.51"
1316
iso8601-duration = "0.1.0"
@@ -46,9 +49,3 @@ yew = "0.18"
4649
lazy_static = "1.4"
4750
web-sys = "0.3"
4851
console_error_panic_hook = "0.1"
49-
50-
[[example]]
51-
name = "web_app"
52-
crate-type = ["cdylib", "rlib"]
53-
required-features = ["sync"]
54-
path = "examples/web_app/src/lib.rs"

examples/cli-app/src/main.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
use futures::executor::block_on;
22
use lazy_static::lazy_static;
3-
use meilisearch_sdk::{client::*,settings::Settings};
3+
use meilisearch_sdk::{client::*, settings::Settings};
44
use serde::{Deserialize, Serialize};
55
use std::fmt;
6-
use std::io::{stdin};
6+
use std::io::stdin;
77

88
// instantiate the client. load it once
99
lazy_static! {
@@ -63,7 +63,7 @@ async fn search(query: &str) {
6363
async fn build_index() {
6464
// reading and parsing the file
6565
let content = include_str!("../assets/clothes.json");
66-
66+
6767
// serialize the string to clothes objects
6868
let clothes: Vec<Clothes> = serde_json::from_str(content).unwrap();
6969

@@ -78,15 +78,9 @@ async fn build_index() {
7878

7979
// create the synonyms hashmap
8080
let mut synonyms = std::collections::HashMap::new();
81-
synonyms.insert(
82-
"sweater",
83-
vec!["cardigan", "long-sleeve"],
84-
);
81+
synonyms.insert("sweater", vec!["cardigan", "long-sleeve"]);
8582
synonyms.insert("sweat pants", vec!["joggers", "gym pants"]);
86-
synonyms.insert(
87-
"t-shirt",
88-
vec!["tees", "tshirt"],
89-
);
83+
synonyms.insert("t-shirt", vec!["tees", "tshirt"]);
9084

9185
//create the settings struct
9286
let settings = Settings::new()
@@ -121,7 +115,7 @@ async fn build_index() {
121115
.wait_for_completion(&CLIENT, None, None)
122116
.await
123117
.unwrap();
124-
118+
125119
if result.is_failure() {
126120
panic!(
127121
"Encountered an error while sending the documents: {:?}",

0 commit comments

Comments
 (0)