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
27 changes: 0 additions & 27 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,33 +136,6 @@ jobs:
git fetch origin main
git merge-base --is-ancestor "$GITHUB_SHA" origin/main

- name: Collect PGO profile
env:
BASECAMP_NO_KEYRING: "1"
run: |
echo "Collecting PGO profile from benchmarks..."
mkdir -p profiles
failed=0
# Go's -cpuprofile doesn't work with multiple packages, so profile each and merge
for pkg in $(go list ./internal/...); do
pkg_name=$(basename "$pkg")
echo " Profiling $pkg_name..."
if ! go test -cpuprofile="profiles/${pkg_name}.pprof" -bench=. -benchtime=3s -run='^$' "$pkg" >/dev/null 2>&1; then
echo " WARNING: $pkg_name benchmarks failed"
failed=$((failed + 1))
fi
done
if [ "$failed" -gt 0 ]; then
echo "WARNING: $failed package(s) failed benchmarking — PGO profile may be incomplete"
fi
# Merge all profiles (skip if none were generated)
if ls profiles/*.pprof >/dev/null 2>&1; then
go tool pprof -proto profiles/*.pprof > default.pgo
echo "PGO profile generated: $(du -h default.pgo | cut -f1)"
else
echo "No PGO profiles generated — build will use standard optimization"
fi

- name: Install Cosign
uses: sigstore/cosign-installer@faadad0cce49287aee09b3a48701e75088a2c6ad # v4.0.0

Expand Down
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,5 @@ benchmarks-current.txt
# Keep baseline for tracking
# benchmarks-baseline.txt

# PGO profile (generated, can optionally be committed for reproducible builds)
default.pgo

# Nix
result
4 changes: 0 additions & 4 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ project_name: basecamp

before:
hooks:
# PGO profile should be generated by release workflow before GoReleaser runs
- sh -c 'if [ -f default.pgo ]; then echo "PGO profile found ($(du -h default.pgo | cut -f1))"; else echo "No PGO profile - build will use standard optimization"; fi'
- sh -c 'mkdir -p completions && go run ./cmd/basecamp completion bash > completions/basecamp.bash && go run ./cmd/basecamp completion zsh > completions/_basecamp && go run ./cmd/basecamp completion fish > completions/basecamp.fish'

builds:
Expand All @@ -24,9 +22,7 @@ builds:
goarch:
- amd64
- arm64
# PGO: Use profile if available (Go 1.21+)
flags:
- -pgo=auto
- -trimpath
ldflags:
- -s -w
Expand Down
4 changes: 0 additions & 4 deletions .surface-breaking
Original file line number Diff line number Diff line change
@@ -1,4 +0,0 @@
FLAG basecamp projects --all type=bool
FLAG basecamp projects --limit type=int
FLAG basecamp projects --page type=int
FLAG basecamp projects --status type=string
54 changes: 5 additions & 49 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,6 @@ VERSION_PKG := github.com/basecamp/basecamp-cli/internal/version
LDFLAGS := -s -w -X $(VERSION_PKG).Version=$(VERSION) -X $(VERSION_PKG).Commit=$(COMMIT) -X $(VERSION_PKG).Date=$(DATE)
Comment thread
jeremy marked this conversation as resolved.
BUILD_FLAGS := -trimpath -ldflags "$(LDFLAGS)"

# PGO (Profile-Guided Optimization)
PGO_PROFILE := default.pgo
HAS_PGO := $(shell test -f $(PGO_PROFILE) && echo 1 || echo 0)
ifeq ($(HAS_PGO),1)
PGO_FLAGS := -pgo=$(PGO_PROFILE)
else
PGO_FLAGS :=
endif

# Default target
.PHONY: all
all: check
Expand All @@ -46,18 +37,6 @@ all: check
build: check-toolchain
CGO_ENABLED=0 $(GOBUILD) $(BUILD_FLAGS) -o $(BUILD_DIR)/$(BINARY) ./cmd/basecamp

# Build with PGO optimization (requires default.pgo)
.PHONY: build-pgo
build-pgo:
@if [ ! -f $(PGO_PROFILE) ]; then \
echo "Warning: $(PGO_PROFILE) not found. Run 'make collect-profile' first."; \
echo "Building without PGO..."; \
CGO_ENABLED=0 $(GOBUILD) $(BUILD_FLAGS) -o $(BUILD_DIR)/$(BINARY) ./cmd/basecamp; \
else \
echo "Building with PGO optimization..."; \
CGO_ENABLED=0 $(GOBUILD) $(BUILD_FLAGS) $(PGO_FLAGS) -o $(BUILD_DIR)/$(BINARY) ./cmd/basecamp; \
fi

# Build for all platforms
.PHONY: build-all
build-all: build-darwin build-linux build-windows build-bsd
Expand Down Expand Up @@ -131,8 +110,6 @@ bench-cpu:
BASECAMP_NO_KEYRING=1 $(GOTEST) -bench=. -benchtime=1s -cpuprofile=profiles/cpu.pprof ./internal/names
@echo "CPU profile saved to profiles/cpu.pprof"
@echo "View with: go tool pprof -http=:8080 profiles/cpu.pprof"
@echo ""
@echo "Note: For full multi-package profiling, use 'make collect-profile'"

# Run benchmarks with memory profiling (profiles first package only due to Go limitation)
.PHONY: bench-mem
Expand All @@ -142,8 +119,6 @@ bench-mem:
BASECAMP_NO_KEYRING=1 $(GOTEST) -bench=. -benchtime=1s -benchmem -memprofile=profiles/mem.pprof ./internal/names
@echo "Memory profile saved to profiles/mem.pprof"
@echo "View with: go tool pprof -http=:8080 profiles/mem.pprof"
@echo ""
@echo "Note: For full multi-package profiling, use 'make collect-profile'"

# Save current benchmarks as baseline for comparison
.PHONY: bench-save
Expand All @@ -162,22 +137,6 @@ bench-compare:
@command -v benchstat >/dev/null 2>&1 || go install golang.org/x/perf/cmd/benchstat@latest
benchstat benchmarks-baseline.txt benchmarks-current.txt

# ============================================================================
# Profile-Guided Optimization (PGO)
# ============================================================================

# Collect PGO profile from benchmarks
.PHONY: collect-profile
collect-profile:
./scripts/collect-profile.sh

# Clean PGO and profiling artifacts
.PHONY: clean-pgo
clean-pgo:
rm -f $(PGO_PROFILE)
rm -rf profiles/
rm -f benchmarks-*.txt

# Guard against Go toolchain mismatch (mise environment)
.PHONY: check-toolchain
check-toolchain:
Comment thread
jeremy marked this conversation as resolved.
Expand Down Expand Up @@ -287,9 +246,11 @@ clean:
rm -rf $(BUILD_DIR)
rm -f coverage.out coverage.html

# Clean all (including PGO artifacts)
# Clean all (including profiling and benchmark artifacts)
.PHONY: clean-all
clean-all: clean clean-pgo
clean-all: clean
Comment thread
jeremy marked this conversation as resolved.
rm -rf profiles/
rm -f benchmarks-*.txt

# Install to GOPATH/bin
Comment thread
jeremy marked this conversation as resolved.
.PHONY: install
Expand Down Expand Up @@ -453,7 +414,6 @@ help:
@echo ""
@echo "Build:"
@echo " build Build the binary"
@echo " build-pgo Build with PGO optimization (requires profile)"
@echo " build-all Build for all platforms"
@echo " build-darwin Build for macOS (arm64 + amd64)"
@echo " build-linux Build for Linux (arm64 + amd64)"
Expand All @@ -474,10 +434,6 @@ help:
@echo " bench-save Save current benchmarks as baseline"
@echo " bench-compare Compare against baseline (requires benchstat)"
@echo ""
@echo "PGO (Profile-Guided Optimization):"
@echo " collect-profile Generate PGO profile from benchmarks"
@echo " clean-pgo Remove PGO artifacts"
@echo ""
@echo "Code Quality:"
@echo " check-toolchain Guard against Go toolchain mismatch"
@echo " vet Run go vet"
Expand All @@ -499,7 +455,7 @@ help:
@echo " tidy Tidy go.mod dependencies"
@echo " verify Verify dependencies"
@echo " clean Remove build artifacts"
@echo " clean-all Remove all artifacts (including PGO)"
@echo " clean-all Remove all artifacts (including profiles)"
@echo " install Install to GOPATH/bin"
@echo " check Run all checks (local CI gate)"
@echo " check-naming Guard against stale bcq/BCQ references"
Expand Down
75 changes: 0 additions & 75 deletions scripts/collect-profile.sh

This file was deleted.

Loading