Skip to content

Commit

Permalink
Add make rule 'check-format' and enable in CI
Browse files Browse the repository at this point in the history
Require that any new changes are formatted in canonical Go style.

Signed-off-by: Jon Mayo <[email protected]>
  • Loading branch information
nvjmayo committed May 4, 2020
1 parent bb820cf commit 2f67009
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ GOLANG_VERSION := 1.14.2
VERSION := 2.0.0-rc.7
FULL_VERSION := $(DCGM_VERSION)-$(VERSION)

.PHONY: all binary install
.PHONY: all binary install check-format
all: ubuntu18.04 ubi8

binary:
Expand All @@ -32,6 +32,9 @@ install: binary
install -m 557 -D ./etc/dcgm-exporter/default-counters.csv /etc/dcgm-exporter/default-counters.csv
install -m 557 -D ./etc/dcgm-exporter/dcp-metrics-included.csv /etc/dcgm-exporter/dcp-metrics-included.csv

check-format:
test $$(gofmt -l pkg bindings | tee /dev/stderr | wc -l) -eq 0

push:
$(DOCKER) push "$(REGISTRY)/dcgm-exporter:$(FULL_VERSION)-ubuntu18.04"
$(DOCKER) push "$(REGISTRY)/dcgm-exporter:$(FULL_VERSION)-ubi8"
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile.ubi8
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ WORKDIR /go/src/github.com/NVIDIA/gpu-monitoring-tools

COPY . .

RUN make binary
RUN make binary check-format

FROM registry.access.redhat.com/ubi8:latest
LABEL io.k8s.display-name="NVIDIA DCGM Exporter"
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile.ubuntu18.04
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ WORKDIR /go/src/github.com/NVIDIA/gpu-monitoring-tools

COPY . .

RUN make binary
RUN make binary check-format

FROM ubuntu:18.04
LABEL io.k8s.display-name="NVIDIA DCGM Exporter"
Expand Down

0 comments on commit 2f67009

Please sign in to comment.