This repository has been archived by the owner on Jul 29, 2022. It is now read-only.
forked from vitiral/artifact
-
Notifications
You must be signed in to change notification settings - Fork 0
/
justfile
138 lines (99 loc) · 3.8 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
132
133
134
135
136
137
138
# justfile
# see: https://github.com/casey/just
##################################################
# constants
version = `sed -En 's/version = "([^"]+)"/\1/p' Cargo.toml | head -n1`
target = "$PWD/target"
nightly = "CARGO_TARGET_DIR=$TG/nightly CARGO_INCREMENTAL=1 rustup run nightly"
echo-version:
echo {{version}}
doc:
cargo doc --open
##################################################
# build commands
build-dev: # build using nightly and incremental compilation
TG={{target}} {{nightly}} cargo build
echo "built binary to: target/nightly/debug/art"
build-elm: # build just elm (not rust)
(cd web-ui; npm run build)
(cd web-ui/dist; tar -cvf ../../src/api/data/web-ui.tar *)
build-static: # build and package elm as a static index.html
(cd web-ui; elm make src/Main-Static.elm)
rm -rf target/web
mkdir target/web
cp web-ui/index.html target/web
cp -r web-ui/css target/web
# copy and link the style sheets
sed -e 's/<title>Main<\/title>/<title>Design Documents<\/title>/g' target/web/index.html -i
sed -e 's/<head>/<head><link rel="stylesheet" type="text\/css" href="css\/index.css" \/>/g' target/web/index.html -i
(cd target/web; tar -cvf ../../src/cmd/data/web-ui-static.tar *)
# full build for a std release. Currently doesn't include the server code
build-full: build-static
just build-dev
##################################################
# unit testing/linting commands
test: # do tests with web=false
RUST_BACKTRACE=1 cargo test --lib
test-dev: # test using nightly and incremental compilation
TG={{target}} {{nightly}} cargo test --lib
test-elm:
(cd web-ui; elm test)
test-all: test-elm test
filter PATTERN: # run only specific tests
RUST_BACKTRACE=1 cargo test --lib {{PATTERN}}
lint: # run linter
CARGO_TARGET_DIR={{target}}/nightly rustup run nightly cargo clippy
test-server-only:
RUST_BACKTRACE=1 cargo test --lib --features server
test-server: build-elm # run the test-server for e2e testing, still in development
just test-server-only
test-e2e: # run e2e tests, still in development
(cd web-ui; py2t e2e_tests/basic.py)
##################################################
# running commands
api: # run the api server (without the web-ui)
cargo run -- -v server
serve-rust:
TG={{target}} {{nightly}} cargo run --features server -- -v serve
serve: build-elm # run the full frontend
just serve-rust
self-check: # build self and run `art check` using own binary
TG={{target}} {{nightly}} cargo run -- check
##################################################
# release command
fmt:
cargo fmt -- --write-mode overwrite # don't generate *.bk files
art fmt -w
check-fmt:
cargo fmt -- --write-mode=diff
check: check-fmt
art check
git-verify: # make sure git is clean and on master
git branch | grep '* master'
git diff --no-ext-diff --quiet --exit-code
publish: git-verify lint build-full test-all self-check # publish to github and crates.io
git commit -a -m "v{{version}} release"
just publish-cargo
just publish-git
export-site: build-full
rm -rf _gh-pages/index.html _gh-pages/css
TG={{target}} {{nightly}} cargo run -- export html && mv index.html css _gh-pages
publish-site: export-site
rm -rf _gh-pages/index.html _gh-pages/css
TG={{target}} {{nightly}} cargo run -- export html && mv index.html css _gh-pages
(cd _gh-pages; git commit -am 'v{{version}}' && git push origin gh-pages)
publish-cargo: # publish cargo without verification
cargo publish --no-verify
publish-git: # publish git without verification
git push origin master
git tag -a "v{{version}}" -m "v{{version}}"
git push origin --tags
##################################################
# developer installation helpers
update: # update rust and tools used by this lib
rustup update
(cargo install just -f)
(cargo install rustfmt -f)
rustup run nightly cargo install clippy -f
install-nightly:
rustup install nightly