Skip to content

Commit 8e616f8

Browse files
committed
fix windows build, check version
1 parent 3632ce0 commit 8e616f8

5 files changed

Lines changed: 33 additions & 11 deletions

File tree

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ before_install:
1313

1414
before_deploy:
1515
- go build -v --tags static -ldflags "-X main.Version=${TRAVIS_TAG}"
16+
- v=$(${PWD}/gtm verify "${TRAVIS_TAG}"); echo "$v"; if [ ! "$v" == "true" ]; then exit 1; fi
1617
- tar -zcf gtm.${TRAVIS_TAG}.${TRAVIS_OS_NAME}.tar.gz gtm
1718
- shasum -a 256 gtm.${TRAVIS_TAG}.${TRAVIS_OS_NAME}.tar.gz > gtm.${TRAVIS_TAG}.${TRAVIS_OS_NAME}.checksum.txt
1819

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
BINARY = bin/gtm
2-
VERSION = gtm-dev-$(shell date +'%Y.%m.%d-%H:%M:%S')
2+
VERSION = 0.0.0-dev
33
COMMIT = $(shell git show -s --format='%h' HEAD)
44
LDFLAGS = -ldflags "-X main.Version=$(VERSION)-$(COMMIT)"
55
GIT2GO_VERSION = v27
66
GIT2GO_PATH = $(GOPATH)/src/github.com/libgit2/git2go
7+
LIBGIT2_PATH = $(GIT2GO_PATH)/vendor/libgit2
78
PKGS = $(shell go list ./... | grep -v vendor)
89
BUILD_TAGS = static
910

@@ -60,7 +61,7 @@ git2go-install:
6061
git submodule update --init
6162

6263
git2go: git2go-install
63-
cd $(GIT2GO_PATH)/vendor/libgit2 && \
64+
cd $(LIBGIT2_PATH) && \
6465
mkdir -p install/lib && \
6566
mkdir -p build && \
6667
cd build && \

appveyor.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,16 @@ clone_folder: c:\gopath\src\github.com\git-time-metric\gtm
77
skip_branch_with_pr: true
88

99
environment:
10+
GOVERSION: 1.9.7
1011
GOPATH: c:\gopath
1112
PROJ_DIR: /c/gopath/src/github.com/git-time-metric/gtm
1213

1314
install:
14-
- go env
15+
- rmdir c:\go /s /q
16+
- appveyor DownloadFile https://storage.googleapis.com/golang/go%GOVERSION%.windows-amd64.msi
17+
- msiexec /i go%GOVERSION%.windows-amd64.msi /q
1518
- go version
19+
- go env
1620

1721
build_script:
1822
- c:\msys64\usr\bin\bash -lc "cd ${PROJ_DIR} && make git2go-install"

command/verify.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ func (c VerifyCmd) Run(args []string) int {
6363
return 1
6464
}
6565

66+
// NOTE a newline is not sent when outputting to terminal.
67+
// THis makes it easier to assign to a shell variable.
68+
// For example, v=$(gtm verify "1.0.0") but because there is
69+
// no newline running gtm verify will not display anything
6670
c.output(fmt.Sprintf("%t", valid))
6771
return 0
6872
}

script/appveyor-build.sh

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,31 @@ cmake -DTHREADSAFE=ON \
2424
-DCURL=OFF \
2525
-G "MSYS Makefiles" \
2626
.. &&
27-
28-
cmake --build . --target install
29-
30-
cd "${GIT2GO_PATH}" && go install --tags static
27+
cmake --build .
3128

3229
cd "${GOPATH}/src/github.com/git-time-metric/gtm"
3330
go get -d ./...
3431
go test --tags static $(go list ./... | grep -v vendor)
3532
if [[ "${APPVEYOR_REPO_TAG}" = true ]]; then
36-
go build --tags static -v -ldflags "-X main.Version=${APPVEYOR_REPO_TAG_NAME}"
33+
version=${APPVEYOR_REPO_TAG_NAME}
34+
go build -v --tags static -ldflags "-X main.Version=${version}"
35+
36+
# make sure version is set correctly
37+
v="$(${GOPATH}/src/github.com/git-time-metric/gtm/gtm.exe verify ${version})"
38+
if [ ! "$v" == "true" ]; then
39+
exit 1
40+
fi
41+
3742
tar -zcf "gtm.${APPVEYOR_REPO_TAG_NAME}.windows.tar.gz" gtm.exe
3843
else
39-
timestamp=$(date +%s)
40-
go build --tags static -v -ldflags "-X main.Version=developer-build-${timestamp}"
41-
tar -zcf "gtm.developer-build-${timestamp}.windows.tar.gz" gtm.exe
44+
version='0.0.0-dev'
45+
go build -v --tags static -ldflags "-X main.Version=${version}"
46+
47+
# make sure version is set correctly
48+
v="$(${GOPATH}/src/github.com/git-time-metric/gtm/gtm.exe verify ${version})"
49+
if [ ! "$v" == "true" ]; then
50+
exit 1
51+
fi
52+
53+
tar -zcf "gtm.developer-build-${version}.windows.tar.gz" gtm.exe
4254
fi

0 commit comments

Comments
 (0)