diff --git a/ci/base.cue b/ci/images.cue similarity index 84% rename from ci/base.cue rename to ci/images.cue index 73fea364..5753a435 100644 --- a/ci/base.cue +++ b/ci/images.cue @@ -8,10 +8,11 @@ let GoVersion = "1.17" let GolangCILintVersion = "1.44.0" // Base container images used for the CI -images: { +#Images: { // base image to build go binaries - goBuilder: docker.#Build & { + goBuilder: _goBuilder.output + _goBuilder: docker.#Build & { _packages: ["bash", "git"] steps: [ @@ -35,7 +36,8 @@ images: { // base image for the Go linter // https://golangci-lint.run/usage/install/#docker - goLinter: docker.#Build & { + goLinter: _goLinter.output + _goLinter: docker.#Build & { steps: [ docker.#Pull & { source: "index.docker.io/golangci/golangci-lint:v\(GolangCILintVersion)" diff --git a/ci/main.cue b/ci/main.cue index 84269e57..a59d7363 100644 --- a/ci/main.cue +++ b/ci/main.cue @@ -24,8 +24,8 @@ engine.#Plan & { } outputs: directories: "go binaries": { - contents: actions.build.export.directories["/build"].contents - dest: "./build" + contents: actions.build.export.directories["/build"].contents + dest: "./build" } actions: { @@ -33,6 +33,8 @@ engine.#Plan & { id: "go mod cache" } + baseImages: #Images + source: "dagger source code": { contents: inputs.directories.source.contents dest: "/usr/src/dagger" @@ -40,7 +42,7 @@ engine.#Plan & { // FIXME: build only if the linter passed build: bash.#Run & { - input: images.goBuilder.output + input: baseImages.goBuilder env: { GOMODCACHE: mounts["go mod cache"].dest @@ -71,7 +73,7 @@ engine.#Plan & { } goLint: bash.#Run & { - input: images.goLinter.output + 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"