Skip to content

Commit

Permalink
Add flag for running test
Browse files Browse the repository at this point in the history
  • Loading branch information
Shell32-Natsu committed May 21, 2020
1 parent 1dced55 commit 2b0b29a
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions releasing/releasing/releasing.go
Expand Up @@ -23,7 +23,7 @@ var modules = [...]string{
}
var verbose bool // Enable verbose or not
var noDryRun bool // Disable dry run
var noTest bool // Disable module tests
var doTest bool // Enable module tests
var tempDir string // Temporary directory path for git worktree

// === Log helper functions ===
Expand Down Expand Up @@ -153,7 +153,11 @@ var release = &cobra.Command{
mod.Tag(),
)

if !noDryRun {
// Run module tests
output, err := mod.RunTest()
if err != nil {
logWarn(output)
} else if !noDryRun {
logInfo("Skipping push module %s. Run with --no-dry-run to push the release.", mod.name)
} else {
pushRelease(tempDir, branch, mod)
Expand All @@ -179,7 +183,7 @@ func main() {
}
rootCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "verbose output")
release.Flags().BoolVarP(&noDryRun, "no-dry-run", "", false, "disable dry-run")
release.Flags().BoolVarP(&noTest, "no-test", "", false, "don't run module tests")
release.Flags().BoolVarP(&doTest, "do-test", "", false, "run module tests before releasing")

if err := rootCmd.Execute(); err != nil {
logFatal(err.Error())
Expand Down Expand Up @@ -298,7 +302,7 @@ func (m *module) Tag() string {
}

func (m module) RunTest() (string, error) {
if noTest {
if !doTest {
logInfo("Tests disabled.")
return "", nil
}
Expand Down

0 comments on commit 2b0b29a

Please sign in to comment.