diff --git a/.editorconfig b/.editorconfig index aabcf76..f3e885b 100644 --- a/.editorconfig +++ b/.editorconfig @@ -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 \ No newline at end of file +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 diff --git a/.github/dependabot.yml b/.github/dependabot.yml index eb4bfe6..94b78be 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -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" diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 0ccd06c..3e8207c 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -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/ diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index abcd4ef..a0f7fde 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -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 diff --git a/dependabot.yml b/dependabot.yml deleted file mode 100644 index 1872525..0000000 --- a/dependabot.yml +++ /dev/null @@ -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" diff --git a/go.mod b/go.mod index 1c3127b..6c236c4 100644 --- a/go.mod +++ b/go.mod @@ -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 +)