From e3617ec00648b0815da87eec73aa99326e7d759d Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Wed, 24 Jan 2024 14:49:50 +0100 Subject: [PATCH] setup: adding Makefile --- .gitignore | 3 +++ Makefile | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 Makefile diff --git a/.gitignore b/.gitignore index cedb71e..4291129 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,9 @@ debug/ target/ schema/ +artifacts/ +artifacts-local/ + # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html Cargo.lock diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..1fb8027 --- /dev/null +++ b/Makefile @@ -0,0 +1,18 @@ +build-opt: +# https://github.com/CosmWasm/rust-optimizer + docker run --rm -v "$(CURDIR)":/code \ + --mount type=volume,source="$$(basename "$(CURDIR)")_cache",target=/code/target \ + --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \ + cosmwasm/workspace-optimizer:0.15.0 + +build: +# @RUSTFLAGS='-C link-arg=-s' cargo +stable build --target wasm32-unknown-unknown --release --lib + cargo build --target wasm32-unknown-unknown --release --lib + @mkdir -p artifacts-local + @cp target/wasm32-unknown-unknown/release/*.wasm ./artifacts-local + +check: + cosmwasm-check target/wasm32-unknown-unknown/release/*.wasm + +unit-test: + cargo test --lib