ci: fixed performance issues, converted more fields to hidden
Signed-off-by: Sam Alba <samalba@users.noreply.github.com>
This commit is contained in:
parent
8e2f3eb21d
commit
2a9cf1ce7c
@ -37,11 +37,7 @@ let GolangCILintVersion = "1.44.0"
|
||||
// base image for the Go linter
|
||||
// https://golangci-lint.run/usage/install/#docker
|
||||
goLinter: _goLinter.output
|
||||
_goLinter: docker.#Build & {
|
||||
steps: [
|
||||
docker.#Pull & {
|
||||
_goLinter: docker.#Pull & {
|
||||
source: "index.docker.io/golangci/golangci-lint:v\(GolangCILintVersion)"
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
|
39
ci/main.cue
39
ci/main.cue
@ -8,13 +8,19 @@ import (
|
||||
)
|
||||
|
||||
engine.#Plan & {
|
||||
|
||||
// FIXME: Ideally we would want to automatically set the platform's arch identical to the host
|
||||
// to avoid the performance hit caused by qemu (linter goes from <3s to >3m when arch is x86)
|
||||
platform: "linux/aarch64"
|
||||
|
||||
inputs: {
|
||||
params: {
|
||||
// FIXME: until we support a better way
|
||||
os: string | *"darwin"
|
||||
arch: string | *"amd64"
|
||||
|
||||
// FIXME: implement condition actions using params
|
||||
// FIXME: implement condition actions using params until we have a
|
||||
// better way to select specific actions
|
||||
}
|
||||
|
||||
directories: {
|
||||
@ -29,20 +35,23 @@ engine.#Plan & {
|
||||
}
|
||||
|
||||
actions: {
|
||||
goModCache: engine.#CacheDir & {
|
||||
_goModCache: "go mod cache": {
|
||||
dest: "/gomodcache"
|
||||
contents: engine.#CacheDir & {
|
||||
id: "go mod cache"
|
||||
}
|
||||
}
|
||||
|
||||
baseImages: #Images
|
||||
_baseImages: #Images
|
||||
|
||||
source: "dagger source code": {
|
||||
_source: "dagger source code": {
|
||||
contents: inputs.directories.source.contents
|
||||
dest: "/usr/src/dagger"
|
||||
}
|
||||
|
||||
// FIXME: build only if the linter passed
|
||||
build: bash.#Run & {
|
||||
input: baseImages.goBuilder
|
||||
input: _baseImages.goBuilder
|
||||
|
||||
env: {
|
||||
GOMODCACHE: mounts["go mod cache"].dest
|
||||
@ -59,27 +68,23 @@ engine.#Plan & {
|
||||
./cmd/dagger/
|
||||
"""#
|
||||
|
||||
mounts: {
|
||||
source
|
||||
|
||||
"go mod cache": {
|
||||
dest: "/gomodcache"
|
||||
contents: goModCache
|
||||
}
|
||||
}
|
||||
|
||||
workdir: mounts["dagger source code"].dest
|
||||
mounts: {
|
||||
_source
|
||||
_goModCache
|
||||
}
|
||||
|
||||
export: directories: "/build": _
|
||||
}
|
||||
|
||||
goLint: bash.#Run & {
|
||||
input: baseImages.goLinter
|
||||
input: _baseImages.goLinter
|
||||
|
||||
// FIXME: the source volume is too slow, taking >3m on docker for mac (vs < 2sec on the host machine)
|
||||
script: contents: "golangci-lint run -v --timeout 5m"
|
||||
workdir: mounts["dagger source code"].dest
|
||||
mounts: {
|
||||
source
|
||||
_source
|
||||
_goModCache
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user