CI: Add WASM script

In preparation for using the `run_task` script from maintainer tools we
want to have all the things that are particular to `rust-bitcoin` out of
the current `run_task` script.

The wasm test is specific to `hashes`. Add a script in `hashes/contrib`
and call it from the wasm job.

No test coverage change.
This commit is contained in:
Tobin C. Harding 2024-05-02 12:56:49 +10:00
parent cc14edf63f
commit 3407257936
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
3 changed files with 14 additions and 21 deletions

View File

@ -246,8 +246,8 @@ jobs:
uses: actions/checkout@v4
- name: "Select toolchain"
uses: dtolnay/rust-toolchain@stable
- name: "Run test script"
run: ./contrib/run_task.sh wasm
- name: "Run wasm script"
run: cd hashes && ./contrib/wasm.sh
Schemars: # hashes crate only.
name: Schemars - stable toolchain

View File

@ -90,11 +90,6 @@ main() {
do_bench
;;
wasm)
# hashes crate only.
do_wasm
;;
asan)
# hashes crate only - hashes/contrib/test_vars.sh is sourced in this function.
do_asan
@ -259,20 +254,6 @@ do_bench() {
done
}
# Note we do not use the recent lock file or `--locked` when running the wasm tests.
do_wasm() {
pushd "$REPO_DIR/hashes" > /dev/null
clang --version &&
CARGO_TARGET_DIR=wasm cargo install --force wasm-pack &&
printf '\n[target.wasm32-unknown-unknown.dev-dependencies]\nwasm-bindgen-test = "0.3"\n' >> Cargo.toml &&
printf '\n[lib]\ncrate-type = ["cdylib", "rlib"]\n' >> Cargo.toml &&
CC=clang-9 wasm-pack build &&
CC=clang-9 wasm-pack test --node;
popd > /dev/null
}
do_asan() {
pushd "$REPO_DIR/hashes" > /dev/null

12
hashes/contrib/wasm.sh Executable file
View File

@ -0,0 +1,12 @@
#!/usr/bin/env bash
#
# Run the WASM tests.
set -euox pipefail
clang --version &&
CARGO_TARGET_DIR=wasm cargo install --force wasm-pack &&
printf '\n[target.wasm32-unknown-unknown.dev-dependencies]\nwasm-bindgen-test = "0.3"\n' >> Cargo.toml &&
printf '\n[lib]\ncrate-type = ["cdylib", "rlib"]\n' >> Cargo.toml &&
CC=clang-9 wasm-pack build &&
CC=clang-9 wasm-pack test --node;