Skip to content

Commit ff45f72

Browse files
irevoirebrunoocasali
authored andcommitted
Remove the wasm lib.rs from the manifest
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
1 parent ea49968 commit ff45f72

File tree

3 files changed

+15
-19
lines changed

3 files changed

+15
-19
lines changed

.github/workflows/tests.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ 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: Cargo check
21+
uses: actions-rs/cargo@v1
22+
with:
23+
command: check
24+
args: --workspace --all-targets --all
2025
name: integration-tests
2126
runs-on: ubuntu-latest
2227
steps:
@@ -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)