Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 18 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
.DEFAULT_GOAL := help
.PHONY: help build release embed-release check test fmt fmt-check lint ci install run clean
.PHONY: help build release check test lint fmt fmt-check ci install install-binary build-locked run clean

BIN_NAME := youtrack-cli
INSTALL_DIR ?= /usr/local/bin

help:
@echo "Targets:"
@echo " build cargo build (debug)"
@echo " release cargo build --release"
@echo " embed-release release build with compile-time embedded creds"
@echo " (requires exported YOUTRACK_URL_EMBED and YOUTRACK_TOKEN_EMBED)"
@echo " check cargo check"
@echo " test cargo test"
@echo " lint cargo clippy --all-targets -- -D warnings"
@echo " fmt cargo fmt"
@echo " fmt-check cargo fmt --check"
@echo " lint cargo clippy --all-targets -- -D warnings"
@echo " ci fmt-check + lint + test"
@echo " install cargo install --path ."
@echo " install-binary install pre-built binary to INSTALL_DIR"
@echo " build-locked locked build (requires YOUTRACK_URL + YOUTRACK_TOKEN)"
@echo " run cargo run -- \$$(ARGS)"
@echo " clean cargo clean"

Expand All @@ -23,31 +26,34 @@ build:
release:
cargo build --release

embed-release:
@test -n "$$YOUTRACK_URL_EMBED" || { echo "export YOUTRACK_URL_EMBED first" >&2; exit 1; }
@test -n "$$YOUTRACK_TOKEN_EMBED" || { echo "export YOUTRACK_TOKEN_EMBED first" >&2; exit 1; }
cargo build --release

check:
cargo check

test:
cargo test

lint:
cargo clippy --all-targets -- -D warnings

fmt:
cargo fmt

fmt-check:
cargo fmt --check

lint:
cargo clippy --all-targets -- -D warnings

ci: fmt-check lint test

install:
cargo install --path .

install-binary:
@test -f "target/release/$(BIN_NAME)" || { echo "binary not found at target/release/$(BIN_NAME) — run 'make release' first"; exit 1; }
install -d "$(INSTALL_DIR)"
install -m 0755 "target/release/$(BIN_NAME)" "$(INSTALL_DIR)/$(BIN_NAME)"

build-locked:
scripts/build-locked.sh

run:
cargo run -- $(ARGS)

Expand Down
10 changes: 10 additions & 0 deletions scripts/build-locked.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -euo pipefail

: "${YOUTRACK_URL:?YOUTRACK_URL is required}"
: "${YOUTRACK_TOKEN:?YOUTRACK_TOKEN is required}"

exec env \
YOUTRACK_URL_EMBED="$YOUTRACK_URL" \
YOUTRACK_TOKEN_EMBED="$YOUTRACK_TOKEN" \
cargo build --release
Loading