forked from xperimental/freifunk-exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into develop
- Loading branch information
Showing
9 changed files
with
385 additions
and
242 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,3 +16,6 @@ indent_style = tab | |
|
||
[Makefile] | ||
indent_style = tab | ||
|
||
[*.yaml] | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Docker | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
permissions: | ||
contents: read | ||
packages: write | ||
jobs: | ||
image: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Docker Metadata | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: ghcr.io/xperimental/freifunk-exporter | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Build and push Docker images | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Go | ||
on: | ||
push: { } | ||
pull_request: | ||
branches: | ||
- master | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version-file: go.mod | ||
- name: Test | ||
run: make test | ||
lint: | ||
name: lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version-file: go.mod | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
version: v1.49 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
FROM golang:1.15.6 AS builder | ||
FROM golang:1.19-alpine AS builder | ||
|
||
RUN apk add make git bash | ||
|
||
WORKDIR /build | ||
|
||
|
@@ -7,7 +9,7 @@ RUN go mod download | |
RUN go mod verify | ||
|
||
COPY . /build/ | ||
RUN make | ||
RUN make build-binary | ||
|
||
FROM busybox | ||
LABEL maintainer="Robert Jacob <[email protected]>" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,26 @@ | ||
.PHONY: all test build-binary install clean | ||
|
||
SHELL = bash | ||
DOCKER ?= docker | ||
GO ?= go | ||
GO_CMD := CGO_ENABLED=0 $(GO) | ||
GIT_VERSION := $(shell git describe --tags --dirty || git rev-parse --short HEAD) | ||
VERSION := $(GIT_VERSION:v%=%) | ||
GIT_COMMIT := $(shell git rev-parse HEAD) | ||
|
||
.PHONY: all | ||
all: test build-binary | ||
|
||
.PHONY: test | ||
test: | ||
$(GO_CMD) test -cover ./... | ||
|
||
.PHONY: build-binary | ||
build-binary: | ||
$(GO_CMD) build -tags netgo -ldflags "-w -X main.Version=$(VERSION) -X main.GitCommit=$(GIT_COMMIT)" -o freifunk-exporter . | ||
|
||
install: | ||
install -D -t $(DESTDIR)/usr/bin/ freifunk-exporter | ||
install -D -m 0644 -t $(DESTDIR)/lib/systemd/system/ contrib/freifunk-exporter.service | ||
.PHONY: build-image | ||
build-image: | ||
$(DOCKER) build -t ghcr.io/xperimental/freifunk-exporter:$(VERSION) . | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -f freifunk-exporter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,20 @@ | ||
module github.com/xperimental/freifunk-exporter | ||
|
||
go 1.15 | ||
go 1.19 | ||
|
||
require ( | ||
github.com/prometheus/client_golang v1.9.0 | ||
github.com/prometheus/procfs v0.3.0 // indirect | ||
github.com/prometheus/client_golang v1.13.0 | ||
github.com/spf13/pflag v1.0.5 | ||
golang.org/x/sys v0.0.0-20210113181707-4bcb84eeeb78 // indirect | ||
google.golang.org/protobuf v1.25.0 // indirect | ||
) | ||
|
||
require ( | ||
github.com/beorn7/perks v1.0.1 // indirect | ||
github.com/cespare/xxhash/v2 v2.1.2 // indirect | ||
github.com/golang/protobuf v1.5.2 // indirect | ||
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect | ||
github.com/prometheus/client_model v0.2.0 // indirect | ||
github.com/prometheus/common v0.37.0 // indirect | ||
github.com/prometheus/procfs v0.8.0 // indirect | ||
golang.org/x/sys v0.0.0-20220823224334-20c2bfdbfe24 // indirect | ||
google.golang.org/protobuf v1.28.1 // indirect | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters