-
Notifications
You must be signed in to change notification settings - Fork 0
/
justfile
128 lines (88 loc) · 2.37 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
set shell := ["bash", "-uc"]
export TAG := `cat Cargo.toml | grep '^version =' | cut -d " " -f3 | xargs`
WASM_TARGET := '--target wasm32-unknown-unknown'
# install needed cargo utitlies
setup:
#!/usr/bin/env bash
set -euxo pipefail
clear
cargo install cargo-hack
cargo install cargo-minimal-versions
cargo install cargo-msrv
clippy:
#!/usr/bin/env bash
set -euxo pipefail
clear
cargo clippy
cargo clippy {{WASM_TARGET}}
# clippy lint + check with minimal versions from nightly
check:
#!/usr/bin/env bash
set -euxo pipefail
clear
cargo update
echo 'Clippy with defaults'
cargo +nightly clippy -- -D warnings
echo 'Checking minimal versions'
cargo minimal-versions check
# prints out the currently set version
version:
echo {{TAG}}
# builds the code
build:
#!/usr/bin/env bash
set -euxo pipefail
# build as musl to make sure this works
cargo build --release --target x86_64-unknown-linux-musl
# build wasm frontend modules
build-frontend:
#!/usr/bin/env bash
clear
cd wasm-builder
rm -rf ../frontend/wasm
wasm-pack build --release -d ../frontend/wasm --no-pack --out-name spow-wasm
rm -rf ../frontend/wasm/.gitignore
rm -rf ../examples/svelte-wasm/src/spow
cp -r ../frontend ../examples/svelte-wasm/src/spow
git add ../frontend
git add ../examples/svelte-wasm/src/spow
# runs the full set of tests
test:
#!/usr/bin/env bash
set -euxo pipefail
clear
cargo test
# runs the example svelte ui for testing wasm
run-js:
#!/usr/bin/env bash
clear
cd examples/svelte-wasm
npm run dev
# verifies the MSRV
msrv-verify:
cargo msrv verify
# find's the new MSRV, if it needs a bump
msrv-find:
cargo msrv --min 1.70.0
# verify thats everything is good
verify: check test build msrv-verify
# makes sure everything is fine
verfiy-is-clean: verify
#!/usr/bin/env bash
set -euxo pipefail
# make sure everything has been committed
git diff --exit-code
echo all good
# sets a new git tag and pushes it
release: verfiy-is-clean
#!/usr/bin/env bash
set -euxo pipefail
# make sure git is clean
git diff --quiet || exit 1
git tag "v$TAG"
git push origin "v$TAG"
# publishes the current version to cargo.io
publish: verfiy-is-clean
#!/usr/bin/env bash
set -euxo pipefail
cargo publish