1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-24 04:16:27 +02:00

Merge pull request #193 from goreleaser/190

logging the reasons why a pipe is being skipped
This commit is contained in:
Carlos Alexandro Becker 2017-04-21 12:09:16 -03:00 committed by GitHub
commit 858b4d1318
5 changed files with 25 additions and 4 deletions

View File

@ -103,7 +103,12 @@ func doRun(ctx *context.Context, client client.Client) error {
Name: ss[1],
}
}
if ctx.Config.Brew.GitHub.Name == "" || !ctx.Publish {
if !ctx.Publish {
log.Println("Skipped because --skip-publish is set")
return nil
}
if ctx.Config.Brew.GitHub.Name == "" {
log.Println("Skipped because brew section is not configured")
return nil
}
path := filepath.Join(ctx.Config.Brew.Folder, ctx.Config.Build.Binary+".rb")

View File

@ -116,7 +116,7 @@ func TestRunPipe(t *testing.T) {
assert.True(client.CreatedFile)
}
func TestRunPipeBrewNotSetup(t *testing.T) {
func TestRunPipeNoDarwin64Build(t *testing.T) {
assert := assert.New(t)
var ctx = &context.Context{
Config: config.Project{
@ -137,6 +137,17 @@ func TestRunPipeBrewNotSetup(t *testing.T) {
assert.False(client.CreatedFile)
}
func TestRunPipeBrewNotSetup(t *testing.T) {
assert := assert.New(t)
var ctx = &context.Context{
Config: config.Project{},
Publish: true,
}
client := &DummyClient{}
assert.NoError(doRun(ctx, client))
assert.False(client.CreatedFile)
}
func TestRunPipeNoDarwinBuild(t *testing.T) {
assert := assert.New(t)
var ctx = &context.Context{}

6
pipeline/env/env.go vendored
View File

@ -4,13 +4,14 @@ package env
import (
"errors"
"log"
"os"
"github.com/goreleaser/goreleaser/context"
)
// ErrMissingToken indicates an error when GITHUB_TOKEN is missing in the environment
var ErrMissingToken = errors.New("Missing GITHUB_TOKEN")
var ErrMissingToken = errors.New("missing GITHUB_TOKEN")
// Pipe for env
type Pipe struct{}
@ -22,10 +23,11 @@ func (Pipe) Description() string {
// Run the pipe
func (Pipe) Run(ctx *context.Context) (err error) {
ctx.Token = os.Getenv("GITHUB_TOKEN")
if !ctx.Validate {
log.Println("Skipped validations because --skip-validate is set")
return nil
}
ctx.Token = os.Getenv("GITHUB_TOKEN")
if ctx.Token == "" {
return ErrMissingToken
}

View File

@ -4,6 +4,7 @@ package git
import (
"fmt"
"log"
"regexp"
"strings"
@ -65,6 +66,7 @@ func (Pipe) Run(ctx *context.Context) (err error) {
// removes usual `v` prefix
ctx.Version = strings.TrimPrefix(tag, "v")
if !ctx.Validate {
log.Println("Skipped validations because --skip-validate is set")
return nil
}
return validate(commit, tag, ctx.Version)

View File

@ -27,6 +27,7 @@ func (Pipe) Run(ctx *context.Context) error {
func doRun(ctx *context.Context, client client.Client) error {
if !ctx.Publish {
log.Println("Skipped because --skip-publish is set")
return nil
}
log.Println("Creating or updating release", ctx.Git.CurrentTag, "on", ctx.Config.Release.GitHub.String())