generated from AbstractSDK/templates
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathjustfile
131 lines (101 loc) · 3.64 KB
/
justfile
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
gen-data-schema:
#!/usr/bin/env bash
quicktype --lang schema data-schema/data.json -o data-schema/schema.json
quicktype --lang rust data-schema/data.json -o contracts/intersync/src/data.rs
# Install the tools that are used in this justfile
install-tools:
cargo install cargo-nextest --locked || true
cargo install taplo-cli --locked || true
cargo install cargo-watch || true
cargo install cargo-limit || true
## Development Helpers ##
# Test everything
test:
cargo nextest run
watch-test:
cargo watch -x "nextest run"
# Format your code and `Cargo.toml` files
fmt:
cargo fmt --all
find . -type f -iname "*.toml" -print0 | xargs -0 taplo format
lint:
cargo clippy --all -- -D warnings
lintfix:
cargo clippy --fix --allow-staged --allow-dirty --all-features
just fmt
watch:
cargo watch -x "lcheck --all-features"
juno-local:
docker kill juno_node_1 || true
docker volume rm -f junod_data || true
docker run --rm -d \
--name juno_node_1 \
-p 1317:1317 \
-p 26656:26656 \
-p 26657:26657 \
-p 9090:9090 \
-e STAKE_TOKEN=ujunox \
-e UNSAFE_CORS=true \
--mount type=volume,source=junod_data,target=/root \
ghcr.io/cosmoscontracts/juno:15.0.0 \
./setup_and_run.sh juno16g2rahf5846rxzp3fwlswy08fz8ccuwk03k57y # You can add used sender addresses here
wasm:
#!/usr/bin/env bash
# Delete all the current wasms first
rm -rf ./artifacts/*.wasm
if [[ $(arch) == "arm64" ]]; then
image="abstractmoney/workspace-optimizer-arm64"
else
image="abstractmoney/workspace-optimizer"
fi
# Optimized builds
docker run --rm -v "$(pwd)":/code \
--mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
${image}:0.15.0
# Generate the schemas for the contracts
schema:
sh scripts/schema.sh
# Generate the schemas for this app and publish them to the schemas repository for access in the Abstract frontend
publish-schemas namespace name version: schema
#!/usr/bin/env bash
set -euxo pipefail
# Pre-run check for 'gh' CLI tool
if ! command -v gh &> /dev/null; then \
echo "'gh' could not be found. Please install GitHub CLI."; exit; \
fi
# check that the metadata exists
if [ ! -e "./contracts/{{name}}/metadata.json" ]; then \
echo "Please create metadata.json for module metadata"; exit; \
fi
tmp_dir="$(mktemp -d)"
schema_out_dir="$tmp_dir/{{namespace}}/{{name}}/"
contract_path="$(cargo tree -e normal -i {{name}} | cut -d '(' -f2 | cut -d ')' -f1)"
# Clone the repository to the temporary directory
git clone https://github.com/AbstractSDK/schemas "$tmp_dir"
# Create target directory structure and copy schemas
mkdir -p "$schema_out_dir"
cp -a "./schema/{{name}}/{{version}}" "$schema_out_dir"
# Copy metadata.json to the target directory
cp "$contract_path/metadata.json" "$schema_out_dir"
# Create a new branch with a name based on the inputs
cd "$tmp_dir"
git checkout -b '{{namespace}}/{{name}}/{{version}}'
# Stage all new and changed files for commit
git add .
# Commit the changes with a message
git commit -m 'Add schemas for {{namespace}} {{name}} {{version}}'
# Create a pull request using 'gh' CLI tool
gh pr create --title 'Add schemas for {{namespace}} {{name}} {{version}}' --body ""
## Exection commands ##
run-script script name +CHAINS:
cargo run --bin {{script}} --package {{name}} --features="daemon-bin" -- --network-ids {{CHAINS}}
publish name +CHAINS:
#!/usr/bin/env bash
set -euxo pipefail
if [ -d "artifacts" ]; then
echo "Build found ✅";
else
just wasm
fi
just run-script publish {{name}} {{CHAINS}}