/
makefile
81 lines (65 loc) · 3.29 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
RFLAGS="-C link-arg=-s"
all: linear
linear: contracts/linear
rustup target add wasm32-unknown-unknown
RUSTFLAGS=$(RFLAGS) cargo build -p linear --target wasm32-unknown-unknown --release
mkdir -p res
cp target/wasm32-unknown-unknown/release/linear.wasm ./res/linear.wasm
linear_test: contracts/linear
rustup target add wasm32-unknown-unknown
RUSTFLAGS=$(RFLAGS) cargo build -p linear --target wasm32-unknown-unknown --release --features "test"
mkdir -p res
cp target/wasm32-unknown-unknown/release/linear.wasm ./res/linear_test.wasm
mock-staking-pool: contracts/mock-staking-pool
rustup target add wasm32-unknown-unknown
RUSTFLAGS=$(RFLAGS) cargo build -p mock-staking-pool --target wasm32-unknown-unknown --release
mkdir -p res
cp target/wasm32-unknown-unknown/release/mock_staking_pool.wasm ./res/mock_staking_pool.wasm
mock-fungible-token: contracts/mock-fungible-token
rustup target add wasm32-unknown-unknown
RUSTFLAGS=$(RFLAGS) cargo build -p mock-fungible-token --target wasm32-unknown-unknown --release
mkdir -p res
cp target/wasm32-unknown-unknown/release/mock_fungible_token.wasm ./res/mock_fungible_token.wasm
mock-dex: contracts/mock-dex
rustup target add wasm32-unknown-unknown
RUSTFLAGS=$(RFLAGS) cargo build -p mock-dex --target wasm32-unknown-unknown --release
mkdir -p res
cp target/wasm32-unknown-unknown/release/mock_dex.wasm ./res/mock_dex.wasm
mock-lockup: contracts/mock-lockup
rustup target add wasm32-unknown-unknown
RUSTFLAGS=$(RFLAGS) cargo build -p mock-lockup --target wasm32-unknown-unknown --release
mkdir -p res
cp target/wasm32-unknown-unknown/release/mock_lockup.wasm ./res/mock_lockup.wasm
mock-whitelist: contracts/mock-whitelist
rustup target add wasm32-unknown-unknown
RUSTFLAGS=$(RFLAGS) cargo build -p mock-whitelist --target wasm32-unknown-unknown --release
mkdir -p res
cp target/wasm32-unknown-unknown/release/mock_whitelist.wasm ./res/mock_whitelist.wasm
clean:
rm res/*.wasm
lint:
cargo fmt -- --check
cargo clippy --tests -- -D clippy::all
test: test-unit test-linear test-mock-staking-pool test-mock-fungible-token
test-unit:
cargo test --features "test"
TEST_FILE ?= **
LOGS ?=
test-contracts: linear_test mock-staking-pool mock-fungible-token mock-dex mock-lockup mock-whitelist
@mkdir -p ./tests/compiled-contracts/
@cp ./res/linear_test.wasm ./tests/compiled-contracts/linear.wasm
@cp ./res/mock_staking_pool.wasm ./tests/compiled-contracts/mock_staking_pool.wasm
@cp ./res/mock_fungible_token.wasm ./tests/compiled-contracts/mock_fungible_token.wasm
@cp ./res/mock_dex.wasm ./tests/compiled-contracts/mock_dex.wasm
@cp ./res/mock_lockup.wasm ./tests/compiled-contracts/mock_lockup.wasm
@cp ./res/mock_whitelist.wasm ./tests/compiled-contracts/mock_whitelist.wasm
test-linear: test-contracts
cd tests && NEAR_PRINT_LOGS=$(LOGS) npx ava --timeout=2m __tests__/linear/$(TEST_FILE).ava.ts --verbose
test-mock-staking-pool: mock-staking-pool
@mkdir -p ./tests/compiled-contracts/
cp ./res/mock_staking_pool.wasm ./tests/compiled-contracts/mock_staking_pool.wasm
cd tests && npx ava __tests__/mock-staking-pool/**.ts --verbose
test-mock-fungible-token: mock-fungible-token
@mkdir -p ./tests/compiled-contracts/
cp ./res/mock_fungible_token.wasm ./tests/compiled-contracts/mock_fungible_token.wasm
cd tests && npx ava __tests__/mock-fungible-token/**.ts --verbose