Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ name: CI

jobs:
docker_smoketests:
name: Smoketests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -63,7 +64,7 @@ jobs:
- run: echo ::add-matcher::.github/workflows/rust_matcher.json

- name: Build rust-wasm-test
run: cargo run -p spacetimedb-cli -- build crates/modules/rust-wasm-test
run: cargo run -p spacetimedb-cli -- build modules/rust-wasm-test

- name: Run bindgen tests
run: cargo test -p spacetimedb-cli
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ members = [
"crates/sqltest",
"modules/rust-wasm-test",
"modules/benchmarks",
"modules/spacetimedb_quickstart",
"modules/spacetimedb-quickstart",
]
default-members = ["crates/cli"]

Expand Down
2 changes: 1 addition & 1 deletion crates/lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ anyhow = "1.0.68"
spacetimedb-bindings-macro = { path = "../bindings-macro", version = "0.4.1" }
spacetimedb-sats = { path = "../sats", version = "0.4.1" }
serde_with = { version = "2.2.0", optional = true }
chrono = { version = "0.4.23", optional = true }
chrono = { version = "0.4.23", optional = true, default-features = false }

[dev-dependencies]
rand = "0.8.5"
Expand Down
6 changes: 4 additions & 2 deletions crates/standalone/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,10 @@ impl StandaloneEnv {
}

fn get_or_create_keys() -> anyhow::Result<(DecodingKey, EncodingKey)> {
let public_key_path = get_key_path("SPACETIMEDB_JWT_PUB_KEY").unwrap_or(PathBuf::from("/etc/spacetimedb/id_ecdsa.pub"));
let private_key_path = get_key_path("SPACETIMEDB_JWT_PRIV_KEY").unwrap_or(PathBuf::from("/etc/spacetimedb/id_ecdsa"));
let public_key_path =
get_key_path("SPACETIMEDB_JWT_PUB_KEY").unwrap_or(PathBuf::from("/etc/spacetimedb/id_ecdsa.pub"));
let private_key_path =
get_key_path("SPACETIMEDB_JWT_PRIV_KEY").unwrap_or(PathBuf::from("/etc/spacetimedb/id_ecdsa"));

let mut public_key_bytes = read_key(&public_key_path).ok();
let mut private_key_bytes = read_key(&private_key_path).ok();
Expand Down
5 changes: 3 additions & 2 deletions crates/testing/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use spacetimedb::stdb_path;
use std::env;
use std::path::Path;

Expand All @@ -9,6 +10,6 @@ pub fn set_key_env_vars() {
env::set_var(var, Path::new(env!("CARGO_MANIFEST_DIR")).join("../..").join(path));
}
};
set_if_not_exist("SPACETIMEDB_JWT_PUB_KEY", "id_ecdsa.pub");
set_if_not_exist("SPACETIMEDB_JWT_PRIV_KEY", "id_ecdsa");
set_if_not_exist("SPACETIMEDB_JWT_PUB_KEY", stdb_path("id_ecdsa.pub"));
set_if_not_exist("SPACETIMEDB_JWT_PRIV_KEY", stdb_path("id_ecdsa"));
}
21 changes: 16 additions & 5 deletions crates/testing/src/modules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,24 +49,35 @@ where
func(runtime, &module);
});
}
fn module_path(path: &str) -> PathBuf {

fn module_path(name: &str) -> PathBuf {
let root = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"));
root.join("../modules").join(path)
root.join("../../modules").join(name)
}

fn wasm_path(path: &str) -> PathBuf {
module_path(path).join("target/wasm32-unknown-unknown/release/spacetime_module.wasm")
fn wasm_path(name: &str) -> PathBuf {
module_path(name).join(format!(
"target/wasm32-unknown-unknown/release/{}_module.wasm",
name.replace('-', "_")
))
}

fn read_module(path: &str) -> Vec<u8> {
println!("{}", wasm_path(path).to_str().unwrap());
std::fs::read(wasm_path(path)).unwrap()
}

pub fn compile(path: &str) {
let path = module_path(path);
let output = Command::new("cargo")
.current_dir(&path)
.args(["build", "--target=wasm32-unknown-unknown", "--release"])
.args([
"build",
"--target=wasm32-unknown-unknown",
"--release",
"--target-dir",
path.join("target").to_str().unwrap(),
])
.output()
.expect("Failed to execute process to compile a test depdendency");

Expand Down
4 changes: 2 additions & 2 deletions crates/testing/tests/standalone_integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use spacetimedb_testing::modules::{compile, with_module_async};

#[test]
fn test_calling_a_reducer() {
compile("spacetimedb_quickstart");
with_module_async("spacetimedb_quickstart", |module| async move {
compile("spacetimedb-quickstart");
with_module_async("spacetimedb-quickstart", |module| async move {
let json = r#"{"call": {"fn": "add", "args": ["Tyrion"]}}"#.to_string();
module.send(json).await.unwrap();
let json = r#"{"call": {"fn": "say_hello", "args": []}}"#.to_string();
Expand Down
1 change: 0 additions & 1 deletion docker-compose-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ services:
- ./crates/bindings:/usr/src/app/crates/bindings
- ./crates/bindings-macro:/usr/src/app/crates/bindings-macro
- ./crates/bindings-sys:/usr/src/app/crates/bindings-sys
- ./crates/modules/rust-wasm-test:/usr/src/app/crates/modules/rust-wasm-test
- ./crates/vm:/usr/src/app/crates/vm
- /stdb
ports:
Expand Down
1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ services:
- ./crates/bindings:/usr/src/app/crates/bindings
- ./crates/bindings-macro:/usr/src/app/crates/bindings-macro
- ./crates/bindings-sys:/usr/src/app/crates/bindings-sys
- ./crates/modules/rust-wasm-test:/usr/src/app/crates/modules/rust-wasm-test
- ./crates/vm:/usr/src/app/crates/vm
- ./crates/client-api-messages:/usr/src/app/crates/client-api-messages
- ./flamegraphs:/usr/src/app/flamegraphs
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion hooks/install-hooks.sh → git-hooks/install-hooks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ cd "$(dirname "$0")"

rm -rf ../.git/hooks
# Soft link the .git/hooks directory onto hooks/
ln -s ../hooks/hooks ../.git/hooks
ln -s ../git-hooks/hooks ../.git/hooks
Empty file removed x
Empty file.