From 99e02fb388c2e791d03c3426bd0411395bfaf453 Mon Sep 17 00:00:00 2001 From: Hendrik Eeckhaut Date: Wed, 2 Oct 2024 11:40:50 +0200 Subject: [PATCH] Add convenience script to run most ci checks locally --- crates/wasm-test-runner/run.sh | 11 ++++++++--- pre-commit-check.sh | 22 ++++++++++++++++++++++ 2 files changed, 30 insertions(+), 3 deletions(-) create mode 100755 pre-commit-check.sh diff --git a/crates/wasm-test-runner/run.sh b/crates/wasm-test-runner/run.sh index a43d98c284..5fd29cc2b9 100755 --- a/crates/wasm-test-runner/run.sh +++ b/crates/wasm-test-runner/run.sh @@ -1,4 +1,9 @@ +#!/bin/sh + +# Ensure the script runs in the folder that contains this script +cd "$(dirname "$0")" + RUSTFLAGS='-C target-feature=+atomics,+bulk-memory,+mutable-globals' \ -rustup run nightly \ -wasm-pack build ../wasm --target web --no-pack --out-dir=../wasm-test-runner/static/generated -- -Zbuild-std=panic_abort,std --features test,no-bundler \ -&& RUST_LOG=debug cargo run --release + rustup run nightly \ + wasm-pack build ../wasm --target web --no-pack --out-dir=../wasm-test-runner/static/generated -- -Zbuild-std=panic_abort,std --features test,no-bundler && + RUST_LOG=debug cargo run --release diff --git a/pre-commit-check.sh b/pre-commit-check.sh new file mode 100755 index 0000000000..132ec8009a --- /dev/null +++ b/pre-commit-check.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +# This script is used to run checks before committing changes to the repository. +# It is a good approximation of what CI will do. + +# Fail if any command fails +set -e + +# Check formatting +cargo +nightly fmt --all + +# Check clippy +cargo clippy --all-features --all-targets -- -D warnings + +# Build all targets +# cargo build --all-targets + +# Run tests +# cargo test + +# Run wasm tests +# ./crates/wasm-test-runner/run.sh