closer to release automation
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
615947a05a
commit
1a459d6f6f
|
@ -13,7 +13,7 @@ func globalResetOptions(box *gui.Node) {
|
||||||
me.deleteGoSrcPkgB = buildOptions.NewButton("rm ~/go/src & ~/go/pkg", func() {
|
me.deleteGoSrcPkgB = buildOptions.NewButton("rm ~/go/src & ~/go/pkg", func() {
|
||||||
for _, repo := range me.allrepos {
|
for _, repo := range me.allrepos {
|
||||||
// status := repo.getStatus()
|
// status := repo.getStatus()
|
||||||
if repo.status.CheckDirty() {
|
if repo.checkDirty() {
|
||||||
log.Warn("repo is dirty. commit your changes first", repo.String())
|
log.Warn("repo is dirty. commit your changes first", repo.String())
|
||||||
me.deleteGoSrcPkgB.SetLabel("rm ~/go/src (can't. dirty repos)")
|
me.deleteGoSrcPkgB.SetLabel("rm ~/go/src (can't. dirty repos)")
|
||||||
return
|
return
|
||||||
|
|
12
go.mod
12
go.mod
|
@ -3,11 +3,11 @@ module go.wit.com/apps/autotypist
|
||||||
go 1.21.4
|
go 1.21.4
|
||||||
|
|
||||||
require (
|
require (
|
||||||
go.wit.com/gui v0.13.11
|
go.wit.com/gui v0.13.13
|
||||||
go.wit.com/lib/debugger v0.13.0
|
go.wit.com/lib/debugger v0.13.14
|
||||||
go.wit.com/lib/gadgets v0.13.0
|
go.wit.com/lib/gadgets v0.13.13
|
||||||
go.wit.com/lib/gui/logsettings v0.13.0
|
go.wit.com/lib/gui/logsettings v0.13.14
|
||||||
go.wit.com/lib/gui/repostatus v0.13.1
|
go.wit.com/lib/gui/repostatus v0.13.13
|
||||||
go.wit.com/log v0.5.6
|
go.wit.com/log v0.5.6
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -15,5 +15,5 @@ require (
|
||||||
go.wit.com/dev/alexflint/arg v1.4.5 // indirect
|
go.wit.com/dev/alexflint/arg v1.4.5 // indirect
|
||||||
go.wit.com/dev/alexflint/scalar v1.2.1 // indirect
|
go.wit.com/dev/alexflint/scalar v1.2.1 // indirect
|
||||||
go.wit.com/dev/davecgh/spew v1.1.4 // indirect
|
go.wit.com/dev/davecgh/spew v1.1.4 // indirect
|
||||||
go.wit.com/widget v1.1.6 // indirect
|
go.wit.com/widget v1.1.7 // indirect
|
||||||
)
|
)
|
||||||
|
|
24
go.sum
24
go.sum
|
@ -4,17 +4,17 @@ go.wit.com/dev/alexflint/scalar v1.2.1 h1:loXOcbVnd+8YeJRLey+XXidecBiedMDO00zQ26
|
||||||
go.wit.com/dev/alexflint/scalar v1.2.1/go.mod h1:+rYsfxqdI2cwA8kJ7GCMwWbNJvfvWUurOCXLiwdTtSs=
|
go.wit.com/dev/alexflint/scalar v1.2.1/go.mod h1:+rYsfxqdI2cwA8kJ7GCMwWbNJvfvWUurOCXLiwdTtSs=
|
||||||
go.wit.com/dev/davecgh/spew v1.1.4 h1:C9hj/rjlUpdK+E6aroyLjCbS5MFcyNUOuP1ICLWdNek=
|
go.wit.com/dev/davecgh/spew v1.1.4 h1:C9hj/rjlUpdK+E6aroyLjCbS5MFcyNUOuP1ICLWdNek=
|
||||||
go.wit.com/dev/davecgh/spew v1.1.4/go.mod h1:sihvWmnQ/09FWplnEmozt90CCVqBtGuPXM811tgfhFA=
|
go.wit.com/dev/davecgh/spew v1.1.4/go.mod h1:sihvWmnQ/09FWplnEmozt90CCVqBtGuPXM811tgfhFA=
|
||||||
go.wit.com/gui v0.13.11 h1:d74Ko/XFZYR25P/AZfCQaVO2CuGh1BSjdUp1wjktdDg=
|
go.wit.com/gui v0.13.13 h1:rIaEIYol92gHbP/JkJCmFdzo7u5Bc3WoqBA3hwttL6o=
|
||||||
go.wit.com/gui v0.13.11/go.mod h1:v2VgnOL3dlZ13KclYeedZ1cd20nQdvwjyJTNKvFX3DA=
|
go.wit.com/gui v0.13.13/go.mod h1:xdCB1u4UqyaijwZnDdO9510nBlbf4Cdgfsd+R7VtUDo=
|
||||||
go.wit.com/lib/debugger v0.13.0 h1:k5XCa7BZFYA37rFf20iTAm5L4Ch+3eRuxCbHIhorYZI=
|
go.wit.com/lib/debugger v0.13.14 h1:SNNk7iXBQ3Gyk5Y28PrVTpr5OwNB0AxhuOSuO3qW55A=
|
||||||
go.wit.com/lib/debugger v0.13.0/go.mod h1:b3gykobdR+lcMjWAHJUa3GRsMYbnaHNwA/upfjpSA28=
|
go.wit.com/lib/debugger v0.13.14/go.mod h1:tK3vo1n2VWRmf0yji8Lya6VlnjOVRXbS26Z3F3E97wk=
|
||||||
go.wit.com/lib/gadgets v0.13.0 h1:jtsEnf4DHqAxBxuYsaDlHti73rgaxYf/ffAXNB1PJAk=
|
go.wit.com/lib/gadgets v0.13.13 h1:pyAvyPKHuLJt4QW8+D3SfNpSF7YR8i0sBQPtLwSvZlc=
|
||||||
go.wit.com/lib/gadgets v0.13.0/go.mod h1:xidaHAL6Nk9+M9FkySVU1AG5i39v7T3PuFphUos6LxE=
|
go.wit.com/lib/gadgets v0.13.13/go.mod h1:6uIhec8M5XAzaoHhNBaGpglY/bFJC5PY9KIqZ1R/LJ0=
|
||||||
go.wit.com/lib/gui/logsettings v0.13.0 h1:iphACMcfdc5GoCcxZkShcWn9A/SwvnPmLXCSYSL+eJU=
|
go.wit.com/lib/gui/logsettings v0.13.14 h1:pC5wPwVsnFrdKgdpsFnn3eftXyufmdE3OXJo/tqmhwU=
|
||||||
go.wit.com/lib/gui/logsettings v0.13.0/go.mod h1:h+skqrtQ3muJ1TzMQ7M568xAwqT7nZCGS32c5jYCrqc=
|
go.wit.com/lib/gui/logsettings v0.13.14/go.mod h1:jHjCXCTRV+2ZcVTXVZtXQqT/qYhZkFpmktMWRbyA9QE=
|
||||||
go.wit.com/lib/gui/repostatus v0.13.1 h1:BFIBw6p1RoqvC3ibTpYTt/Tefsq86lXf6VKY0DZqqlk=
|
go.wit.com/lib/gui/repostatus v0.13.13 h1:kttHRob2AFefdbNMDz39Xlmi2gImp6sFIYpE3KMS4YA=
|
||||||
go.wit.com/lib/gui/repostatus v0.13.1/go.mod h1:1q7IVR7sJ9r7wkrMi9VAG1JQFxy5PQutXCLPIUCvLd8=
|
go.wit.com/lib/gui/repostatus v0.13.13/go.mod h1:kxHv1MecOASGZeRjflPuswARXqtfrhjwrTQU6eX7tRg=
|
||||||
go.wit.com/log v0.5.6 h1:rDC3ju95zfEads4f1Zm+QMkqjZ39CsYAT/UmQQs7VP4=
|
go.wit.com/log v0.5.6 h1:rDC3ju95zfEads4f1Zm+QMkqjZ39CsYAT/UmQQs7VP4=
|
||||||
go.wit.com/log v0.5.6/go.mod h1:BaJBfHFqcJSJLXGQ9RHi3XVhPgsStxSMZRlaRxW4kAo=
|
go.wit.com/log v0.5.6/go.mod h1:BaJBfHFqcJSJLXGQ9RHi3XVhPgsStxSMZRlaRxW4kAo=
|
||||||
go.wit.com/widget v1.1.6 h1:av2miF5vlohMfARA/QGPTPfgW/ADup1c+oeAOKgroPY=
|
go.wit.com/widget v1.1.7 h1:Gy84I2bD8CMna7NcKBX4sRLR8do6x6mVYX0Ui43f3is=
|
||||||
go.wit.com/widget v1.1.6/go.mod h1:I8tnD3x3ECbB/CRNnLCdC+uoyk7rK0AEkzK1bQYSqoQ=
|
go.wit.com/widget v1.1.7/go.mod h1:I8tnD3x3ECbB/CRNnLCdC+uoyk7rK0AEkzK1bQYSqoQ=
|
||||||
|
|
4
main.go
4
main.go
|
@ -33,9 +33,9 @@ func main() {
|
||||||
// scan repos every 30 seconds
|
// scan repos every 30 seconds
|
||||||
// check every second for the checkbox changing
|
// check every second for the checkbox changing
|
||||||
var i int = 60
|
var i int = 60
|
||||||
myTicker(1 * time.Second, "newScan()", func() {
|
myTicker(1*time.Second, "newScan()", func() {
|
||||||
i += 1
|
i += 1
|
||||||
if ! me.scanEveryMinute.Checked() {
|
if !me.scanEveryMinute.Checked() {
|
||||||
if i < 60 {
|
if i < 60 {
|
||||||
i = 60
|
i = 60
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"go.wit.com/gui"
|
"go.wit.com/gui"
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
|
@ -43,6 +44,9 @@ func createReleaseWindow() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
versionS := "0.13.13"
|
||||||
|
partS := strings.Split(versionS, ".")
|
||||||
|
|
||||||
release.win = gadgets.NewBasicWindow(me.myGui, "Make a new release")
|
release.win = gadgets.NewBasicWindow(me.myGui, "Make a new release")
|
||||||
release.win.Custom = func() {
|
release.win.Custom = func() {
|
||||||
log.Info("Release Window close")
|
log.Info("Release Window close")
|
||||||
|
@ -59,6 +63,8 @@ func createReleaseWindow() {
|
||||||
scanGoSum()
|
scanGoSum()
|
||||||
|
|
||||||
release.grid.NewButton("next repo", func() {
|
release.grid.NewButton("next repo", func() {
|
||||||
|
buttonDisable()
|
||||||
|
defer buttonEnable()
|
||||||
log.Info("find the next repo to release here")
|
log.Info("find the next repo to release here")
|
||||||
if findNextDirty() {
|
if findNextDirty() {
|
||||||
log.Info("findNextDirty() found a repo")
|
log.Info("findNextDirty() found a repo")
|
||||||
|
@ -79,6 +85,17 @@ func createReleaseWindow() {
|
||||||
log.Info("find the next repo first")
|
log.Info("find the next repo first")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
// make sure read only is set
|
||||||
|
if release.current.status.ReadOnly() {
|
||||||
|
release.readOnly.SetValue("true")
|
||||||
|
} else {
|
||||||
|
release.readOnly.SetValue("false")
|
||||||
|
}
|
||||||
|
|
||||||
|
// do a new scan
|
||||||
|
release.current.newScan()
|
||||||
|
|
||||||
|
// only continue if the go.sum & go.mod files are clean
|
||||||
if ok, missing := release.current.status.CheckGoSum(); ok {
|
if ok, missing := release.current.status.CheckGoSum(); ok {
|
||||||
log.Info("repo has go.sum requirements that are clean")
|
log.Info("repo has go.sum requirements that are clean")
|
||||||
release.status.SetValue("CLEAN")
|
release.status.SetValue("CLEAN")
|
||||||
|
@ -87,21 +104,17 @@ func createReleaseWindow() {
|
||||||
log.Info("BAD repo has go.sum requirements that are screwed up. missing:", missing)
|
log.Info("BAD repo has go.sum requirements that are screwed up. missing:", missing)
|
||||||
release.status.SetValue("BAD")
|
release.status.SetValue("BAD")
|
||||||
release.current.setGoSumStatus("BAD")
|
release.current.setGoSumStatus("BAD")
|
||||||
}
|
|
||||||
if release.current.status.ReadOnly() {
|
|
||||||
release.readOnly.SetValue("true")
|
|
||||||
} else {
|
|
||||||
release.readOnly.SetValue("false")
|
|
||||||
}
|
|
||||||
release.current.newScan()
|
|
||||||
|
|
||||||
if release.current.dirtyLabel.String() == "PERFECT" {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// log.Info("find the next repo to release here")
|
if release.current.dirtyLabel.String() == "PERFECT" {
|
||||||
|
log.Info("REPO IS STILL DIRTY")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// open the status window to commit the release
|
||||||
release.current.status.Toggle()
|
release.current.status.Toggle()
|
||||||
release.current.status.SetVersion("0", "13", "11", release.reason.String())
|
release.current.status.SetVersion(partS[0], partS[1], partS[2], release.reason.String())
|
||||||
release.current.status.Update()
|
release.current.status.Update()
|
||||||
})
|
})
|
||||||
release.openrepo.Disable()
|
release.openrepo.Disable()
|
||||||
|
@ -112,23 +125,23 @@ func createReleaseWindow() {
|
||||||
release.notes = gadgets.NewOneLiner(release.grid, "notes")
|
release.notes = gadgets.NewOneLiner(release.grid, "notes")
|
||||||
|
|
||||||
release.version = gadgets.NewOneLiner(release.grid, "version")
|
release.version = gadgets.NewOneLiner(release.grid, "version")
|
||||||
release.version.SetText("0.13.11")
|
release.version.SetText(versionS)
|
||||||
|
|
||||||
release.reason = gadgets.NewBasicEntry(release.grid, "release reason")
|
release.reason = gadgets.NewBasicEntry(release.grid, "release reason")
|
||||||
release.reason.SetText("hide works")
|
release.reason.SetText("hide works")
|
||||||
|
|
||||||
release.sendVersionB = release.grid.NewButton("send version", func() {
|
release.sendVersionB = release.grid.NewButton("send version", func() {
|
||||||
log.Info("set version()")
|
log.Info("set version()")
|
||||||
release.current.status.SetVersion("0", "13", "12", release.reason.String())
|
release.current.status.SetVersion(partS[0], partS[1], partS[2], release.reason.String())
|
||||||
})
|
})
|
||||||
release.grid.NewButton("set ignore", func() {
|
release.grid.NewButton("set ignore", func() {
|
||||||
tmp := release.current.getGoSumStatus()
|
tmp := release.current.getGoSumStatus()
|
||||||
log.Info("trying to set repo IGNORE is now =", tmp)
|
log.Info("trying to set repo IGNORE is now =", tmp)
|
||||||
release.current.setGoSumStatus("IGNORE")
|
release.current.setGoSumStatus("IGNORE")
|
||||||
})
|
})
|
||||||
release.checkDirtyB = release.grid.NewButton("CheckDirty()", func() {
|
release.checkDirtyB = release.grid.NewButton("checkDirty()", func() {
|
||||||
buttonDisable()
|
buttonDisable()
|
||||||
if release.current.status.CheckDirty() {
|
if release.current.checkDirty() {
|
||||||
log.Info("repo is dirty")
|
log.Info("repo is dirty")
|
||||||
} else {
|
} else {
|
||||||
log.Info("repo is not dirty")
|
log.Info("repo is not dirty")
|
||||||
|
@ -220,23 +233,33 @@ func createReleaseWindow() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func buttonDisable() {
|
func buttonDisable() {
|
||||||
release.goGetB.Disable()
|
release.win.Disable()
|
||||||
release.makeRedomodB.Disable()
|
/*
|
||||||
release.checkGoSumB.Disable()
|
release.nextRepoB.Disable()
|
||||||
release.openrepo.Disable()
|
release.openRepoB.Disable()
|
||||||
release.checkDirtyB.Disable()
|
release.goGetB.Disable()
|
||||||
release.sendVersionB.Disable()
|
release.makeRedomodB.Disable()
|
||||||
release.checkSafeB.Disable()
|
release.checkGoSumB.Disable()
|
||||||
|
release.openrepo.Disable()
|
||||||
|
release.checkDirtyB.Disable()
|
||||||
|
release.sendVersionB.Disable()
|
||||||
|
release.checkSafeB.Disable()
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
func buttonEnable() {
|
func buttonEnable() {
|
||||||
release.goGetB.Enable()
|
release.win.Enable()
|
||||||
release.makeRedomodB.Enable()
|
/*
|
||||||
release.checkGoSumB.Enable()
|
release.nextRepoB.Enable()
|
||||||
release.openrepo.Enable()
|
release.openRepoB.Enable()
|
||||||
release.checkDirtyB.Enable()
|
release.goGetB.Enable()
|
||||||
release.sendVersionB.Enable()
|
release.makeRedomodB.Enable()
|
||||||
release.checkSafeB.Enable()
|
release.checkGoSumB.Enable()
|
||||||
|
release.openrepo.Enable()
|
||||||
|
release.checkDirtyB.Enable()
|
||||||
|
release.sendVersionB.Enable()
|
||||||
|
release.checkSafeB.Enable()
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
func findDirty2() bool {
|
func findDirty2() bool {
|
||||||
|
@ -305,6 +328,12 @@ func findNextDirty() bool {
|
||||||
}
|
}
|
||||||
// latestversion := repo.status.GetLastTagVersion()
|
// latestversion := repo.status.GetLastTagVersion()
|
||||||
if goSumS == "CLEAN" {
|
if goSumS == "CLEAN" {
|
||||||
|
// if it's clean here, then check and remake the go.sum file
|
||||||
|
// then stop to commit the release version
|
||||||
|
repo.checkSafeGoSumRemake()
|
||||||
|
if repo.checkDirty() {
|
||||||
|
dirtyS = repo.dirtyLabel.String()
|
||||||
|
}
|
||||||
if dirtyS == "PERFECT" {
|
if dirtyS == "PERFECT" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -348,6 +377,12 @@ func findNextRepo() bool {
|
||||||
}
|
}
|
||||||
// latestversion := repo.status.GetLastTagVersion()
|
// latestversion := repo.status.GetLastTagVersion()
|
||||||
if goSumS == "CLEAN" {
|
if goSumS == "CLEAN" {
|
||||||
|
// if it's clean here, then check and remake the go.sum file
|
||||||
|
// then stop to commit the release version
|
||||||
|
repo.checkSafeGoSumRemake()
|
||||||
|
if repo.checkDirty() {
|
||||||
|
dirtyS = repo.dirtyLabel.String()
|
||||||
|
}
|
||||||
if dirtyS == "PERFECT" {
|
if dirtyS == "PERFECT" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -370,6 +405,12 @@ func findNextRepo() bool {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if goSumS == "BAD" {
|
if goSumS == "BAD" {
|
||||||
|
// if it's clean here, then check and remake the go.sum file
|
||||||
|
// then stop to commit the release version
|
||||||
|
repo.checkSafeGoSumRemake()
|
||||||
|
if repo.checkDirty() {
|
||||||
|
dirtyS = repo.dirtyLabel.String()
|
||||||
|
}
|
||||||
if setCurrentRepo(repo, "bad", "redo go.sum") {
|
if setCurrentRepo(repo, "bad", "redo go.sum") {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
26
scan.go
26
scan.go
|
@ -63,20 +63,6 @@ func (r *repo) newScan() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *repo) getStatus() string {
|
|
||||||
if r.status.CheckDirty() {
|
|
||||||
log.Warn("CheckDirty() true")
|
|
||||||
return "dirty"
|
|
||||||
}
|
|
||||||
|
|
||||||
if r.status.CheckBranches() {
|
|
||||||
log.Warn("Branches are Perfect")
|
|
||||||
return "PERFECT"
|
|
||||||
}
|
|
||||||
log.Warn("Branches are not Perfect")
|
|
||||||
return "merge"
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *repo) getGoSumStatus() string {
|
func (r *repo) getGoSumStatus() string {
|
||||||
return r.goSumStatus.String()
|
return r.goSumStatus.String()
|
||||||
}
|
}
|
||||||
|
@ -86,10 +72,20 @@ func (r *repo) setGoSumStatus(s string) {
|
||||||
r.status.SetGoSumStatus(s)
|
r.status.SetGoSumStatus(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *repo) checkDirty() bool {
|
||||||
|
if r.status.CheckDirty() {
|
||||||
|
log.Info("dirty repo:", r.status.String(), r.getGoSumStatus())
|
||||||
|
r.setGoSumStatus("DIRTY")
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
func (r *repo) checkSafeGoSumRemake() {
|
func (r *repo) checkSafeGoSumRemake() {
|
||||||
if ok, bad := r.status.CheckSafeGoSumRemake(); ok {
|
if ok, bad := r.status.CheckSafeGoSumRemake(); ok {
|
||||||
log.Info("checkSafeGoSumRemake() is safe to redo")
|
log.Info("checkSafeGoSumRemake() is safe to redo")
|
||||||
r.setGoSumStatus("SAFE")
|
r.setGoSumStatus("SAFE")
|
||||||
|
r.status.MakeRedomod()
|
||||||
} else {
|
} else {
|
||||||
log.Info("checkSafeGoSumRemake() is not safe. problems:", bad)
|
log.Info("checkSafeGoSumRemake() is not safe. problems:", bad)
|
||||||
r.setGoSumStatus("BAD DEP")
|
r.setGoSumStatus("BAD DEP")
|
||||||
|
@ -110,7 +106,7 @@ func scanGoSum() {
|
||||||
repo.setGoSumStatus("PRIMATIVE")
|
repo.setGoSumStatus("PRIMATIVE")
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if repo.status.CheckDirty() {
|
if repo.checkDirty() {
|
||||||
log.Info("dirty repo:", latestversion, repo.status.String())
|
log.Info("dirty repo:", latestversion, repo.status.String())
|
||||||
log.Info("dirty repo.getGoSumStatus =", repo.getGoSumStatus())
|
log.Info("dirty repo.getGoSumStatus =", repo.getGoSumStatus())
|
||||||
repo.setGoSumStatus("DIRTY")
|
repo.setGoSumStatus("DIRTY")
|
||||||
|
|
Loading…
Reference in New Issue