-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
89 lines (76 loc) · 2.16 KB
/
Copy pathjustfile
File metadata and controls
89 lines (76 loc) · 2.16 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
set positional-arguments
set shell := ["bash", "-cue"]
set dotenv-load
root_dir := `git rev-parse --show-toplevel`
flake_dir := root_dir / "tools/nix"
output_dir := root_dir / ".output"
build_dir := output_dir / "build"
go_modules := "src/init src/otlp-openmeter-bridge"
# Manage nix environment.
[group('modules')]
mod nix "./tools/just/nix.just"
# Manage the helm chart.
[group('modules')]
mod helm "./tools/just/helm.just"
# Default target if you do not specify a target.
default:
just --list --unsorted
# Enter the default Nix development shell and execute the command `"$@`.
[group('tooling')]
develop *args:
just nix::develop "default" "$@"
# Run commands over the ci development shell.
[group('tooling')]
ci *args:
just nix::develop "ci" "$@"
# Format the repository.
[group('tooling')]
format *args:
treefmt --config-file ./tools/config/treefmt.toml "$@"
# Setup the repository.
[group('tooling')]
setup:
cd "{{root_dir}}" && prek install
# Lint the repository.
[group('tooling')]
lint:
#!/usr/bin/env bash
set -eu
cd "{{root_dir}}"
just helm::lint
for d in {{go_modules}}; do (cd "$d" && go vet ./...); done
# Build the Go modules.
[group('general')]
build *args:
#!/usr/bin/env bash
set -eu
for d in {{go_modules}}; do
cd "{{root_dir}}/$d"
echo "building $d"
go build -v -o "{{build_dir}}/$(basename "$d")" ./...
done
# Clean up generated files.
[group('general')]
[confirm("Delete everything in:\n" + output_dir + "?\n [y/n]")]
clean: helm::clean
rm -fr "{{output_dir}}"/*
# Test the Go modules.
[group('general')]
test *args:
#!/usr/bin/env bash
set -eu
cd "{{root_dir}}"
for d in {{go_modules}}; do (cd "$d" && go test ./... "$@"); done
# Deploy Helm chart.
[group('chart')]
deploy namespace release values_file:
helm upgrade --install -n "{{namespace}}" "{{release}}" . --values "{{values_file}}"
# Errors if the repository contains unformatted files.
[private]
check-format *args:
just format --fail-on-change --no-cache || \
{ echo "Unformatted files. Run 'just format' locally."; exit 1; }
# Check for secret leaks.
[private]
check-leaks *args:
gitleaks git {{args}}