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
15 changes: 0 additions & 15 deletions .github/actions/go-test/action.yml

This file was deleted.

16 changes: 0 additions & 16 deletions .github/actions/push-image/action.yml

This file was deleted.

9 changes: 2 additions & 7 deletions .github/workflows/ci-pr-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Set up go with cache
uses: actions/setup-go@v5
with:
go-version: '1.24.0'
go-version-file: ./go.mod
cache-dependency-path: ./go.sum

- name: Install libzmq dependencies (kvcache/kvevents)
Expand All @@ -32,16 +32,11 @@ jobs:
- name: Run lint checks
uses: golangci/golangci-lint-action@v8
with:
version: 'v2.1.6'
version: 'v2.4.0'
args: "--config=./.golangci.yml"

- name: Run go test
shell: bash
run: |
echo "Installing Ginkgo..."
go install github.com/onsi/ginkgo/ginkgo@latest
export PATH=$PATH:$(go env GOPATH)/bin
echo "Ginkgo installed:"
ginkgo version
echo "Running tests with Ginkgo..."
make test
48 changes: 13 additions & 35 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.

LOCALBIN ?= $(shell pwd)/bin
$(LOCALBIN):
mkdir -p $(LOCALBIN)

# Project-specific Go tooling is defined in Makefile.tools.mk.
include Makefile.tools.mk

# Makefile for the llm-d-inference-sim project

SHELL := /usr/bin/env bash
Expand Down Expand Up @@ -75,12 +82,12 @@ format: ## Format Go source files
@gofmt -l -w $(SRC)

.PHONY: test
test: check-ginkgo download-tokenizer download-zmq ## Run tests
test: $(GINKGO) download-tokenizer download-zmq ## Run tests
@printf "\033[33;1m==== Running tests ====\033[0m\n"
ifdef GINKGO_FOCUS
CGO_ENABLED=1 ginkgo -ldflags="$(GO_LDFLAGS)" -v -r --focus="$(GINKGO_FOCUS)"
CGO_ENABLED=1 $(GINKGO) -ldflags="$(GO_LDFLAGS)" -v -r --focus="$(GINKGO_FOCUS)"
else
CGO_ENABLED=1 ginkgo -ldflags="$(GO_LDFLAGS)" -v -r
CGO_ENABLED=1 $(GINKGO) -ldflags="$(GO_LDFLAGS)" -v -r
endif

.PHONY: post-deploy-test
Expand All @@ -89,16 +96,16 @@ post-deploy-test: ## Run post deployment tests
@echo "Post-deployment tests passed."

.PHONY: lint
lint: check-golangci-lint check-golangci-lint-version ## Run lint
lint: $(GOLANGCI_LINT) ## Run lint
@printf "\033[33;1m==== Running linting ====\033[0m\n"
golangci-lint run
$(GOLANGCI_LINT) run

##@ Build

.PHONY: build
build: check-go download-tokenizer download-zmq
@printf "\033[33;1m==== Building ====\033[0m\n"
go build -ldflags="$(GO_LDFLAGS)" -o bin/$(PROJECT_NAME) cmd/$(PROJECT_NAME)/main.go
go build -ldflags="$(GO_LDFLAGS)" -o $(LOCALBIN)/$(PROJECT_NAME) cmd/$(PROJECT_NAME)/main.go

##@ Container Build/Push

Expand Down Expand Up @@ -163,40 +170,12 @@ env: ## Print environment variables
@echo "IMG=$(IMG)"
@echo "CONTAINER_TOOL=$(CONTAINER_TOOL)"


##@ Tools
.PHONY: check-tools
check-tools:
check-go \
check-ginkgo \
check-golangci-lint \
check-container-tool \
check-helm
@echo "✅ All required tools are installed."

.PHONY: check-go
check-go:
@command -v go >/dev/null 2>&1 || { \
echo "❌ Go is not installed. Install it from https://golang.org/dl/"; exit 1; }

.PHONY: check-ginkgo
check-ginkgo:
@command -v ginkgo >/dev/null 2>&1 || { \
echo "❌ ginkgo is not installed. Install with: go install github.com/onsi/ginkgo/v2/ginkgo@latest"; exit 1; }

.PHONY: check-golangci-lint
check-golangci-lint:
@command -v golangci-lint >/dev/null 2>&1 || { \
echo "❌ golangci-lint is not installed. Install from https://golangci-lint.run/docs/welcome/install/"; exit 1; }

.PHONY: check-golangci-lint-version
check-golangci-lint-version:
@version=$$(golangci-lint --version | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -n 1); \
if [[ $$version != 2.* ]]; then \
echo "❌ golangci-lint version 2.x is required. Current version: $$version"; \
exit 1; \
fi

.PHONY: check-container-tool
check-container-tool:
@command -v $(CONTAINER_TOOL) >/dev/null 2>&1 || { \
Expand All @@ -208,7 +187,6 @@ check-helm:
@command -v helm >/dev/null 2>&1 || { \
echo "❌ helm is not installed. Install it from https://helm.sh/docs/intro/install/"; exit 1; }


.PHONY: check-builder
check-builder:
@if [ -z "$(BUILDER)" ]; then \
Expand Down
42 changes: 42 additions & 0 deletions Makefile.tools.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Copyright 2025 The llm-d-inference-sim Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
# $1 - target path with name of binary
# $2 - package url which can be installed
# $3 - specific version of package
# Source: https://github.com/kubernetes-sigs/kubebuilder/blob/3fd04199acb4556376dc17a7393bfd43bcd40c26/Makefile#L237-L251
define go-install-tool
@[ -f "$(1)-$(3)" ] && [ "$$(readlink -- "$(1)" 2>/dev/null)" = "$(1)-$(3)" ] || { \
set -e; \
package=$(2)@$(3) ;\
echo "Downloading $${package}" ;\
rm -f $(1) ;\
GOBIN=$(LOCALBIN) go install $${package} ;\
mv $(1) $(1)-$(3) ;\
} ;\
ln -sf $$(realpath $(1)-$(3)) $(1)
endef

GOLANGCI_LINT = $(LOCALBIN)/golangci-lint
GOLANGCI_LINT_VERSION = v2.4.0
GINKGO = $(LOCALBIN)/ginkgo
GINKGO_VERSION = v2.25.3

$(GINKGO): $(LOCALBIN)
$(call go-install-tool,$(GINKGO),github.com/onsi/ginkgo/v2/ginkgo,$(GINKGO_VERSION))
@GOBIN=$(LOCALBIN) go install -mod=readonly github.com/onsi/ginkgo/v2/ginkgo

$(GOLANGCI_LINT): $(LOCALBIN)
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/v2/cmd/golangci-lint,$(GOLANGCI_LINT_VERSION))