Commit 0cf59ead authored by Vasilis Katopodis's avatar Vasilis Katopodis
Browse files

chore: add Makefile, wire CI to it, and drop leaked kubeconfig fixtures

parent ef48ba1e
Loading
Loading
Loading
Loading
+2 −0
Changes for .gitignore: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -4,3 +4,5 @@ org.etsi.osl.hypo.core.pkg-manager.helm
GEMINI.md
CLAUDE.md
.claude/
bin/
coverage.out
+2 −4
Changes for .gitlab-ci.yml: 2 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ lint:
      - go mod download
      - |
        set -o pipefail
        golangci-lint run ./... --fast-only --output.text.path=stderr --output.checkstyle.path=stdout | tee ${SONAR_GO_COVERAGE}/golanci-report.xml
        make lint LINT_ARGS="--output.text.path=stderr --output.checkstyle.path=stdout" | tee ${SONAR_GO_COVERAGE}/golanci-report.xml
  artifacts:
    paths:
      - ${SONAR_GO_COVERAGE}
@@ -76,9 +76,7 @@ tests_job:
    - echo "127.0.0.1 $(hostname)" >> /etc/hosts
    - echo "$GROUP_ACCESS_TOKEN" | docker login $HYPO_APPS_REGISTRY -u $GROUP_ACCESS_NAME --password-stdin
    - go mod download
    - gofmt -e -s -w .
    - go vet ./...
    - go test -v -cover -coverprofile=${SONAR_GO_COVERAGE}/coverage.out -coverpkg=./... ./... -skip TestOcmScheduler
    - make test COVERAGE_DIR=${SONAR_GO_COVERAGE}

  after_script:
    - docker container prune -f || true

Makefile

0 → 100644
+58 −0
Changes for Makefile: 58 added lines, 0 removed lines.
Original line number Diff line number Diff line
# Makefile for pkg-manager.helm.
#
# This is a plain Go service (no CRDs/controller-runtime), so unlike
# p2code_scheduler_operator's Makefile there is no manifests/generate/kustomize/
# envtest/bundle/catalog scaffolding here - those are operator-sdk/OLM concerns
# that don't apply to this repo.

GOLANGCI_LINT ?= golangci-lint
COVERAGE_DIR ?= .
IMG ?= pkg-manager:latest
DOCKERFILE ?= build/Dockerfile

.PHONY: help
help: ## Display this help.
	@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n  make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf "  \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)

##@ Development

.PHONY: fmt
fmt: ## Run gofmt against code.
	gofmt -e -s -w .

.PHONY: vet
vet: ## Run go vet against code.
	go vet ./...

.PHONY: lint
lint: ## Run golangci-lint. Set LINT_ARGS to append flags (e.g. CI report output).
	$(GOLANGCI_LINT) run ./... --fast-only $(LINT_ARGS)

.PHONY: lint-fix
lint-fix: ## Run golangci-lint and apply fixes.
	$(GOLANGCI_LINT) run --fix

.PHONY: test
test: fmt vet ## Run unit tests. Set COVERAGE_DIR for coverage.out location, TEST_ARGS to append flags (e.g. -run/-skip).
	go test -v -cover -coverprofile=$(COVERAGE_DIR)/coverage.out -coverpkg=./... ./... $(TEST_ARGS)

##@ Build

.PHONY: build
build: fmt vet ## Build the pkg-manager.helm binary.
	go build -o bin/pkg-manager.helm .

.PHONY: run
run: ## Run the service locally.
	go run .

.PHONY: docker-build
docker-build: ## Build the docker image.
	docker build -f $(DOCKERFILE) -t $(IMG) .

.PHONY: docker-push
docker-push: ## Push the docker image.
	docker push $(IMG)

.PHONY: all
all: build
+1 −1
Changes for go.mod: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@ require (
	k8s.io/api v0.30.3
	k8s.io/apimachinery v0.30.3
	k8s.io/client-go v0.30.3
	labs.etsi.org/rep/osl/hypo/code/org.etsi.osl.hypo.core/base.go v1.0.1
	labs.etsi.org/rep/osl/hypo/code/org.etsi.osl.hypo.core/base.go v1.1.1
)

require (
+2 −2
Loading