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

chore: (automate) housekeeping #134

Merged
merged 11 commits into from
Jun 4, 2024
30 changes: 30 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
version: 2
updates:
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "daily"
labels:
- "housekeeping"
- "dependencies"
commit-message:
prefix: "chore"
include: "scope"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
labels:
- "housekeeping"
commit-message:
prefix: "chore"
include: "scope"
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "daily"
labels:
- "housekeeping"
commit-message:
prefix: "chore"
include: "scope"
33 changes: 33 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: pre-commit.ci

on: [push, pull_request]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"

- uses: actions/setup-go@v5
with:
go-version-file: "go.mod"

- name: Install go toolchain for pre-commit
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.58.0
go install mvdan.cc/gofumpt@latest
go install github.com/matryer/moq@latest
go install github.com/norwoodj/helm-docs/cmd/helm-docs@latest

- name: Run pre-commit
uses: pre-commit/[email protected]

- name: Run pre-commit.ci
uses: pre-commit-ci/[email protected]
if: always()
with:
msg: |
chore(deps): [pre-commit.ci] auto fixes\n\nFor more information, see https://pre-commit.ci
20 changes: 9 additions & 11 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# yaml-language-server: $schema=https://golangci-lint.run/jsonschema/golangci.jsonschema.json
linters-settings:
depguard:
# new configuration
Expand Down Expand Up @@ -36,7 +37,7 @@ linters-settings:
replacement: "any"
goimports:
local-prefixes: github.com/golangci/golangci-lint
gomnd:
mnd:
# don't include the "operation" and "assign"
checks:
- argument
Expand All @@ -52,14 +53,17 @@ linters-settings:
- strings.SplitN

govet:
check-shadowing: true
enable-all: true
disable:
- fieldalignment # disabled because it's too strict, it checks if struct fields are sorted by size
settings:
printf:
funcs:
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf

lll:
line-length: 140
misspell:
Expand Down Expand Up @@ -91,7 +95,7 @@ linters:
- gocyclo
- gofmt
- goimports
- gomnd
- mnd
- goprintffuncname
- gosec
- gosimple
Expand Down Expand Up @@ -127,12 +131,11 @@ linters:
# - wsl

issues:
# Excluding configuration per-path, per-linter, per-text and per-source
exclude-rules:
- path: _test\.go
linters:
- gomnd
- revive
- mnd # test files can have magic numbers
- revive # test files can have unused parameters

- path: pkg/golinters/errcheck.go
text: "SA1019: errCfg.Exclude is deprecated: use ExcludeFunctions instead"
Expand All @@ -154,8 +157,3 @@ issues:

run:
timeout: 5m
skip-dirs:
- test/testdata_etc # test files
- internal/cache # extracted from Go code
- internal/renameio # extracted from Go code
- internal/robustio # extracted from Go code
2 changes: 2 additions & 0 deletions .goreleaser-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ snapshot:
name_template: "commit-{{ .ShortCommit }}"
builds:
- env: [CGO_ENABLED=0]
flags:
- -tags=viper_bind_struct # https://github.com/caas-team/sparrow/issues/78, https://github.com/spf13/viper/pull/1429#issuecomment-1870976604
ldflags:
- -s -w -X main.version={{ .Version }}
- -extldflags "-static"
Expand Down
2 changes: 2 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
project_name: sparrow
builds:
- env: [CGO_ENABLED=0]
flags:
- -tags=viper_bind_struct # https://github.com/caas-team/sparrow/issues/78, https://github.com/spf13/viper/pull/1429#issuecomment-1870976604
ldflags:
- -s -w -X main.version={{ .Tag }}
- -extldflags "-static"
Expand Down
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ repos:
types: [go]
pass_filenames: false
always_run: true

- repo: https://github.com/tekwizely/pre-commit-golang
rev: v1.0.0-rc.1
hooks:
Expand All @@ -20,6 +21,11 @@ repos:
args: [-l, -w]
- id: golangci-lint-repo-mod
args: [--config, .golangci.yaml, --, --fix]

# You need to install helm-docs manually via the go toolchain:
# go install github.com/norwoodj/helm-docs/cmd/helm-docs@latest
# If you have installed it in a different way, you should use the binary of the
# go toolchain instead, because behavior may differ.
- repo: https://github.com/norwoodj/helm-docs
rev: v1.13.1
hooks:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM alpine:3.18 as prep
FROM alpine:3.19 as prep

RUN apk add --no-cache ca-certificates
RUN adduser \
Expand Down
2 changes: 0 additions & 2 deletions chart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,3 @@ A Helm chart to install Sparrow
| startupProbe | object | `{"enabled":false,"failureThreshold":10,"initialDelaySeconds":10,"path":"/","periodSeconds":5,"successThreshold":1,"timeoutSeconds":1}` | Specifies the configuration for a startup probe to check if the sparrow application is started. Ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/ |
| tolerations | list | `[]` | |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.13.1](https://github.com/norwoodj/helm-docs/releases/v1.13.1)
34 changes: 16 additions & 18 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,38 @@ go 1.22
require (
github.com/aeden/traceroute v0.0.0-20210211061815-03f5f7cb7908
github.com/getkin/kin-openapi v0.120.0
github.com/go-chi/chi/v5 v5.0.10
github.com/go-chi/chi/v5 v5.0.12
github.com/google/go-cmp v0.6.0
github.com/jarcoal/httpmock v1.3.1
github.com/spf13/cobra v1.8.0
github.com/spf13/viper v1.18.0
github.com/stretchr/testify v1.8.4
github.com/spf13/viper v1.18.2
github.com/stretchr/testify v1.9.0
gopkg.in/yaml.v3 v3.0.1
)

require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.3 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/go-openapi/jsonpointer v0.20.0 // indirect
github.com/go-openapi/swag v0.22.4 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/go-openapi/jsonpointer v0.21.0 // indirect
github.com/go-openapi/swag v0.23.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/invopop/yaml v0.2.0 // indirect
github.com/invopop/yaml v0.3.1 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/perimeterx/marshmallow v1.1.5 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_golang v1.17.0
github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 // indirect
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.11.1 // indirect
github.com/prometheus/client_golang v1.19.0
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.53.0 // indirect
github.com/prometheus/procfs v0.14.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
Expand All @@ -48,9 +46,9 @@ require (
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect
golang.org/x/sys v0.16.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect
golang.org/x/sys v0.20.0 // indirect
golang.org/x/text v0.15.0 // indirect
google.golang.org/protobuf v1.34.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
)
Loading
Loading