ci: update test on push src path

This commit is contained in:
Slug-Boi
2024-11-01 08:34:05 +01:00
parent 73ee788e8b
commit 350458afb9
+4 -4
View File
@@ -25,17 +25,17 @@ func main() {
// at /src in the container // at /src in the container
source := client.Container(). source := client.Container().
From("golang:1.23"). From("golang:1.23").
WithDirectory("/src", client.Host().Directory(".", dagger.HostDirectoryOpts{ WithDirectory("/src_d", client.Host().Directory(".", dagger.HostDirectoryOpts{
Exclude: []string{"build/"}, Exclude: []string{"build/"},
})).WithMountedCache("/src/dagger_dep_cache/go_dep", goCache) })).WithMountedCache("/src_d/dagger_dep_cache/go_dep", goCache)
// set the working directory in the container // set the working directory in the container
// install application dependencies // install application dependencies
runner := source.WithWorkdir("/src/src_code/go_src/"). runner := source.WithWorkdir("/src_d/src").
WithExec([]string{"go", "mod", "tidy"}).WithEnvVariable("CI", "true") WithExec([]string{"go", "mod", "tidy"}).WithEnvVariable("CI", "true")
// run application tests // run application tests
out, err := runner.WithWorkdir("/src/src_code/go_src/").WithExec([]string{"go", "test", "./..."}). out, err := runner.WithWorkdir("/src_d/src").WithExec([]string{"go", "test", "./..."}).
Stderr(ctx) Stderr(ctx)
if err != nil { if err != nil {
panic(err) panic(err)