ci: try and add env var earlier in the workflow

This commit is contained in:
Slug-Boi
2024-11-25 20:02:12 +01:00
parent e35bd65dde
commit 27160703f9
+7 -5
View File
@@ -35,22 +35,24 @@ func main() {
// set the working directory in the container // set the working directory in the container
// install application dependencies // install application dependencies
runner := source.WithWorkdir("/src_d/src/"). runner := source.WithWorkdir("/src_d/src/").
WithExec([]string{"go", "mod", "tidy"}) WithExec([]string{"go", "mod", "tidy"}).WithEnvVariable("CI", "true")
// run application tests // run application tests
test := runner.WithWorkdir("/src_d/src/").WithExec([]string{"go", "test", "./..."}).WithEnvVariable("CI", "true") test := runner.WithWorkdir("/src_d/src/").WithExec([]string{"go", "test", "./..."})
//.WithEnvVariable("CI", "true")
buildDir := test.Directory("/src/") buildDir := test.Directory("/src/")
for _, goos := range geese { for _, goos := range geese {
path := fmt.Sprintf("/dist/") path := fmt.Sprintf("/dist/")
filename := fmt.Sprintf("/dist/cocommit_go-%s", goos) filename := fmt.Sprintf("/dist/cocommit_go-%s", goos)
// build application // build application
// write the build output to the host // write the build output to the host
build := test. build := test.
WithEnvVariable("GOOS", goos). WithEnvVariable("GOOS", goos).
WithEnvVariable("GOARCH", goarch). WithEnvVariable("GOARCH", goarch).
WithExec([]string{"go", "build", "-o", filename}).WithEnvVariable("CI", "true") WithExec([]string{"go", "build", "-o", filename})
//.WithEnvVariable("CI", "true")
buildDir = buildDir.WithDirectory(path, build.Directory(path)) buildDir = buildDir.WithDirectory(path, build.Directory(path))