-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathjustfile
More file actions
executable file
·139 lines (130 loc) · 4.9 KB
/
Copy pathjustfile
File metadata and controls
executable file
·139 lines (130 loc) · 4.9 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#! /usr/bin/env nix
#! nix develop --command just --justfile
# Use `DRY_RUN=1` to do a dry run of any command.
#
# ```sh
# $ DRY_RUN=1 just tag v0.1.2
# DRY_RUN enabled.
# 🏷️ Tagging HEAD with 'v0.1.2'
# git tag -a v0.1.2 -m "Elodin v0.1.2"
# git push origin v0.1.2
# ```
[private]
default:
@just --list
version:
@echo "v$(cargo metadata --format-version 1 | jq -r '.packages[] | select(.name == "elodin") | .version')"
tag new_tag commit="":
#!/usr/bin/env sh
[ -n "$DRY_RUN" ] && echo "DRY_RUN enabled."
current_tag=$(git describe --tags --abbrev=0)
commit="{{commit}}"
new_tag="{{new_tag}}"
if [ "$current_tag" = "$new_tag" ]; then
echo "error: Latest tag is already '$new_tag'" >&2; exit 1;
fi
current_branch=$(git branch --show-current);
if [ -z "$commit" ] && [ "$current_branch" != "main" ]; then
echo "error: Expected 'main' branch but was '$current_branch'." >&2; exit 2;
fi
echo "🏷️ Tagging HEAD with '$new_tag'"
sh -v ${DRY_RUN:+-n} <<EOF
git tag -a $new_tag $commit -m "Elodin $new_tag"
git push origin $new_tag
EOF
wait-for-release tag:
#!/usr/bin/env sh
tag="{{tag}}"
start=$(date +%s)
max_wait=45; # minutes
while ! (gh release list | egrep "^v${tag}[[:space:]]"); do
sleep $((5 * 60)); # Sleep for 5 minutes.
now=$(date +%s)
if $((now - start)) -gt $((max_wait * 60)); then
echo "error: Timed out waiting for release ${tag}." >&2;
exit 3;
fi
done
echo "Release ${tag} is available for download.";
promote tag:
#!/usr/bin/env sh
[ -n "$DRY_RUN" ] && echo "DRY_RUN enabled."
if [ -z "$UV_PUBLISH_TOKEN" ]; then
echo "error: Set UV_PUBLISH_TOKEN to the token." >&2;
exit 1;
fi
sh -v ${DRY_RUN:+-n} <<'EOF'
dir=$(mktemp -d)
gh release download {{tag}} --pattern 'elodin-*.whl' --dir $dir
uv publish "$dir/*.whl" --token "$UV_PUBLISH_TOKEN"
EOF
public-changelog:
#!/usr/bin/env sh
[ -n "$DRY_RUN" ] && echo "DRY_RUN enabled."
sh -v ${DRY_RUN:+-n} <<EOF
cd {{justfile_directory()}}
./scripts/public-changelog.sh CHANGELOG.md > docs/public/content/releases/changelog.md
EOF
bash << 'EOF'
echo -n "Checking docs/public/config.toml for right version... "
new_version="$(just version)"
if ! grep "^version = \"$new_version\"" docs/public/config.toml >/dev/null; then
echo "NOT FOUND."
echo "error: version not set to $new_version in docs/public/config.toml" >&2;
exit 1
else
echo "FOUND."
fi
EOF
build-windows-gnu:
#!/usr/bin/env sh
env \
CC_x86_64_pc_windows_gnu=x86_64-w64-mingw32-gcc-posix \
CXX_x86_64_pc_windows_gnu=x86_64-w64-mingw32-g++-posix \
AR_x86_64_pc_windows_gnu=x86_64-w64-mingw32-gcc-ar-posix \
CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER=x86_64-w64-mingw32-gcc-posix \
cargo build --release -p elodin --target x86_64-pc-windows-gnu
install target="all":
#!/usr/bin/env sh
set -e
# Drop 0-byte libelodin.so left by maturin 1.13+'s broken staging dance
# (PyO3/maturin#3054); cargo's fingerprint accepts empty outputs and would
# otherwise short-circuit forever. The maturin@1.12.6 pin below stops new
# ones from appearing while keeping uvx working in non-Nix setups too.
find target -maxdepth 4 -name 'libelodin.so' -size 0 -delete 2>/dev/null || true
mkdir -p "${CARGO_HOME:-$HOME/.cargo}/bin"
case "{{target}}" in
py)
uv venv --python 3.13 --python-preference only-system --clear
. .venv/bin/activate
uvx maturin@1.12.6 develop --uv --release --manifest-path=libs/nox-py/Cargo.toml
echo "Venv ready. Run source with \`source .venv/bin/activate\` before running examples with python3"
;;
editor)
cargo build --release -p elodin
install -m 755 target/release/elodin "${CARGO_HOME:-$HOME/.cargo}/bin/"
;;
db)
cargo build --release -p elodin-db
install -m 755 target/release/elodin-db "${CARGO_HOME:-$HOME/.cargo}/bin/"
;;
tracy)
if [ "$(uname -s)" = "Darwin" ]; then
echo "error: Tracy profiling is only supported on Linux." >&2
echo "Tracy depends on C++20 features (std::jthread) not available in Apple's libc++." >&2
echo "Use a Linux machine or an OrbStack NixOS VM for profiling." >&2
exit 1
fi
uv venv --python 3.13 --python-preference only-system --clear
. .venv/bin/activate
uvx maturin@1.12.6 develop --uv --release --manifest-path=libs/nox-py/Cargo.toml -F tracy
echo "Venv ready. Run source with \`source .venv/bin/activate\` before running examples with python3"
cargo build --release -p elodin -p elodin-db --features tracy
install -m 755 target/release/elodin "${CARGO_HOME:-$HOME/.cargo}/bin/"
install -m 755 target/release/elodin-db "${CARGO_HOME:-$HOME/.cargo}/bin/"
;;
all) just install py && just install editor && just install db;;
*)
echo "usage: just install [py|editor|db|all]" >&2
exit 1;;
esac