-
Notifications
You must be signed in to change notification settings - Fork 0
/
justfile
91 lines (74 loc) · 2.53 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
set positional-arguments
set shell := ["bash", "-cue"]
root_dir := `git rev-parse --show-toplevel`
# General Variables:
# You can chose either "podman" or "docker".
container_mgr := "podman"
# Default recipe to list all recipes.
default:
just --list
# Enter a Nix development shell.
nix-develop *args:
cd "{{root_dir}}" && \
cmd=("$@") && \
{ [ -n "${cmd:-}" ] || cmd=("zsh"); } && \
nix develop ./tools/nix#default --command "${cmd[@]}"
nix-develop-ci *args:
cd "{{root_dir}}" && \
cmd=("$@") && \
{ [ -n "${cmd:-}" ] || cmd=("zsh"); } && \
nix develop ./tools/nix#ci --command "${cmd[@]}"
# Enter nix development shell for benchmarking.
nix-develop-bench *args:
cd "{{root_dir}}" && \
cmd=("$@") && \
{ [ -n "${cmd:-}" ] || cmd=("zsh"); } && \
nix develop ./tools/nix#bench --command "${cmd[@]}"
## Standard stuff =============================================================
# Format the code.
format *args:
cd "{{root_dir}}" && \
"{{root_dir}}/tools/format-rust.sh" {{args}}
# Lint all code.
lint *args:
cd "{{root_dir}}" && \
"{{root_dir}}/tools/lint-rust.sh" {{args}}
# Build the executable.
build *args:
cd "{{root_dir}}" && cargo build "${@:1}"
# Run the tests.
test:
cd "{{root_dir}}" && cargo test "${@:1}"
## Development functionality ==================================================
# Watch source and continuously build the executable.
watch:
cd "{{root_dir}}" && cargo watch -x 'build'
# Run the executable.
run:
cd "{{root_dir}}" && cargo run "${@:1}"
# Create a new release by version bumping.
# Usage:
# ```shell
# just release <sem-version>
# ```
# by updating the version file and triggering the release workflow.
release version:
cd "{{root_dir}}" && \
CONTAINER_MGR="{{container_mgr}}" \
"{{root_dir}}/tools/release.sh" "{{version}}"
## ============================================================================
## CI stuff ===================================================================
# Build the nix package into the folder `package` (first argument).
nix-package *args:
cd "{{root_dir}}" && \
"./tools/build-package.sh" "$@"
# Build the Docker image with Nix (distroless by default!).
nix-image *args:
cd "{{root_dir}}" && \
"./tools/build-image.sh" "$@"
# Upload all images for CI (local machine)
upload-ci-images:
cd "{{root_dir}}" && \
CONTAINER_MGR="{{container_mgr}}" \
tools/ci/upload-ci-images.sh
## ============================================================================