-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathJustfile
More file actions
170 lines (138 loc) · 4.6 KB
/
Justfile
File metadata and controls
170 lines (138 loc) · 4.6 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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
set dotenv-load := true
[doc("List recipes")]
default:
# --unsorted: list groups in the order specified in the justfile
just --list --unsorted
[doc("Run backend server")]
[group("run")]
run-server *args:
cargo run --features sea-orm-debug-print --bin backend -- run {{ args }}
[doc("Run backend server in release mode")]
[group("run")]
run-server-release *args:
cargo run --release --bin backend -- run {{ args }}
[doc("Run backend and auto-restart on code changes")]
[group("run")]
watch-server *args:
watchexec -r --socket tcp::${BUILDBTW_LISTEN} -- just run-server {{ args }}
[doc("Run client")]
[group("run")]
run-client *args:
cargo run --bin bbtw -- {{ args }}
[doc("Run client and auto-restart on code changes")]
[group("run")]
watch-client *args:
watchexec -r -- just run-client {{ args }}
[doc("Run worker")]
[group("run")]
run-worker *args:
cargo run --bin worker -- run {{ args }}
[doc("Run worker and auto-restart on code changes")]
[group("run")]
watch-worker *args:
watchexec -r -- just run-worker {{ args }}
[doc("Run repo-updater")]
[group("run")]
run-repo-updater *args:
cargo run --bin repo-updater -- {{ args }}
[doc("Run executor")]
[group("run")]
run-executor *args:
cargo run --bin buildbtw-executor -- {{ args }}
[doc("Run performance benchmarks")]
[group("run")]
bench:
cargo bench
[doc("Build in debug mode")]
[group("build")]
build *args:
cargo build {{args}}
[doc("Build in release mode")]
[group("build")]
build-release *args:
cargo build --locked --release {{args}}
[doc("Build release container image")]
[group("build")]
build-release-container-image:
podman build -f Containerfile --tag buildbtw
# Sanity check to see whether the binary will even launch
podman run --rm localhost/buildbtw --version
[doc("Run a sequence of recipes that resemble CI")]
[group("check")]
ci-dev:
#!/usr/bin/env -S parallel --shebang --ungroup
just licenses
just lint -q
just check-dependencies
just build-release -q
just test --hide-progress-bar --cargo-quiet --status-level fail
[doc("Check whether all files have a license")]
[group("check")]
licenses: (ensure-command "reuse")
reuse --include-submodules lint
[doc("Check lints and formatting")]
[group("check")]
lint *args:
cargo clippy --all-targets {{args}} -- -D warnings
cargo fmt --check
RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --document-private-items
[doc("Automatically fix lints and formatting")]
[group("check")]
lint-fix: && format
cargo clippy --all-targets --fix -- -D warnings
[doc("Format the source code")]
[group("check")]
format:
cargo fmt
[doc("Check for security advisories and license compliance in deps")]
[group("check")]
check-dependencies: (ensure-command "cargo-deny")
cargo deny check
[doc("Run tests")]
[group("test")]
test *args: (ensure-command "geckodriver")
cargo nextest run --features sea-orm-debug-print {{ args }}
[doc("Run tests that take long to run or might be flaky")]
[group("test")]
test-flaky *args:
cargo nextest run --features sea-orm-debug-print --run-ignored only {{ args }}
[doc("Run tests and auto-rerun on code changes")]
[group("test")]
watch-test *args: (ensure-command "geckodriver")
watchexec -r -- just test {{ args }}
[doc("Clean up build artifacts, caches, and temporary files")]
[group("dev")]
clean:
cargo clean
[doc("Generate a file with a timestamped name for a new migration")]
[group("dev")]
generate-migration *name: (ensure-command "sea-orm-cli")
sea-orm-cli migrate generate --migration-dir src/bin/backend/migrations "{{name}}"
[group("dev")]
migrate-database:
cargo run --bin backend migrate-database
[group("dev")]
reset-database: && migrate-database
rm -f $BUILDBTW_DATABASE_FILE
[group("dev")]
[doc("Install the development certificates in the system's trust store, e.g. for browsers. Requires root.")]
install-authelia-ca:
mkcert -install
[doc("Download GitLab GraphQL API schema")]
[group("dev")]
update-graphql-schema: (ensure-command "graphql-client")
#!/bin/sh
graphql-client introspect-schema "$BUILDBTW_GITLAB_DOMAIN/api/graphql" --authorization "$BUILDBTW_GITLAB_TOKEN" --output src/gitlab/graphql_schema.json
./scripts/prune-graphql-schema.sh src/gitlab/graphql_schema.json
[doc("Ensures that one or more required commands are installed")]
[private]
ensure-command +command:
#!/usr/bin/env bash
set -euo pipefail
read -r -a commands <<< "{{ command }}"
for cmd in "${commands[@]}"; do
if ! command -v "$cmd" > /dev/null 2>&1 ; then
printf "Couldn't find required executable '%s'\n" "$cmd" >&2
exit 1
fi
done