From b6a7f283d15c169617a5b33a00f89f827f2b9ac7 Mon Sep 17 00:00:00 2001 From: Amolith Date: Wed, 8 Oct 2025 11:13:15 -0600 Subject: [PATCH] chore: add justfile --- justfile | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 justfile diff --git a/justfile b/justfile new file mode 100644 index 0000000000000000000000000000000000000000..50ebb71fd9e4561d2b4eeebd85a922607b0cf4a8 --- /dev/null +++ b/justfile @@ -0,0 +1,57 @@ +# SPDX-FileCopyrightText: Amolith +# +# SPDX-License-Identifier: CC0-1.0 + +GOOS := env("GOOS", `go env GOOS`) +GOARCH := env("GOARCH", `go env GOARCH`) +VERSION := `git describe --long 2>/dev/null | sed 's/\([^-]*-g\)/r\1/;s/-/./g'` + +default: fmt lint staticcheck test vuln reuse + +fmt: + # Formatting all Go source code + go install mvdan.cc/gofumpt@latest + gofumpt -l -w . + +lint: + # Linting Go source code + golangci-lint run + +staticcheck: + # Performing static analysis + go install honnef.co/go/tools/cmd/staticcheck@latest + staticcheck ./... + +test: + # Running tests + go test -v ./... + +vuln: + # Checking for vulnerabilities + go install golang.org/x/vuln/cmd/govulncheck@latest + govulncheck ./... + +reuse: + # Linting licenses and copyright headers + reuse lint + +build: + # Building soft-serve + CGO_ENABLED=0 GOOS={{GOOS}} GOARCH={{GOARCH}} go build -o soft -ldflags "-s -w -X main.version={{VERSION}}" ./cmd/soft + +run: + # Running soft-serve + CGO_ENABLED=0 GOOS={{GOOS}} GOARCH={{GOARCH}} go run -ldflags "-s -w -X main.version={{VERSION}}" ./cmd/soft serve + +pack: + # Packing soft-serve + upx --best -qo soft.min soft + mv soft.min soft + +clean: + # Removing build artifacts + rm -rf soft + +clean-all: + # Removing build artifacts and config.toml + rm -rf soft data/