-
Notifications
You must be signed in to change notification settings - Fork 3
/
makefile
58 lines (44 loc) · 1.57 KB
/
makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
RFLAGS="-C link-arg=-s"
all: phoenix
clean:
rm res/*.wasm
rm tests/compiled-contracts/*.wasm
phoenix: contracts/phoenix-bonds
$(call compile_release,phoenix-bonds)
@mkdir -p res
cp target/wasm32-unknown-unknown/release/phoenix_bonds.wasm ./res/phoenix_bonds.wasm
# test build
phoenix_test: contracts/phoenix-bonds
$(call compile_test,phoenix-bonds)
cp target/wasm32-unknown-unknown/debug/phoenix_bonds.wasm ./res/phoenix_bonds_test.wasm
mock_linear: contracts/mock-linear
$(call compile_release,mock-linear)
@mkdir -p res
cp target/wasm32-unknown-unknown/release/mock_linear.wasm ./res/mock_linear.wasm
lint:
cargo fmt -- --check
cargo clippy --tests -- -D clippy::all
npx cspell --words-only --unique "**"
define compile_release
@rustup target add wasm32-unknown-unknown
RUSTFLAGS=$(RFLAGS) cargo build -p $(1) --target wasm32-unknown-unknown --release
endef
define compile_test
@rustup target add wasm32-unknown-unknown
RUSTFLAGS=$(RFLAGS) cargo build -p $(1) --target wasm32-unknown-unknown --features "test"
@mkdir -p res
endef
test: test-unit
NEAR_WORKSPACES_NO_LOGS=1 make test-integration
test-unit:
cargo test
TEST_FILE ?= **
LOGS ?=
TEST_CONCURRENCY ?= 4
monkey-patch:
cp ./tests/web.js node_modules/near-workspaces/node_modules/near-api-js/lib/utils/
test-integration: monkey-patch phoenix_test mock_linear
@mkdir -p ./tests/compiled-contracts/
@cp ./res/phoenix_bonds_test.wasm ./tests/compiled-contracts/
@cp ./res/mock_linear.wasm ./tests/compiled-contracts/
NEAR_PRINT_LOGS=$(LOGS) npx ava --timeout=5m tests/__tests__/$(TEST_FILE).ava.ts --verbose