This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
dagger/docs/tests/use-cases/ci-cd-for-go-project/test/dagger.cue
Tom Chauveau 2d3acc61e0
Add dagger golang use case
Signed-off-by: Vasek - Tom C <tom.chauveau@epitech.eu>
2022-03-16 12:14:24 +01:00

35 lines
592 B
CUE

package main
import (
"dagger.io/dagger"
"universe.dagger.io/go"
)
dagger.#Plan & {
client: {
// Retrieve go source code
filesystem: ".": read: {
contents: dagger.#FS
include: ["go.mod", "go.sum", "**/*.go"]
}
}
actions: {
// Alias to code directory
_code: client.filesystem.".".read.contents
// Improved go base image with useful tool
// Enable cgo by installing build-base
_base: go.#Image & {
packages: "build-base": version: _
}
// Run go unit test
"unit-test": go.#Test & {
source: _code
package: "./..."
input: _base.output
}
}
}