-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
68 lines (58 loc) · 1.63 KB
/
justfile
File metadata and controls
68 lines (58 loc) · 1.63 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
# Devops: Development scripts
INSTALL_PATH := "$HOME/.local"
# Default command
_default:
@just --list --unsorted
# Sync Go modules
tidy:
go mod tidy
@echo "All modules synced, Go workspace ready!"
# CLI local run wrapper
hackstack *args:
@go run . {{ args }}
# Run all BDD tests
test:
@echo "Running unit tests!"
@go clean -testcache
go test -cover -race ./...
# Build the binary
build:
#!/usr/bin/env bash
# Detect OS and architecture
case "$(uname -s)" in
Linux*) OS="linux" ;;
Darwin*) OS="darwin" ;;
*) echo "Error: Unsupported OS (${OS})"; exit 1 ;;
esac
case "$(uname -m)" in
x86_64) ARCH="amd64" ;;
aarch64) ARCH="arm64" ;;
arm64) ARCH="arm64" ;;
*) echo "Error: Unsupported architecture (${ENV_ARCH})"; exit 1 ;;
esac
echo "Building hackstack for ${OS}/${ARCH}..."
go mod download all
CGO_ENABLED=0 GOOS="${OS}" GOARCH="${ARCH}" go build -o ./hackstack .
echo "Built binary for hackstack successfully!"
# Install the binary locally
install-local: build
#!/usr/bin/env bash
set -eux
echo "Installing hackstack locally..."
BIN_PATH="{{ INSTALL_PATH }}/bin/hackstack"
cp ./hackstack "${BIN_PATH}"
chmod +x "${BIN_PATH}"
echo "Installed hackstack locally!"
# Remove the local binary
uninstall-local:
#!/usr/bin/env bash
set -eux
echo "Uninstalling hackstack..."
BIN_PATH="{{ INSTALL_PATH }}/bin/hackstack"
rm "${BIN_PATH}"
echo "Uninstalled hackstack!"
# Update the project dependencies
update-deps:
@echo "Updating project dependencies..."
go get -u ./...
go mod tidy