Do some basic chores

This commit is contained in:
Jan Graefen 2022-12-14 14:33:16 +01:00
parent 4962f36150
commit 30bb17cc29
6 changed files with 181 additions and 193 deletions

View file

@ -1,13 +1,13 @@
root = true
[*]
charset = utf-8
end_of_line = crlf
indent_size = 4
indent_style = tab
insert_final_newline = true
max_line_length = 120
tab_width = 4
[{*.yaml, *.yml}]
indent_size = 2
root = true
[*]
charset = utf-8
end_of_line = crlf
indent_size = 4
indent_style = tab
insert_final_newline = true
max_line_length = 120
tab_width = 4
[{*.yaml, *.yml}]
indent_size = 2

View file

@ -1,11 +1,14 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "gomod" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/.github/workflows/"
schedule:
interval: "daily"
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "daily"

View file

@ -1,66 +1,66 @@
name: Build
on:
push:
branches: [ main ]
paths-ignore:
- README.md
- LICENSE
- .gitignore
- .editorconfig
- .chartreleaser.yaml
- .github/workflows/*-helm.yaml
- helm/**
- version.yaml
pull_request:
branches: [ main ]
paths-ignore:
- README.md
- LICENSE
- .gitignore
- .editorconfig
- .chartreleaser.yaml
- .github/workflows/*-helm.yaml
- helm/**
- version.yaml
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: ^1.18
- name: Checkout code
uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.45
build:
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: ^1.18
- name: Checkout code
uses: actions/checkout@v3
- name: Get dependencies
run: |
export GO111MODULE=on
go get -v -t -d ./...
- name: Build
run: |
export GO111MODULE=on
go mod download
GOOS=linux GOARCH=amd64 go build -o bin/hcloud-pricing-exporter-linux-amd64 main.go
GOOS=linux GOARCH=arm64 go build -o bin/hcloud-pricing-exporter-linux-arm64 main.go
GOOS=windows GOARCH=amd64 go build -o bin/hcloud-pricing-exporter-windows-amd64.exe main.go
- name: Upload Artifacts
uses: actions/upload-artifact@master
with:
name: binaries
path: bin/
name: Build
on:
push:
branches: [ main ]
paths-ignore:
- README.md
- LICENSE
- .gitignore
- .editorconfig
- .chartreleaser.yaml
- .github/workflows/*-helm.yaml
- helm/**
- version.yaml
pull_request:
branches: [ main ]
paths-ignore:
- README.md
- LICENSE
- .gitignore
- .editorconfig
- .chartreleaser.yaml
- .github/workflows/*-helm.yaml
- helm/**
- version.yaml
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: ^1.19
- name: Checkout code
uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.48
build:
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: ^1.19
- name: Checkout code
uses: actions/checkout@v3
- name: Get dependencies
run: |
export GO111MODULE=on
go get -v -t -d ./...
- name: Build
run: |
export GO111MODULE=on
go mod download
GOOS=linux GOARCH=amd64 go build -o bin/hcloud-pricing-exporter-linux-amd64 main.go
GOOS=linux GOARCH=arm64 go build -o bin/hcloud-pricing-exporter-linux-arm64 main.go
GOOS=windows GOARCH=amd64 go build -o bin/hcloud-pricing-exporter-windows-amd64.exe main.go
- name: Upload Artifacts
uses: actions/upload-artifact@master
with:
name: binaries
path: bin/

View file

@ -1,65 +1,65 @@
name: Release
on:
push:
tags:
- 'v*'
jobs:
binaryrelease:
name: Binary Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.16
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
dockerrelease:
name: Docker Release
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
with:
images: jangraefen/hcloud-pricing-exporter
tag-sha: true
tag-semver: |
{{version}}
{{major}}.{{minor}}
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Login to GitHub docker registry
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build docker image
uses: docker/build-push-action@v2
with:
context: .
platforms: |
linux/amd64
linux/arm64/v8
linux/arm/v7
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
push: true
name: Release
on:
push:
tags:
- 'v*'
jobs:
binaryrelease:
name: Binary Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
dockerrelease:
name: Docker Release
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
with:
images: jangraefen/hcloud-pricing-exporter
tag-sha: true
tag-semver: |
{{version}}
{{major}}.{{minor}}
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Login to GitHub docker registry
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build docker image
uses: docker/build-push-action@v2
with:
context: .
platforms: |
linux/amd64
linux/arm64/v8
linux/arm/v7
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
push: true

View file

@ -1,15 +0,0 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "daily"

46
go.mod
View file

@ -1,23 +1,23 @@
module github.com/jangraefen/hcloud-pricing-exporter
go 1.18
require (
github.com/hetznercloud/hcloud-go v1.35.2
github.com/jtaczanowski/go-scheduler v0.1.0
github.com/prometheus/client_golang v1.13.0
)
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/net v0.0.0-20220225172249-27dd8689420f // indirect
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect
golang.org/x/text v0.3.7 // indirect
google.golang.org/protobuf v1.28.1 // indirect
)
module github.com/jangraefen/hcloud-pricing-exporter
go 1.19
require (
github.com/hetznercloud/hcloud-go v1.35.2
github.com/jtaczanowski/go-scheduler v0.1.0
github.com/prometheus/client_golang v1.13.0
)
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/net v0.0.0-20220225172249-27dd8689420f // indirect
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect
golang.org/x/text v0.3.7 // indirect
google.golang.org/protobuf v1.28.1 // indirect
)