From 469d520219b8bc265b608379261eadb794a53e1b Mon Sep 17 00:00:00 2001 From: sigma-andex <77549848+sigma-andex@users.noreply.github.com> Date: Sat, 20 Jan 2024 13:06:20 +0000 Subject: [PATCH] Add basic integration test setup --- .github/workflows/rust.yml | 26 +++++++++++++++++++ Cargo.toml | 1 + crates/integration-tests/Cargo.toml | 9 +++++++ crates/integration-tests/run-tests.sh | 2 ++ crates/integration-tests/src/lib.rs | 1 + crates/integration-tests/tests/integration.rs | 8 ++++++ 6 files changed, 47 insertions(+) create mode 100644 .github/workflows/rust.yml create mode 100644 crates/integration-tests/Cargo.toml create mode 100755 crates/integration-tests/run-tests.sh create mode 100644 crates/integration-tests/src/lib.rs create mode 100644 crates/integration-tests/tests/integration.rs diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml new file mode 100644 index 00000000..b9cd5d98 --- /dev/null +++ b/.github/workflows/rust.yml @@ -0,0 +1,26 @@ +name: Rust + +on: + push: + branches: ["master"] + pull_request: + branches: ["master"] + +env: + CARGO_TERM_COLOR: always + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Setup + run: | + cargo install wasm-pack + - name: Build + run: cargo build + - name: Run tests + run: cargo test + - name: Run integration tests + run: (cd crates/integration-tests;sh run-tests.sh) diff --git a/Cargo.toml b/Cargo.toml index 95b16bdc..44eefd1c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,6 @@ [workspace] members = [ + "crates/integration-tests", "crates/ratchet-core", "crates/ratchet-loader", "crates/ratchet-models", diff --git a/crates/integration-tests/Cargo.toml b/crates/integration-tests/Cargo.toml new file mode 100644 index 00000000..6141c410 --- /dev/null +++ b/crates/integration-tests/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "ratchet-integration-tests" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dev-dependencies] +wasm-bindgen-test = "0.3.34" diff --git a/crates/integration-tests/run-tests.sh b/crates/integration-tests/run-tests.sh new file mode 100755 index 00000000..73784792 --- /dev/null +++ b/crates/integration-tests/run-tests.sh @@ -0,0 +1,2 @@ +#!/bin/bash +wasm-pack test --chrome --headless diff --git a/crates/integration-tests/src/lib.rs b/crates/integration-tests/src/lib.rs new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/crates/integration-tests/src/lib.rs @@ -0,0 +1 @@ + diff --git a/crates/integration-tests/tests/integration.rs b/crates/integration-tests/tests/integration.rs new file mode 100644 index 00000000..8ff01aa4 --- /dev/null +++ b/crates/integration-tests/tests/integration.rs @@ -0,0 +1,8 @@ +use wasm_bindgen_test::*; + +wasm_bindgen_test_configure!(run_in_browser); + +#[wasm_bindgen_test] +fn pass() { + assert_eq!(1, 1); +}