Simple test project that sets up a hybrid cargo crate with a vite project

ci: enable ci for github

Signed-off-by: @gm112 <740416+gm112@users.noreply.github.com>

ci: setup cargo in github ci

Signed-off-by: @gm112 <740416+gm112@users.noreply.github.com>

chore: add nvmrc file

Signed-off-by: @gm112 <740416+gm112@users.noreply.github.com>

chore: adjust ci setup step

Signed-off-by: @gm112 <740416+gm112@users.noreply.github.com>

ci: debug

Signed-off-by: @gm112 <740416+gm112@users.noreply.github.com>

chore: remove we alloc

Signed-off-by: @gm112 <740416+gm112@users.noreply.github.com>

ci: implement github ci

Signed-off-by: @gm112 <740416+gm112@users.noreply.github.com>

@gm112 dc3f3113 421c28ff

+58 -63
+54
.github/workflows/ci.yml
··· 1 + name: CI 2 + 3 + on: 4 + pull_request: 5 + branches: 6 + - main 7 + 8 + jobs: 9 + build: 10 + runs-on: ubuntu-latest 11 + steps: 12 + - uses: actions/checkout@v5 13 + - uses: dtolnay/rust-toolchain@stable 14 + with: 15 + targets: wasm32-unknown-unknown 16 + components: clippy, rustfmt 17 + - name: Setup rust 18 + shell: bash 19 + run: | 20 + cargo install wasm-pack 21 + cargo clean 22 + - name: Setup pnpm 23 + uses: pnpm/action-setup@v4 24 + with: 25 + run_install: false 26 + - uses: actions/setup-node@v5 27 + with: 28 + node-version-file: ".nvmrc" 29 + cache: "pnpm" 30 + 31 + - run: pnpm install --frozen-lockfile && pnpm --filter playground exec playwright install 32 + - name: Build Projects and Validate Code Formatting 33 + shell: bash 34 + run: | 35 + pnpm run lint 36 + pnpm run test 37 + pnpm run build:prod 38 + # echo "Building Projects" 39 + # pnpm run build & build_pid=$! 40 + 41 + # echo "Validating Code Formatting" 42 + # pnpm run lint & lint_pid=$! 43 + 44 + # echo "Testing Projects" 45 + # pnpm run test & test_pid=$! 46 + 47 + # wait $build_pid; build_exit_code=$? 48 + # wait $lint_pid; lint_exit_code=$? 49 + # wait $test_pid; test_exit_code=$? 50 + 51 + # if [ $build_exit_code -ne 0 ] || [ $lint_exit_code -ne 0 ] || [ $test_exit_code -ne 0 ]; then 52 + # echo "Build, lint, or test failed. Exiting." >&2 53 + # exit 1 54 + # fi
+1
.nvmrc
··· 1 + lts/*
+3 -56
Cargo.lock
··· 20 20 21 21 [[package]] 22 22 name = "cfg-if" 23 - version = "0.1.10" 24 - source = "registry+https://github.com/rust-lang/crates.io-index" 25 - checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" 26 - 27 - [[package]] 28 - name = "cfg-if" 29 23 version = "1.0.3" 30 24 source = "registry+https://github.com/rust-lang/crates.io-index" 31 25 checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9" ··· 37 31 "console_error_panic_hook", 38 32 "wasm-bindgen", 39 33 "wasm-bindgen-test", 40 - "wee_alloc", 41 34 ] 42 35 43 36 [[package]] ··· 53 46 source = "registry+https://github.com/rust-lang/crates.io-index" 54 47 checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" 55 48 dependencies = [ 56 - "cfg-if 1.0.3", 49 + "cfg-if", 57 50 "wasm-bindgen", 58 51 ] 59 52 ··· 72 65 "once_cell", 73 66 "wasm-bindgen", 74 67 ] 75 - 76 - [[package]] 77 - name = "libc" 78 - version = "0.2.176" 79 - source = "registry+https://github.com/rust-lang/crates.io-index" 80 - checksum = "58f929b4d672ea937a23a1ab494143d968337a5f47e56d0815df1e0890ddf174" 81 68 82 69 [[package]] 83 70 name = "log" ··· 86 73 checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432" 87 74 88 75 [[package]] 89 - name = "memory_units" 90 - version = "0.4.0" 91 - source = "registry+https://github.com/rust-lang/crates.io-index" 92 - checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" 93 - 94 - [[package]] 95 76 name = "minicov" 96 77 version = "0.3.7" 97 78 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 179 160 source = "registry+https://github.com/rust-lang/crates.io-index" 180 161 checksum = "c1da10c01ae9f1ae40cbfac0bac3b1e724b320abfcf52229f80b547c0d250e2d" 181 162 dependencies = [ 182 - "cfg-if 1.0.3", 163 + "cfg-if", 183 164 "once_cell", 184 165 "rustversion", 185 166 "wasm-bindgen-macro", ··· 206 187 source = "registry+https://github.com/rust-lang/crates.io-index" 207 188 checksum = "7e038d41e478cc73bae0ff9b36c60cff1c98b8f38f8d7e8061e79ee63608ac5c" 208 189 dependencies = [ 209 - "cfg-if 1.0.3", 190 + "cfg-if", 210 191 "js-sys", 211 192 "once_cell", 212 193 "wasm-bindgen", ··· 280 261 ] 281 262 282 263 [[package]] 283 - name = "wee_alloc" 284 - version = "0.4.5" 285 - source = "registry+https://github.com/rust-lang/crates.io-index" 286 - checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" 287 - dependencies = [ 288 - "cfg-if 0.1.10", 289 - "libc", 290 - "memory_units", 291 - "winapi", 292 - ] 293 - 294 - [[package]] 295 - name = "winapi" 296 - version = "0.3.9" 297 - source = "registry+https://github.com/rust-lang/crates.io-index" 298 - checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 299 - dependencies = [ 300 - "winapi-i686-pc-windows-gnu", 301 - "winapi-x86_64-pc-windows-gnu", 302 - ] 303 - 304 - [[package]] 305 - name = "winapi-i686-pc-windows-gnu" 306 - version = "0.4.0" 307 - source = "registry+https://github.com/rust-lang/crates.io-index" 308 - checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 309 - 310 - [[package]] 311 264 name = "winapi-util" 312 265 version = "0.1.11" 313 266 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 315 268 dependencies = [ 316 269 "windows-sys", 317 270 ] 318 - 319 - [[package]] 320 - name = "winapi-x86_64-pc-windows-gnu" 321 - version = "0.4.0" 322 - source = "registry+https://github.com/rust-lang/crates.io-index" 323 - checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 324 271 325 272 [[package]] 326 273 name = "windows-link"
-1
com-gm112-rust-testlibrary/Cargo.toml
··· 13 13 [dependencies] 14 14 console_error_panic_hook = { version = "0.1.7", optional = true } 15 15 wasm-bindgen = "0.2.104" 16 - wee_alloc = { version = "0.4.5", default-features = false } 17 16 18 17 [dev-dependencies] 19 18 wasm-bindgen-test = "0.3.54"
-6
com-gm112-rust-testlibrary/src/lib.rs
··· 1 1 #[cfg(target_arch = "wasm32")] 2 2 use wasm_bindgen::prelude::*; 3 - #[cfg(target_arch = "wasm32")] 4 - use wee_alloc::WeeAlloc; 5 - 6 - #[cfg(target_arch = "wasm32")] 7 - #[global_allocator] 8 - static ALLOC: WeeAlloc = WeeAlloc::INIT; 9 3 10 4 #[cfg(feature = "console_error_panic_hook")] 11 5 #[cfg(target_arch = "wasm32")]