Skip to content

Commit 75e83af

Browse files
toothrotgopherbot
authored andcommitted
internal/relui: add build and test only workflow
Add a workflow for building and testing a beta release. This workflow will not make any public-visible changes, such as publishing artifacts, tagging, announcements, etc. It is useful for testing changes locally. For golang/go#53382 Change-Id: Ic259aed6f0e01635055dafbdad0715de916f2352 Reviewed-on: https://go-review.googlesource.com/c/build/+/416221 Run-TryBot: Jenny Rakoczy <[email protected]> Reviewed-by: Heschi Kreinick <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Auto-Submit: Jenny Rakoczy <[email protected]>
1 parent b6cecd8 commit 75e83af

File tree

1 file changed

+31
-2
lines changed

1 file changed

+31
-2
lines changed

internal/relui/workflows.go

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,29 @@ func RegisterReleaseWorkflows(h *DefinitionHolder, build *BuildReleaseTasks, mil
619619
return err
620620
}
621621
h.RegisterDefinition("Minor releases for Go 1.17 and 1.18", wd)
622+
wd = workflow.New()
623+
if err := addBuildAndTestOnlyWorkflow(wd, version, build, "go1.19", task.KindBeta); err != nil {
624+
return err
625+
}
626+
h.RegisterDefinition("dry-run (test and build only): Go 1.19 next beta", wd)
627+
628+
return nil
629+
}
630+
631+
func addBuildAndTestOnlyWorkflow(wd *workflow.Definition, version *task.VersionTasks, build *BuildReleaseTasks, major string, kind task.ReleaseKind) error {
632+
nextVersion := wd.Task("Get next version", version.GetNextVersion, wd.Constant(kind))
633+
branch := fmt.Sprintf("release-branch.%v", major)
634+
if kind == task.KindBeta {
635+
branch = "master"
636+
}
637+
branchVal := wd.Constant(branch)
638+
releaseBase := wd.Task("Pick release base commit", version.ReadBranchHead, branchVal)
639+
noop := wd.Action("noop", func(_ *workflow.TaskContext) error { return nil })
640+
artifacts, err := build.addBuildTasks(wd, major, nextVersion, releaseBase, wd.Constant([]string{}), true, noop)
641+
if err != nil {
642+
return err
643+
}
644+
wd.Output("Artifacts", artifacts)
622645
return nil
623646
}
624647

@@ -687,7 +710,7 @@ func addSingleReleaseWorkflow(
687710
wd.Output("Signing command", startSigner)
688711

689712
// Build, test, and sign release.
690-
signedAndTestedArtifacts, err := build.addBuildTasks(wd, "go1.19", nextVersion, releaseBase, skipTests, checked)
713+
signedAndTestedArtifacts, err := build.addBuildTasks(wd, "go1.19", nextVersion, releaseBase, skipTests, false, checked)
691714
if err != nil {
692715
return nil, err
693716
}
@@ -714,7 +737,7 @@ func addSingleReleaseWorkflow(
714737

715738
// addBuildTasks registers tasks to build, test, and sign the release onto wd.
716739
// It returns the output from the last task, a slice of signed and tested artifacts.
717-
func (tasks *BuildReleaseTasks) addBuildTasks(wd *workflow.Definition, majorVersion string, version, revision, skipTests workflow.Value, dependency workflow.Dependency) (workflow.Value, error) {
740+
func (tasks *BuildReleaseTasks) addBuildTasks(wd *workflow.Definition, majorVersion string, version, revision, skipTests workflow.Value, skipSigning bool, dependency workflow.Dependency) (workflow.Value, error) {
718741
targets, ok := releasetargets.TargetsForVersion(majorVersion)
719742
if !ok {
720743
return nil, fmt.Errorf("malformed/unknown version %q", majorVersion)
@@ -753,6 +776,12 @@ func (tasks *BuildReleaseTasks) addBuildTasks(wd *workflow.Definition, majorVers
753776
testsPassed = append(testsPassed, long)
754777
}
755778
}
779+
if skipSigning {
780+
builtAndTested := wd.Task("Wait for artifacts and tests", func(ctx *workflow.TaskContext, artifacts []artifact) ([]artifact, error) {
781+
return artifacts, nil
782+
}, append([]workflow.TaskInput{wd.Slice(artifacts...)}, testsPassed...)...)
783+
return builtAndTested, nil
784+
}
756785
stagedArtifacts := wd.Task("Stage artifacts for signing", tasks.copyToStaging, version, wd.Slice(artifacts...))
757786
signedArtifacts := wd.Task("Wait for signed artifacts", tasks.awaitSigned, version, wd.Constant(darwinTargets), stagedArtifacts)
758787
signedAndTested := wd.Task("Wait for signing and tests", func(ctx *workflow.TaskContext, artifacts []artifact) ([]artifact, error) {

0 commit comments

Comments
 (0)