Skip to content
Open
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
10 changes: 2 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@ jobs:
go-version: '1.26.1'

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler
make -C agent setup proto
run: make -C agent install proto

- name: Run Agent tests
run: make -C agent test
Expand All @@ -54,10 +51,7 @@ jobs:
go-version: '1.26.1'

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler
make -C agent setup proto
run: make -C agent install proto

- name: Build Agent Local Image
run: |
Expand Down
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
all: setup
all: install
make -C agent
make -C sdks/python

Expand All @@ -18,10 +18,11 @@ docker-build: docker/Dockerfile
docker build -t $(DOCKER_TAG) --progress=plain -f $< .
.PHONY: docker-build

setup:
$(MAKE) -C agent setup
install:
$(MAKE) -C agent install
$(MAKE) -C sdks/python install

.PHONY: setup
.PHONY: install

test:
$(MAKE) -C agent test
Expand Down
23 changes: 13 additions & 10 deletions agent/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ PYTHON_SDK_DIR = ../sdks/python/
GENERATED_DIR = .generated/proto
GENERATED_PATH=$(GENERATED_DIR)/github.com/cortexapps/axon

all: setup proto build test
all: install proto build test

PROTO_FILES := $(wildcard proto/*.proto)
GO_FILES := $(patsubst proto/%.proto,$(GENERATED_PATH)/%.pb.go,$(PROTO_FILES))

GOPATH ?= $(HOME)/go
GOBIN ?= $(GOPATH)/bin

proto: setup $(GO_FILES) version
proto: install $(GO_FILES) version

version: $(GO_SDK_DIR)/version/agentversion.txt $(PYTHON_SDK_DIR)/cortex_axon/agentversion.py

Expand All @@ -33,15 +33,18 @@ $(GENERATED_PATH)/%.pb.go: proto/%.proto
@mkdir -p $(GO_SDK_DIR)/.generated
@cp -R $(GENERATED_DIR) $(GO_SDK_DIR)/.generated

setup:
install:
@if ! command -v $(GOBIN)/protoc-gen-go >/dev/null; then echo "Installing protoc-gen-go..."; go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.36.6; fi
@if ! command -v $(GOBIN)/protoc-gen-go-grpc >/dev/null; then echo "Installing protoc-gen-go-grpc..."; go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.5.1; fi
@if ! which protoc >/dev/null; then \
if which brew >/dev/null; then \
brew install protobuf; \
else \
apt update && apt install -y protobuf-compiler; \
fi; \
@if which brew >/dev/null; then \
if ! which protoc >/dev/null; then brew install protobuf; fi; \
elif [ "$$(uname)" = "Linux" ]; then \
PKGS=""; \
if ! which protoc >/dev/null; then PKGS="protobuf-compiler"; fi; \
if ! test -f /usr/include/google/protobuf/timestamp.proto; then PKGS="$$PKGS libprotobuf-dev"; fi; \
if [ -n "$$PKGS" ]; then sudo apt-get update && sudo apt-get install -y $$PKGS; fi; \
else \
echo "WARNING: Unrecognized platform $$(uname) -- not installing protobuf dependencies"; \
fi

build:
Expand Down Expand Up @@ -89,4 +92,4 @@ run: proto
go run main.go serve


.PHONY: setup test build
.PHONY: install test build
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ ENV GOPROXY="https://proxy.golang.org,direct"
ENV PATH="${GOROOT}/bin:${GOPATH}/bin:${PATH}:/agent"

COPY agent/. /build/.
RUN make -C /build setup proto
RUN make -C /build install proto
RUN cd /build && go build -o /agent/cortex-axon-agent
RUN rm -rf /build

Expand Down
8 changes: 8 additions & 0 deletions sdks/python/Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
# Unset VIRTUAL_ENV to prevent Poetry from using a stale/broken venv
# (e.g. /lsiopy set by container init systems like s6-overlay)
unexport VIRTUAL_ENV

all: clean install proto

install: .venv
.PHONY: install

.venv: pyproject.toml
@echo "Installing python dependencies"
@if ! which python >/dev/null && which python3 >/dev/null; then \
echo "python not found, creating python -> python3 symlink..."; \
sudo ln -sf $$(which python3) /usr/local/bin/python; \
fi
@if ! which poetry >/dev/null; then \
curl -sSL https://install.python-poetry.org | python3 -; \
fi
Expand Down
Loading