Skip to content

Commit e05d35e

Browse files
authored
Merge pull request ethereum#3317 from fjl/build-unstable-simplify
build, internal/build: simplify unstable build checks
2 parents f7da5b2 + e1e2df6 commit e05d35e

File tree

4 files changed

+15
-10
lines changed

4 files changed

+15
-10
lines changed

appveyor.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,18 @@ environment:
2222

2323
install:
2424
- rmdir C:\go /s /q
25-
- appveyor DownloadFile https://storage.googleapis.com/golang/go1.7.3.windows-amd64.zip
26-
- 7z x go1.7.3.windows-amd64.zip -y -oC:\ > NUL
25+
- appveyor DownloadFile https://storage.googleapis.com/golang/go1.7.3.windows-%GETH_ARCH%.zip
26+
- 7z x go1.7.3.windows-%GETH_ARCH%.zip -y -oC:\ > NUL
2727
- go version
2828
- gcc --version
2929

3030
build_script:
31-
- go run build\ci.go install -arch %GETH_ARCH%
31+
- go run build\ci.go install
3232

3333
after_build:
34-
- go run build\ci.go archive -arch %GETH_ARCH% -type zip -signer WINDOWS_SIGNING_KEY -upload gethstore/builds
35-
- go run build\ci.go nsis -arch %GETH_ARCH% -signer WINDOWS_SIGNING_KEY -upload gethstore/builds
34+
- go run build\ci.go archive -type zip -signer WINDOWS_SIGNING_KEY -upload gethstore/builds
35+
- go run build\ci.go nsis -signer WINDOWS_SIGNING_KEY -upload gethstore/builds
3636

3737
test_script:
38-
- set GOARCH=%GETH_ARCH%
3938
- set CGO_ENABLED=1
4039
- go run build\ci.go test -vet -coverage

build/ci.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ func makeWorkdir(wdflag string) string {
459459
}
460460

461461
func isUnstableBuild(env build.Environment) bool {
462-
if env.Branch != "master" && env.Tag != "" {
462+
if env.Tag != "" {
463463
return false
464464
}
465465
return true

internal/build/env.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,9 @@ func LocalEnv() Environment {
8888
env.Branch = b
8989
}
9090
}
91-
// Note that we don't get the current git tag. It would slow down
92-
// builds and isn't used by anything.
91+
if env.Tag == "" {
92+
env.Tag = RunGit("for-each-ref", "--points-at=HEAD", "--count=1", "--format=%(refname:short)", "refs/tags")
93+
}
9394
return env
9495
}
9596

internal/build/util.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,19 @@ func VERSION() string {
7676
return string(bytes.TrimSpace(version))
7777
}
7878

79+
var warnedAboutGit bool
80+
7981
// RunGit runs a git subcommand and returns its output.
8082
// The command must complete successfully.
8183
func RunGit(args ...string) string {
8284
cmd := exec.Command("git", args...)
8385
var stdout, stderr bytes.Buffer
8486
cmd.Stdout, cmd.Stderr = &stdout, &stderr
8587
if err := cmd.Run(); err == exec.ErrNotFound {
86-
log.Println("no git in PATH")
88+
if !warnedAboutGit {
89+
log.Println("Warning: can't find 'git' in PATH")
90+
warnedAboutGit = true
91+
}
8792
return ""
8893
} else if err != nil {
8994
log.Fatal(strings.Join(cmd.Args, " "), ": ", err, "\n", stderr.String())

0 commit comments

Comments
 (0)