Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
wawa0210 authored Jan 30, 2024
2 parents a67b164 + b6c7aae commit 2615b47
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 65 deletions.
2 changes: 0 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ updates:
schedule:
interval: "weekly"
day: "sunday"
labels:
- area/dependency
ignore:
- dependency-name: k8s.io/*
labels:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,21 @@ jobs:
version: latest
args: -v --timeout 5m
skip-cache: true
test:
name: Unit test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '1.20'
- run: make test
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Build dev image
run: make .build-image

- name: Build
run: make docker-build

- name: Tests
run: make docker-coverage
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,3 @@ jobs:
run: |
echo "${VERSION}"
make -f deployments/container/Makefile build-${{ matrix.dist }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
/nvidia-dra-plugin
.idea
[._]*.sw[a-p]
coverage.out
46 changes: 11 additions & 35 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ ifeq ($(IMAGE_NAME),)
IMAGE_NAME = $(REGISTRY)/$(DRIVER_NAME)
endif

BUILDIMAGE_TAG ?= golang$(GOLANG_VERSION)
BUILDIMAGE ?= $(IMAGE_NAME)-build:$(BUILDIMAGE_TAG)

CMDS := $(patsubst ./cmd/%/,%,$(sort $(dir $(wildcard ./cmd/*/))))
CMD_TARGETS := $(patsubst %,cmd-%, $(CMDS))

Expand Down Expand Up @@ -89,7 +86,7 @@ golangci-lint:

COVERAGE_FILE := coverage.out
test: build cmds
go test -v -coverprofile=$(COVERAGE_FILE) $(MODULE)/...
go test -race -cover -v -coverprofile=$(COVERAGE_FILE) $(MODULE)/...

coverage: test
cat $(COVERAGE_FILE) | grep -v "_mock.go" > $(COVERAGE_FILE).no-mocks
Expand Down Expand Up @@ -138,34 +135,14 @@ generate-clientset: .remove-clientset .remove-deepcopy .remove-crds
.remove-clientset:
rm -rf $(CURDIR)/$(PKG_BASE)/clientset

# Generate an image for containerized builds
# Note: This image is local only
.PHONY: .build-image .pull-build-image .push-build-image
.build-image: docker/Dockerfile.devel
if [ x"$(SKIP_IMAGE_BUILD)" = x"" ]; then \
$(DOCKER) build \
--progress=plain \
--build-arg GOLANG_VERSION="$(GOLANG_VERSION)" \
--tag $(BUILDIMAGE) \
-f $(^) \
docker; \
fi

.pull-build-image:
$(DOCKER) pull $(BUILDIMAGE)

.push-build-image:
$(DOCKER) push $(BUILDIMAGE)

$(DOCKER_TARGETS): docker-%: .build-image
@echo "Running 'make $(*)' in docker container $(BUILDIMAGE)"
$(DOCKER_TARGETS): docker-%:
@echo "Running 'make $(*)' in container image $(BUILDIMAGE)"
$(DOCKER) run \
--rm \
-e HOME=$(PWD) \
-e GOCACHE=$(PWD)/.cache/go \
-e GOPATH=$(PWD)/.cache/gopath \
-v $(PWD):$(PWD) \
-w $(PWD) \
-e GOCACHE=/tmp/.cache/go \
-e GOMODCACHE=/tmp/.cache/gomod \
-v $(PWD):/work \
-w /work \
--user $$(id -u):$$(id -g) \
$(BUILDIMAGE) \
make $(*)
Expand All @@ -176,10 +153,9 @@ PHONY: .shell
$(DOCKER) run \
--rm \
-ti \
-e HOME=$(PWD) \
-e GOCACHE=$(PWD)/.cache/go \
-e GOPATH=$(PWD)/.cache/gopath \
-v $(PWD):$(PWD) \
-w $(PWD) \
-e GOCACHE=/tmp/.cache/go \
-e GOMODCACHE=/tmp/.cache/gomod \
-v $(PWD):/work \
-w /work \
--user $$(id -u):$$(id -g) \
$(BUILDIMAGE)
21 changes: 0 additions & 21 deletions docker/Dockerfile.devel

This file was deleted.

3 changes: 3 additions & 0 deletions versions.mk
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,7 @@ vVERSION := v$(VERSION:v%=%)
GOLANG_VERSION ?= 1.20.4
CUDA_VERSION ?= 11.8.0

BUILDIMAGE_TAG ?= devel-go$(GOLANG_VERSION)
BUILDIMAGE ?= ghcr.io/nvidia/k8s-test-infra:$(BUILDIMAGE_TAG)

GIT_COMMIT ?= $(shell git describe --match="" --dirty --long --always --abbrev=40 2> /dev/null || echo "")

0 comments on commit 2615b47

Please sign in to comment.