forked from witnet/witnet-rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJustfile
More file actions
122 lines (103 loc) · 3.85 KB
/
Justfile
File metadata and controls
122 lines (103 loc) · 3.85 KB
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
# run continuous integration checks
ci +flags="":
just versions 2>/dev/null || just install-setup
cargo fmt --all -- --check
just clippy
cargo test --all --verbose {{flags}}
# install clippy
install-clippy:
rustup component add clippy-preview
# install rustfmt
install-rustfmt:
rustup component add rustfmt-preview
# install dev tools
install-setup:
rustup update
just install-clippy
just install-rustfmt
# print tool versions
versions:
rustc --version
cargo fmt -- --version
cargo clippy -- --version
# run clippy
clippy +flags="":
cargo clippy --all --all-features -- -D warnings {{flags}}
cargo clippy --all --all-targets --all-features -- -A clippy::type_complexity {{flags}}
# run formatter
fmt +flags="":
cargo +nightly fmt -v --all {{flags}}
# run node
node +args="":
RUST_LOG=witnet=info cargo run node {{args}}
# run local documentation server at localhost:8000
docs-dev:
mkdocs serve
# compile docs into static files
docs-build:
mkdocs build
# deploy compiled docs into gh-pages branch
docs-deploy:
mkdocs gh-deploy
# run continuous integration checks on a different platform using docker
docker-ci target="x86_64-unknown-linux-gnu" +flags="":
docker run \
-v $(pwd):/project:rw \
-v $(pwd)/target:/target \
-w /project \
-it witnet-rust/{{target}} \
just ci --target-dir=/target --target={{target}} {{flags}}
# run latest debug binary inside a docker container
docker-debug log_level="debug" +flags="-c /witnet/witnet.toml node server":
docker run \
-e RUST_LOG=witnet={{log_level}} \
-v `pwd`:/witnet \
-it witnet/debug-run {{flags}}
# build docker images for all cross compilation targets
docker-image-build-all:
find ./docker/cross-compilation -type d -ls | tail -n +2 | sed -En "s/^(.*)\.\/docker\/cross-compilation\/(.*)/\2/p" | xargs -n1 just docker-image-build
# build docker image for a specific compilation target
docker-image-build target:
docker build --no-cache -t witnet-rust/{{target}} -f docker/cross-compilation/{{target}}/Dockerfile docker/cross-compilation
docker-python-tester test_name="example":
docker run \
--network=host \
-v `pwd`/docker/python-tester:/tests \
-v `pwd`/examples:/requests \
-it witnet/python-tester {{test_name}}.py
# cross compile witnet-rust for all cross compilation targets
cross-compile-all:
find ./docker/cross-compilation -type d -ls | tail -n +2 | sed -En "s/^(.*)\.\/docker\/cross-compilation\/(.*)/\2/p" | xargs -n1 just cross-compile
# cross compile witnet-rust for a specific compilation target
# - this assumes the container to set the `$STRIP` variable to be the path for binutils `strip` tool
# - if `$STRIP` is unset, the binary will not be stripped and will retain all its symbols
cross-compile target profile="release":
docker run \
-v `pwd`:/project:ro \
-v `pwd`/target:/target \
-v ~/.cargo:/root/.cargo \
-w /project \
-i witnet-rust/{{target}} \
bash -c "cargo build `[[ {{profile}} == "release" ]] && echo "--release"` --target={{target}} --target-dir=/target \
&& [ ! -z "\$STRIP" ] \
&& \$STRIP /target/{{target}}/{{profile}}/witnet || echo \"No STRIP environment variable is set, passing.\""
# run the latest stable release in the latest testnet
e2e-stable test_name="example" +flags="":
TEST_NAME={{test_name}} \
docker-compose \
-f docker/compose/e2e-stable/docker-compose.yaml \
up \
--scale=node=1 \
--abort-on-container-exit \
--exit-code-from tester \
{{flags}}
# run the local debug binary (taken from ./target/debug) in the latest testnet
e2e-debug test_name="example" +flags="":
cargo build
TEST_NAME={{test_name}} \
docker-compose \
-f docker/compose/e2e-debug/docker-compose.yaml \
up \
--abort-on-container-exit \
--exit-code-from tester \
{{flags}}