Skip to content

Commit bd40dd8

Browse files
authored
Merge pull request #73 from grafana/rooneyshuman/add-ci
Add docker make commands and CI
2 parents ff3e476 + 6378c1b commit bd40dd8

File tree

4 files changed

+32
-12
lines changed

4 files changed

+32
-12
lines changed

.github/workflows/go.yml

+18-8
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ name: Go
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [ main, dev/hackathon-dec-2023 ]
66
pull_request:
7-
branches: [ main ]
7+
branches: [ main, dev/hackathon-dec-2023 ]
88

99
jobs:
1010

11-
build:
11+
test:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- uses: actions/checkout@v3
@@ -18,11 +18,21 @@ jobs:
1818
with:
1919
go-version: 1.21
2020

21-
- name: Build
22-
run: go build -v ./...
23-
2421
- name: Test
25-
run: go test ./...
22+
run: make test
2623

2724
- name: Benchmark
28-
run: go test -v -run=XXX -benchmem -bench=. ./...
25+
run: make benchmark
26+
27+
checks:
28+
runs-on: ubuntu-latest
29+
steps:
30+
- uses: actions/checkout@v3
31+
32+
- name: Set up Go
33+
uses: actions/setup-go@v3
34+
with:
35+
go-version: 1.21
36+
37+
- name: Checks
38+
run: make checks

Makefile

+12-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ BUILDFLAGS = -v
44
BENCH = .
55
BENCHFLAGS = -benchmem -bench=${BENCH}
66

7+
IMAGE_PREFIX ?= us.gcr.io/kubernetes-dev
8+
GIT_VERSION ?= $(shell git describe --tags --always --dirty)
9+
710
build:
811
go build ${BUILDFLAGS} ${PKGS}
912

@@ -15,9 +18,16 @@ benchmark:
1518

1619
checks:
1720
go vet ${PKGS}
18-
staticcheck ${PKGS}
21+
go run honnef.co/go/tools/cmd/staticcheck@latest ${PKGS}
1922
make lint
2023

2124
lint:
22-
go run github.com/golangci/golangci-lint/cmd/golangci-lint@latest run -c .golangci.yml -v
25+
go run github.com/golangci/golangci-lint/cmd/golangci-lint@latest run -c .golangci.yml
26+
27+
docker:
28+
docker build --build-arg=GIT_VERSION=$(GIT_VERSION) -t $(IMAGE_PREFIX)/unused -f Dockerfile.exporter .
29+
docker tag $(IMAGE_PREFIX)/unused $(IMAGE_PREFIX)/unused:$(GIT_VERSION)
2330

31+
push: docker
32+
docker push $(IMAGE_PREFIX)/unused:$(GIT_VERSION)
33+
docker push $(IMAGE_PREFIX)/unused:latest

azure/provider.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func (p *Provider) Name() string { return "Azure" }
2525
// Meta returns the provider metadata.
2626
func (p *Provider) Meta() unused.Meta { return p.meta }
2727

28-
// Id returns the subscription for this provider.
28+
// ID returns the subscription for this provider.
2929
func (p *Provider) ID() string { return p.client.SubscriptionID }
3030

3131
// NewProvider creates a new Azure [unused.Provider].

cmd/unused-exporter/exporter.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ func (e *exporter) pollProvider(p unused.Provider) {
182182
}
183183

184184
addMetric(e.info, 1)
185-
addMetric(e.dur, int64(dur.Microseconds()))
185+
addMetric(e.dur, dur.Microseconds())
186186
addMetric(e.suc, success)
187187

188188
for ns, di := range diskInfoByNamespace {

0 commit comments

Comments
 (0)