-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
92560a0
commit f54705f
Showing
27 changed files
with
339 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Test | ||
|
||
on: [push] | ||
|
||
jobs: | ||
deployment: | ||
name: Test the code | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: "1.20" | ||
|
||
- name: Check formatting using gofmt | ||
run: gofmt -s -l -d . | ||
|
||
- name: Get dependencies | ||
run: go mod download | ||
|
||
- name: Test with coverage | ||
run: go test ./... | ||
|
||
release: | ||
name: Test the release process | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: "1.20" | ||
|
||
- name: Run GoReleaser to create a snapshot release | ||
uses: goreleaser/goreleaser-action@v2 | ||
with: | ||
version: latest | ||
args: --skip-publish --snapshot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,3 +19,5 @@ | |
|
||
# Go workspace file | ||
go.work | ||
.env | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
# This file contains all available configuration options | ||
# with their default values. | ||
|
||
# options for analysis running | ||
run: | ||
# timeout for analysis, e.g. 30s, 5m, default is 1m | ||
timeout: 5m | ||
|
||
# include test files or not, default is true | ||
tests: false | ||
|
||
# default is true. Enables skipping of directories: | ||
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$ | ||
skip-dirs-use-default: true | ||
|
||
|
||
# output configuration options | ||
output: | ||
# colored-line-number|line-number|json|tab|checkstyle|code-climate|junit-xml|github-actions | ||
# default is "colored-line-number" | ||
format: colored-line-number | ||
|
||
# print lines of code with issue, default is true | ||
print-issued-lines: true | ||
|
||
# print linter name in the end of issue text, default is true | ||
print-linter-name: true | ||
|
||
# make issues output unique by line, default is true | ||
uniq-by-line: true | ||
|
||
# add a prefix to the output file references; default is no prefix | ||
path-prefix: "" | ||
|
||
# sorts results by: filepath, line and column | ||
sort-results: false | ||
|
||
|
||
linters-settings: | ||
dupl: | ||
threshold: 100 | ||
funlen: | ||
lines: 100 | ||
statements: 50 | ||
gci: | ||
sections: | ||
- standard | ||
- default | ||
- prefix(github.com/spacelift-io/awsautoscalr) | ||
goconst: | ||
min-len: 2 | ||
min-occurrences: 2 | ||
staticcheck: | ||
go: "1.18" | ||
checks: [ "all", "-SA1019"] | ||
gocritic: | ||
enabled-tags: | ||
- diagnostic | ||
- performance | ||
disabled-checks: | ||
- ifElseChain | ||
- wrapperFunc | ||
- hugeParam | ||
- rangeValCopy | ||
- appendCombine | ||
- commentedOutCode | ||
- sloppyReassign | ||
- filepathJoin | ||
- evalOrder | ||
- equalFold | ||
- returnAfterHttpError | ||
- preferStringWriter | ||
- sprintfQuotedString | ||
- preferFprint | ||
goimports: | ||
local-prefixes: github.com/spacelift-io/awsautoscalr | ||
govet: | ||
check-shadowing: false | ||
nolintlint: | ||
allow-leading-space: true # don't require machine-readable nolint directives (i.e. with no leading space) | ||
require-explanation: false # don't require an explanation for nolint directives | ||
require-specific: false # don't require nolint directives to be specific about which linter is being skipped | ||
depguard: | ||
list-type: blacklist | ||
include-go-root: true | ||
packages: | ||
# The io/ioutil package has been deprecated. | ||
# https://go.dev/doc/go1.16#ioutil | ||
- io/ioutil | ||
|
||
|
||
linters: | ||
disable-all: true | ||
enable: | ||
- depguard | ||
- exportloopref | ||
- gci | ||
- gocritic | ||
- gofmt | ||
- goimports | ||
- goprintffuncname | ||
- gosec | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
- nolintlint | ||
- staticcheck | ||
- structcheck | ||
- typecheck | ||
|
||
severity: | ||
# Default value is empty string. | ||
# Set the default severity for issues. If severity rules are defined and the issues | ||
# do not match or no severity is provided to the rule this will be the default | ||
# severity applied. Severities should match the supported severity names of the | ||
# selected out format. | ||
# - Code climate: https://docs.codeclimate.com/docs/issues#issue-severity | ||
# - Checkstyle: https://checkstyle.sourceforge.io/property_types.html#severity | ||
# - GitHub: https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-error-message | ||
default-severity: error | ||
|
||
# The default value is false. | ||
# If set to true severity-rules regular expressions become case sensitive. | ||
case-sensitive: false | ||
|
||
# Default value is empty list. | ||
# When a list of severity rules are provided, severity information will be added to lint | ||
# issues. Severity rules have the same filtering capability as exclude rules except you | ||
# are allowed to specify one matcher per severity rule. | ||
# Only affects out formats that support setting severity information. | ||
rules: | ||
- linters: | ||
- dupl | ||
severity: info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
builds: | ||
- main: ./cmd/lambda | ||
env: | ||
- CGO_ENABLED=0 | ||
- GOPRIVATE="github.com/spacelift-io" | ||
mod_timestamp: '{{ .CommitTimestamp }}' | ||
flags: [-trimpath, -v] | ||
goos: [linux] | ||
goarch: [amd64, arm64] | ||
binary: '{{ .ProjectName }}_v{{ .Version }}' | ||
|
||
archives: | ||
- format: zip | ||
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}' | ||
|
||
changelog: | ||
use: github-native | ||
|
||
release: | ||
draft: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package main | ||
|
||
import ( | ||
"context" | ||
"os" | ||
|
||
"golang.org/x/exp/slog" | ||
|
||
"github.com/aws/aws-xray-sdk-go/xray" | ||
cmdinternal "github.com/spacelift-io/awsautoscalr/cmd/internal" | ||
) | ||
|
||
func main() { | ||
logger := slog.New(slog.NewJSONHandler(os.Stdout, nil)) | ||
|
||
if err := xray.Configure(xray.Config{ServiceVersion: "1.2.3"}); err != nil { | ||
logger.With("msg", err.Error()).Error("could not configure X-Ray") | ||
os.Exit(1) | ||
} | ||
|
||
ctx, segment := xray.BeginSegment(context.Background(), "autoscaling") | ||
|
||
if err := cmdinternal.Handle(ctx, logger); err != nil { | ||
logger.With("msg", err.Error()).Error("could not handle request") | ||
segment.Close(err) | ||
os.Exit(1) | ||
} | ||
|
||
segment.Close(nil) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.