diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..72948c0 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,4 @@ +version: "2" + +run: + timeout: 5m diff --git a/brewkit.jsonnet b/bkit.jsonnet similarity index 54% rename from brewkit.jsonnet rename to bkit.jsonnet index c99ded5..e0579e7 100644 --- a/brewkit.jsonnet +++ b/bkit.jsonnet @@ -1,4 +1,4 @@ -local project = import 'brewkit/project.libsonnet'; +local project = import 'bkit/project.libsonnet'; local appIDs = [ "anon3anon", diff --git a/bkit/images.libsonnet b/bkit/images.libsonnet new file mode 100644 index 0000000..62b524c --- /dev/null +++ b/bkit/images.libsonnet @@ -0,0 +1,4 @@ +{ + gobuilder: "golang:1.24-alpine", + golangcilint: "golangci/golangci-lint:v2.1-alpine", +} diff --git a/brewkit/project.libsonnet b/bkit/project.libsonnet similarity index 71% rename from brewkit/project.libsonnet rename to bkit/project.libsonnet index 92296b4..9c597a0 100644 --- a/brewkit/project.libsonnet +++ b/bkit/project.libsonnet @@ -18,10 +18,10 @@ local gocache = [ { project(appIDs):: { - apiVersion: "brewkit/v1", + apiVersion: "bkit/v1", targets: { - all: ["modules", "build"], + all: ["modules", "build", "check"], } + { modules: ["gotidy", "modulesvendor"], @@ -62,6 +62,30 @@ local gocache = [ } } for appID in appIDs + } + { + check: ["test", "lint"], + + test: { + from: "gobase", + workdir: "/app", + cache: gocache, + command: "go test ./..." + }, + + lint: { + from: images.golangcilint, + workdir: "/app", + cache: gocache, + copy: [ + copyFrom("gosources", "/app", "/app"), + copy(".golangci.yml", ".golangci.yml"), + ], + env: { + GOCACHE: "/app/cache/go-build", + GOLANGCI_LINT_CACHE: "/app/cache/go-build", + }, + command: "golangci-lint run" + }, } + { gobase: { from: images.gobuilder, diff --git a/brewkit/images.libsonnet b/brewkit/images.libsonnet deleted file mode 100644 index e493c8a..0000000 --- a/brewkit/images.libsonnet +++ /dev/null @@ -1,3 +0,0 @@ -{ - gobuilder: "golang:1.24.2" -}