Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Winter cleanup #6

Merged
merged 1 commit into from
Dec 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 2 additions & 8 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,2 @@
.build/
.tarballs/

!.build/linux-amd64
!.build/linux-armv7
!.build/linux-arm64
!.build/linux-ppc64le
!.build/linux-s390x
**
!tankerkoenig_exporter
54 changes: 54 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: CI

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
check-latest: true
go-version-file: go.mod
- uses: golangci/golangci-lint-action@v3

test:
name: Test
needs: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
check-latest: true
cache: true
go-version-file: go.mod
- run: make test

build:
name: Build
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v3
with:
check-latest: true
cache: true
go-version-file: go.mod
- uses: goreleaser/goreleaser-action@v3
with:
args: build --snapshot
- uses: actions/upload-artifact@v3
with:
path: dist
36 changes: 36 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Release

on:
push:
tags:
- "v*"

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v3
with:
check-latest: true
cache: true
go-version-file: go.mod
- uses: docker/login-action@v1
with:
registry: docker.io
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- uses: goreleaser/goreleaser-action@v3
with:
args: release
env:
GITHUB_TOKEN: ${{ github.token }}
HOMEBREW_TOKEN: ${{ secrets.HOMEBREW_TOKEN }}
27 changes: 21 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
.build
bin/tankerkoenig_exporter*
tankerkoenig_exporter
*.tar.gz
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test
*.mprof
*-stamp

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Build artifacts
dist
man

# Go mod timestamp for Makefile
/dep.stamp

# Local $GOBIN directory for tools
/bin/
48 changes: 48 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
run:
modules-download-mode: readonly
skip-dirs:
- .git
- .github
- .vscode
- bin
- dist

linters:
disable-all: true
enable:
- bodyclose
- dogsled
- dupl
- errcheck
- exportloopref
- goconst
- gofmt
- goimports
- gosec
- gosimple
- govet
- ineffassign
- misspell
- nolintlint
- prealloc
- revive
- staticcheck
- stylecheck
- typecheck
- unconvert
- unparam
- unused
- whitespace

linters-settings:
gofmt:
simplify: true
goimports:
local-prefixes: github.com/lukasmalkmus/tankerkoenig_exporter
govet:
check-shadowing: true
nolintlint:
allow-unused: false
allow-leading-space: false
require-explanation: true
require-specific: true
8 changes: 0 additions & 8 deletions .golangci.yml

This file was deleted.

147 changes: 147 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
project_name: tankerkoenig_exporter

builds:
- <<: &build_defaults
binary: tankerkoenig_exporter
main: ./cmd/tankerkoenig_exporter
env:
- CGO_ENABLED=0
tags:
- osusergo
- netgo
- static_build
flags:
- -buildvcs=false
- -buildmode=pie
- -installsuffix=cgo
- -trimpath
ldflags:
- -s -w -extldflags "-fno-PIC -static -Wl -z now -z relro"
- -X github.com/prometheus/common/version.Version={{ .Version }}
- -X github.com/prometheus/common/version.Revision={{ .ShortCommit }}
- -X github.com/prometheus/common/version.Branch={{ .Branch }}
- -X github.com/prometheus/common/version.BuildUser=goreleaser
- -X github.com/prometheus/common/version.BuildDate={{ .CommitDate }}
mod_timestamp: "{{ .CommitTimestamp }}"
id: darwin
goos:
- darwin
goarch:
- amd64
- arm64

- <<: *build_defaults
id: linux
goos:
- linux
goarch:
- amd64
- arm64

- <<: *build_defaults
id: linux-no-pie
flags:
- -buildvcs=false
- -buildmode=exe
- -installsuffix=cgo
- -trimpath
goos:
- linux
goarch:
- arm
- 386
goarm:
- 6
- 7

- <<: *build_defaults
id: docker
flags:
- -buildvcs=false
- -buildmode=exe
- -installsuffix=cgo
- -trimpath
goos:
- linux
goarch:
- amd64

- <<: *build_defaults
id: windows
goos:
- windows
goarch:
- amd64
- 386

archives:
- <<: &archive_defaults
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
id: nix
builds:
- darwin
- linux
- linux-no-pie
wrap_in_directory: true
format: tar.gz
files:
- LICENSE
- README.md
- <<: *archive_defaults
id: windows
builds:
- windows
wrap_in_directory: false
format: zip
files:
- LICENSE
- README.md

checksum:
name_template: checksums.txt

snapshot:
name_template: "{{ .Tag }}-next"

changelog:
use: github-native

milestones:
- repo:
owner: lukasmalkmus
name: tankerkoenig_exporter
close: true
fail_on_error: false

release:
github:
owner: lukasmalkmus
name: tankerkoenig_exporter
prerelease: auto
name_template: Tankerkoenig API Exporter v{{ .Version }}

dockers:
- ids:
- docker
image_templates:
- "docker.io/lukasmalkmus/tankerkoenig_exporter:{{ .Major }}"
- "docker.io/lukasmalkmus/tankerkoenig_exporter:{{ .Major }}.{{ .Minor }}"
- "docker.io/lukasmalkmus/tankerkoenig_exporter:{{ .Major }}.{{ .Minor }}.{{ .Patch }}"
- "docker.io/lukasmalkmus/tankerkoenig_exporter:latest"
- "ghcr.io/lukasmalkmus/tankerkoenig_exporter:{{ .Major }}"
- "ghcr.io/lukasmalkmus/tankerkoenig_exporter:{{ .Major }}.{{ .Minor }}"
- "ghcr.io/lukasmalkmus/tankerkoenig_exporter:{{ .Major }}.{{ .Minor }}.{{ .Patch }}"
- "ghcr.io/lukasmalkmus/tankerkoenig_exporter:latest"
build_flag_templates:
- --platform=linux/amd64
- --label=org.opencontainers.image.title={{ .ProjectName }}
- --label=org.opencontainers.image.description={{ .ProjectName }}
- --label=org.opencontainers.image.url=https://github.com/lukasmalkmus/tankerkoenig_exporter
- --label=org.opencontainers.image.source=https://github.com/lukasmalkmus/tankerkoenig_exporter
- --label=org.opencontainers.image.documentation=https://github.com/lukasmalkmus/tankerkoenig_exporter
- --label=org.opencontainers.image.licenses=Apache 2.0
- --label=org.opencontainers.image.author=Lukas Malkmus <mail@lukasmalkmus.com>
- --label=org.opencontainers.image.created={{ .Date }}
- --label=org.opencontainers.image.revision={{ .FullCommit }}
- --label=org.opencontainers.image.version={{ .Version }}
- --label=org.opencontainers.image.vendor=Lukas Malkmus
26 changes: 0 additions & 26 deletions .promu.yml

This file was deleted.

8 changes: 0 additions & 8 deletions .travis.yml

This file was deleted.

11 changes: 0 additions & 11 deletions Dockerfile

This file was deleted.

Loading