Skip to content

Commit

Permalink
Initial import
Browse files Browse the repository at this point in the history
  • Loading branch information
vmercierfr committed Sep 22, 2023
1 parent 11465ea commit ec313e9
Show file tree
Hide file tree
Showing 65 changed files with 4,741 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: build
run-name: building and publishing new release
on:
push:
# run only against tags
tags:
- "*"
permissions:
contents: write # allows the action to create a Github release
id-token: write # This is required for requesting the AWS JWT

jobs:
build-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-east-1 # ECR Public can only be logged into from the us-east-1 region
role-to-assume: arn:aws:iam::202662887508:role/ecr-prometheus-rds-exporter
role-session-name: githubActions

- name: Login to Amazon ECR
id: login-ecr-public
uses: aws-actions/amazon-ecr-login@v1
with:
registry-type: public
mask-password: 'true'

- run: git fetch --force --tags

- uses: actions/setup-go@v4
with:
go-version: stable

- uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Helm release
run: make helm-release
51 changes: 51 additions & 0 deletions .github/workflows/linter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: linter
on:
push:
branches:
- "*"

permissions:
contents: read

jobs:
golangci:
name: golangci
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.21'
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
# Require: The version of golangci-lint to use.
# When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version.
# When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit.
version: v1.54

# Optional: working directory, useful for monorepos
# working-directory: somedir

# Optional: golangci-lint command line arguments.
#
# Note: By default, the `.golangci.yml` file should be at the root of the repository.
# The location of the configuration file can be changed by using `--config=`
# args: --timeout=30m --config=/my/path/.golangci.yml --issues-exit-code=0

# Optional: show only new issues if it's a pull request. The default value is `false`.
# only-new-issues: true

# Optional: if set to true, then all caching functionality will be completely disabled,
# takes precedence over all other caching options.
# skip-cache: true

# Optional: if set to true, then the action won't cache or restore ~/go/pkg.
# skip-pkg-cache: true

# Optional: if set to true, then the action won't cache or restore ~/.cache/go-build.
# skip-build-cache: true

# Optional: The mode to install golangci-lint. It can be 'binary' or 'goinstall'.
# install-mode: "goinstall"
49 changes: 49 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: unittest
on:
push:
branches:
- "*"

permissions:
contents: read

jobs:
go:
name: go
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.21'
- name: Install dependencies
run: |
go get .
- name: Build
run: make build
- name: Run Go tests
run: make test
helm:
name: helm
runs-on: ubuntu-latest
env:
HELM_UNITTEST_VERSION: v0.3.5
steps:
- uses: actions/checkout@v3
- name: Install helm-unittest
run: helm plugin install --version $HELM_UNITTEST_VERSION https://github.com/helm-unittest/helm-unittest.git
- name: Run Helm test
run: make helm-test
kubeconform:
name: kubeconform
runs-on: ubuntu-latest
env:
KUBECONFORM_VERSION: 0.6.2
steps:
- uses: actions/checkout@v3
- name: Install kubeconform
run: |
curl -sSLo /tmp/kubeconform.tar.gz "https://github.com/yannh/kubeconform/releases/download/v${KUBECONFORM_VERSION}/kubeconform-linux-amd64.tar.gz" \
&& tar -C /usr/local/bin/ -xzvf /tmp/kubeconform.tar.gz
- name: Run Kubeconform test
run: make kubeconform
30 changes: 30 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
prometheus-rds-exporter
metrics

# If you prefer the allow list template instead of the deny list, see community template:
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
#
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

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

# Output of the go coverage tool, specifically when used with LiteIDE
*.out
coverage.txt
coverage.xml
lint-report.xml

# Dependency directories (remove the comment below to include it)
# vendor/

# Go workspace file
go.work

# Build files
dist
94 changes: 94 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
run:
concurrency: 4
deadline: 2m
issues-exit-code: 1
tests: true

output:
format: colored-line-number
print-issued-lines: true
print-linter-name: true

linters:
enable-all: false
disable-all: false
enable:
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- typecheck
- unused
- asciicheck
- bodyclose
- dogsled
- durationcheck
- errorlint
- exhaustive
- exportloopref
- forcetypeassert
- gochecknoinits
- goconst
- gocritic
- gocyclo
- godox
- goerr113
- gofmt
- gofumpt
- goimports
- gomnd
- gomodguard
- goprintffuncname
- gosec
- importas
- makezero
- misspell
- nakedret
- nestif
- nilerr
- nlreturn
- noctx
- nolintlint
- prealloc
- predeclared
- revive
- rowserrcheck
- sqlclosecheck
- stylecheck
- testpackage
- thelper
- tparallel
- unconvert
- unparam
- wastedassign
- whitespace
- wrapcheck
- wsl

linters-settings:
gocyclo:
min-complexity: 35

revive:
rules:
- name: exported
disabled: true

lll:
line-length: 120

issues:
exclude-use-default: false
max-per-linter: 1024
max-same: 1024

exclude-rules:
# Exclude some linters from running on test files
- path: _test\.go
linters:
# bodyclose reports some false-positives when using a test request recorder
- bodyclose
# It's overkill to use `NewRequestWithContext` in tests
- noctx

Loading

0 comments on commit ec313e9

Please sign in to comment.