Skip to content

Commit

Permalink
internal/relui: add build and test only workflow
Browse files Browse the repository at this point in the history
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 <jenny@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Jenny Rakoczy <jenny@golang.org>
  • Loading branch information
toothrot authored and gopherbot committed Jul 12, 2022
1 parent b6cecd8 commit 75e83af
Showing 1 changed file with 31 additions and 2 deletions.
33 changes: 31 additions & 2 deletions internal/relui/workflows.go
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,29 @@ func RegisterReleaseWorkflows(h *DefinitionHolder, build *BuildReleaseTasks, mil
return err
}
h.RegisterDefinition("Minor releases for Go 1.17 and 1.18", wd)
wd = workflow.New()
if err := addBuildAndTestOnlyWorkflow(wd, version, build, "go1.19", task.KindBeta); err != nil {
return err
}
h.RegisterDefinition("dry-run (test and build only): Go 1.19 next beta", wd)

return nil
}

func addBuildAndTestOnlyWorkflow(wd *workflow.Definition, version *task.VersionTasks, build *BuildReleaseTasks, major string, kind task.ReleaseKind) error {
nextVersion := wd.Task("Get next version", version.GetNextVersion, wd.Constant(kind))
branch := fmt.Sprintf("release-branch.%v", major)
if kind == task.KindBeta {
branch = "master"
}
branchVal := wd.Constant(branch)
releaseBase := wd.Task("Pick release base commit", version.ReadBranchHead, branchVal)
noop := wd.Action("noop", func(_ *workflow.TaskContext) error { return nil })
artifacts, err := build.addBuildTasks(wd, major, nextVersion, releaseBase, wd.Constant([]string{}), true, noop)
if err != nil {
return err
}
wd.Output("Artifacts", artifacts)
return nil
}

Expand Down Expand Up @@ -687,7 +710,7 @@ func addSingleReleaseWorkflow(
wd.Output("Signing command", startSigner)

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

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

0 comments on commit 75e83af

Please sign in to comment.