Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-workhorse
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-workhorse
Commits
29781570
Commit
29781570
authored
Aug 17, 2018
by
Andrew Newdigate
Committed by
Nick Thomas
Aug 17, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improvements and cleanup to the Makefile
parent
ef80978f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
82 additions
and
46 deletions
+82
-46
.gitignore
.gitignore
+1
-0
Makefile
Makefile
+81
-46
No files found.
.gitignore
View file @
29781570
...
@@ -7,3 +7,4 @@ testdata/public
...
@@ -7,3 +7,4 @@ testdata/public
/_build
/_build
# Avoid distributing redigomock because it is GPLv2
# Avoid distributing redigomock because it is GPLv2
/vendor/github.com/rafaeljusto/redigomock
/vendor/github.com/rafaeljusto/redigomock
coverage.html
Makefile
View file @
29781570
PREFIX
=
/usr/local
PREFIX
=
/usr/local
VERSION
=
$(
shell
git describe
)
-
$(
shell
date
-u
+%Y%m%d.%H%M%S
)
PKG
:=
gitlab.com/gitlab-org/gitlab-workhorse
BUILD_DIR
=
$(
shell
pwd
)
BUILD_DIR
:=
$(CURDIR)
export
GOPATH
=
${BUILD_DIR}
/_build
TARGET_DIR
:=
$(BUILD_DIR)
/_build
export
PATH
:=
${GOPATH}
/bin:
${PATH}
TARGET_SETUP
:=
$(TARGET_DIR)
/.ok
GOBUILD
=
go build
-ldflags
"-X main.Version=
${VERSION}
"
BIN_BUILD_DIR
:=
$(TARGET_DIR)
/bin
PKG
=
gitlab.com/gitlab-org/gitlab-workhorse
PKG_BUILD_DIR
:=
$(TARGET_DIR)
/src/
$(PKG)
PKG_ALL
=
$(
shell
GOPATH
=
${GOPATH}
go list
${PKG}
/... |
grep
-v
/vendor/
)
COVERAGE_DIR
:=
$(TARGET_DIR)
/cover
EXE_ALL
=
gitlab-zip-cat gitlab-zip-metadata gitlab-workhorse
VERSION
:=
$(
shell
git describe
)
-
$(
shell
date
-u
+%Y%m%d.%H%M%S
)
GOBUILD
:=
go build
-ldflags
"-X main.Version=
$(VERSION)
"
all
:
clean-build $(EXE_ALL)
EXE_ALL
:=
gitlab-zip-cat gitlab-zip-metadata gitlab-workhorse
gitlab-zip-cat
:
${BUILD_DIR}/_build/.sync $(shell find cmd/gitlab-zip-cat/ -name '*.go')
# Some users may have these variables set in their environment, but doing so could break
${GOBUILD}
-o
${BUILD_DIR}
/
$@
${PKG}
/cmd/
$@
# their build process, so unset then
un
export
GOROOT
gitlab-zip-metadata
:
${BUILD_DIR}/_build/.sync $(shell find cmd/gitlab-zip-metadata/ -name '*.go')
un
export
GOBIN
${GOBUILD}
-o
${BUILD_DIR}
/
$@
${PKG}
/cmd/
$@
export
GOPATH
:=
$(TARGET_DIR)
gitlab-workhorse
:
${BUILD_DIR}/_build/.sync $(shell find . -name '*.go' | grep -v '^
\.
/_')
export
PATH
:=
$(GOPATH)
/bin:
$(PATH)
${GOBUILD}
-o
${BUILD_DIR}
/
$@
${PKG}
# Returns a list of all non-vendored (local packages)
install
:
gitlab-workhorse gitlab-zip-cat gitlab-zip-metadata
LOCAL_PACKAGES
=
$(
shell
cd
"
$(PKG_BUILD_DIR)
"
&&
GOPATH
=
$(GOPATH)
go list ./... |
grep
-v
-e
'^
$(PKG)
/vendor/'
-e
'^
$(PKG)
/ruby/'
)
mkdir
-p
$(DESTDIR)${PREFIX}
/bin/
cd
${BUILD_DIR}
&&
install
gitlab-workhorse gitlab-zip-cat gitlab-zip-metadata
${DESTDIR}${PREFIX}
/bin/
.NOTPARALLEL
:
${BUILD_DIR}/_build/.sync
:
.PHONY
:
all
mkdir
-p
${BUILD_DIR}
/_build/src/
${PKG}
all
:
clean-build $(EXE_ALL)
tar
-cf
-
--exclude
_build
--exclude
.git
.
|
(
cd
${BUILD_DIR}
/_build/src/
${PKG}
&&
tar
-xf
-
)
touch
$@
$(TARGET_SETUP)
:
@
echo
"### Setting up
$(TARGET_SETUP)
"
.PHONY
:
test
rm
-rf
$(TARGET_DIR)
test
:
clean-build clean-workhorse govendor prepare-tests
mkdir
-p
"
$(
dir
$(PKG_BUILD_DIR)
)
"
go
fmt
${PKG_ALL}
|
awk
'{ print } END { if (NR > 0) { print "Please run go fmt"; exit 1 } }'
ln
-sf
../../../..
"
$(PKG_BUILD_DIR)
"
mkdir
-p
"
$(BIN_BUILD_DIR)
"
touch
"
$(TARGET_SETUP)
"
gitlab-zip-cat
:
$(TARGET_SETUP) $(shell find cmd/gitlab-zip-cat/ -name '*.go')
$(GOBUILD)
-o
$(BUILD_DIR)
/
$@
$(PKG)
/cmd/
$@
gitlab-zip-metadata
:
$(TARGET_SETUP) $(shell find cmd/gitlab-zip-metadata/ -name '*.go')
$(GOBUILD)
-o
$(BUILD_DIR)
/
$@
$(PKG)
/cmd/
$@
gitlab-workhorse
:
$(TARGET_SETUP) $(shell find . -name '*.go' | grep -v '^
\.
/_')
$(GOBUILD)
-o
$(BUILD_DIR)
/
$@
$(PKG)
.PHONY
:
install
install
:
gitlab-workhorse gitlab-zip-cat gitlab-zip-metadata
@
echo
"### install"
mkdir
-p
$(DESTDIR)$(PREFIX)
/bin/
cd
$(BUILD_DIR)
&&
install
gitlab-workhorse gitlab-zip-cat gitlab-zip-metadata
$(DESTDIR)$(PREFIX)
/bin/
.PHONY
:
test
test
:
$(TARGET_SETUP) govendor prepare-tests
@
echo
"### verifying formatting with go fmt"
@
go
fmt
$(LOCAL_PACKAGES)
|
awk
'{ print } END { if (NR > 0) { print "Please run go fmt"; exit 1 } }'
_support/detect-context.sh
_support/detect-context.sh
cd
${GOPATH}
/src/
${PKG}
&&
govendor
sync
cp
$(EXE_ALL)
${GOPATH}
/src/
${PKG}
@echo
"### running govendor sync"
go
test
${PKG_ALL}
cd
$(PKG_BUILD_DIR)
&&
govendor
sync
@echo
"### running tests"
@go
test
$(LOCAL_PACKAGES)
@echo
SUCCESS
@echo
SUCCESS
.PHONY
:
govendor
.PHONY
:
govendor
govendor
:
govendor
:
$(TARGET_SETUP)
command
-v
govendor
||
go get github.com/kardianos/govendor
@
command
-v
govendor
||
go get github.com/kardianos/govendor
coverage
:
.PHONY
:
coverage
go
test
-cover
-coverprofile
=
test.coverage
coverage
:
$(TARGET_SETUP) prepare-tests
@
echo
"### coverage"
@
go
test
-cover
-coverprofile
=
test.coverage
$(LOCAL_PACKAGES)
go tool cover
-html
=
test.coverage
-o
coverage.html
go tool cover
-html
=
test.coverage
-o
coverage.html
rm
-f
test.coverage
rm
-f
test.coverage
.PHONY
:
fmt
fmt
:
fmt
:
go
fmt
${PKG_ALL}
@
echo
"### fmt"
@
go
fmt
$(LOCAL_PACKAGES)
.PHONY
:
clean
.PHONY
:
clean
clean
:
clean-workhorse clean-build
clean
:
clean-workhorse clean-build
@
echo
"### clean"
rm
-rf
testdata/data testdata/scratch
rm
-rf
testdata/data testdata/scratch
.PHONY
:
clean-workhorse
.PHONY
:
clean-workhorse
clean-workhorse
:
clean-workhorse
:
cd
${BUILD_DIR}
&&
rm
-f
gitlab-workhorse gitlab-zip-cat gitlab-zip-metadata
@
echo
"### clean-workhorse"
rm
-f
$(EXE_ALL)
.PHONY
:
release
release
:
release
:
@
echo
"### release"
sh _support/release.sh
sh _support/release.sh
.PHONY
:
clean-build
.PHONY
:
clean-build
clean-build
:
clean-build
:
rm
-rf
${BUILD_DIR}
/_build
@
echo
"### clean-build"
rm
-rf
$(TARGET_DIR)
.PHONY
:
prepare-tests
prepare-tests
:
testdata/data/group/test.git $(EXE_ALL)
.PHONY
:
prepare-tests
prepare-tests
:
testdata/data/group/test.git $(EXE_ALL)
testdata/data/group/test.git
:
testdata/data/group/test.git
:
git clone
--quiet
--bare
https://gitlab.com/gitlab-org/gitlab-test.git
$@
git clone
--quiet
--bare
https://gitlab.com/gitlab-org/gitlab-test.git
$@
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment