Fixes for release (#237)

* Fixes for release
* add new test
* Remove change applied in development branch
* Only add dependency for wasm32
* Update ci.yml

Co-authored-by: Luis Moreno <morenol@users.noreply.github.com>
Co-authored-by: Lorenzo <tunedconsulting@gmail.com>
This commit is contained in:
morenol
2022-11-08 11:07:14 -05:00
committed by GitHub
parent 46b6285d05
commit 9eaae9ef35
3 changed files with 18 additions and 6 deletions
+6 -1
View File
@@ -46,11 +46,16 @@ jobs:
- name: Install test runner for wasi - name: Install test runner for wasi
if: matrix.platform.target == 'wasm32-wasi' if: matrix.platform.target == 'wasm32-wasi'
run: curl https://wasmtime.dev/install.sh -sSf | bash run: curl https://wasmtime.dev/install.sh -sSf | bash
- name: Stable Build - name: Stable Build with all features
uses: actions-rs/cargo@v1 uses: actions-rs/cargo@v1
with: with:
command: build command: build
args: --all-features --target ${{ matrix.platform.target }} args: --all-features --target ${{ matrix.platform.target }}
- name: Stable Build without features
uses: actions-rs/cargo@v1
with:
command: build
args: --target ${{ matrix.platform.target }}
- name: Tests - name: Tests
if: matrix.platform.target == 'x86_64-unknown-linux-gnu' || matrix.platform.target == 'x86_64-pc-windows-msvc' || matrix.platform.target == 'aarch64-apple-darwin' if: matrix.platform.target == 'x86_64-unknown-linux-gnu' || matrix.platform.target == 'x86_64-pc-windows-msvc' || matrix.platform.target == 'aarch64-apple-darwin'
uses: actions-rs/cargo@v1 uses: actions-rs/cargo@v1
+1 -2
View File
@@ -26,7 +26,6 @@ ndarray = { version = "0.15", optional = true }
num-traits = "0.2.12" num-traits = "0.2.12"
num = "0.4" num = "0.4"
rand = { version = "0.8.5", default-features = false, features = ["small_rng"] } rand = { version = "0.8.5", default-features = false, features = ["small_rng"] }
getrandom = "*"
rand_distr = { version = "0.4", optional = true } rand_distr = { version = "0.4", optional = true }
serde = { version = "1", features = ["derive"], optional = true } serde = { version = "1", features = ["derive"], optional = true }
@@ -40,7 +39,7 @@ std_rand = ["rand/std_rng", "rand/std"]
js = ["getrandom/js"] js = ["getrandom/js"]
[target.'cfg(target_arch = "wasm32")'.dependencies] [target.'cfg(target_arch = "wasm32")'.dependencies]
getrandom = { version = "*", features = ["js"] } getrandom = { version = "*", optional = true }
[target.'cfg(all(target_arch = "wasm32", not(target_os = "wasi")))'.dev-dependencies] [target.'cfg(all(target_arch = "wasm32", not(target_os = "wasi")))'.dev-dependencies]
wasm-bindgen-test = "0.3" wasm-bindgen-test = "0.3"
+11 -3
View File
@@ -15,9 +15,17 @@ pub fn get_rng_impl(seed: Option<u64>) -> RngImpl {
RngImpl::seed_from_u64(rand::thread_rng().next_u64()) RngImpl::seed_from_u64(rand::thread_rng().next_u64())
} else { } else {
// no std_random feature build, use getrandom // no std_random feature build, use getrandom
let mut buf = [0u8; 64]; #[cfg(feature = "js")]
getrandom::getrandom(&mut buf).unwrap(); {
RngImpl::seed_from_u64(buf[0] as u64) let mut buf = [0u8; 64];
getrandom::getrandom(&mut buf).unwrap();
RngImpl::seed_from_u64(buf[0] as u64)
}
#[cfg(not(feature = "js"))]
{
// Using 0 as default seed
RngImpl::seed_from_u64(0)
}
} }
} }
} }